@abtnode/blocklet-services 1.16.44-beta-20250529-004636-15e80e20 → 1.16.44-beta-20250601-083116-288e5ea5
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/routes/blocklet.js +3 -1
- package/api/services/static.js +37 -6
- package/dist/assets/{AdapterDayjs-CDDcwz3P.js → AdapterDayjs-Dy2dI4ee.js} +1 -1
- package/dist/assets/{ArrowDropDown-DPqiF9Rw.js → ArrowDropDown-D8DSLfND.js} +1 -1
- package/dist/assets/{CheckCircle-Caqp5gKY.js → CheckCircle-Dv9ESLSx.js} +1 -1
- package/dist/assets/{ChevronLeft-DONyUbIg.js → ChevronLeft-7uRDOkJ0.js} +1 -1
- package/dist/assets/{ChevronRight-DgAwWLdY.js → ChevronRight-DF2CPRSp.js} +1 -1
- package/dist/assets/{DeleteOutline-DpNyWtNL.js → DeleteOutline-MvcW8wMe.js} +1 -1
- package/dist/assets/{Done-BTd13H2U.js → Done-NWTNth4h.js} +1 -1
- package/dist/assets/{Download-Bm8sKXA2.js → Download-4GZsn6dX.js} +1 -1
- package/dist/assets/{Edit-CUl1Rt8i.js → Edit-rnQ_3wHK.js} +1 -1
- package/dist/assets/{Error-DEKvwVoF.js → Error-RKBXSgDA.js} +1 -1
- package/dist/assets/{ExpandLess-t1cH-Bc4.js → ExpandLess-DeQLEewB.js} +1 -1
- package/dist/assets/{Google-Bn3zPWiu.js → Google-BFBQ7QOU.js} +1 -1
- package/dist/assets/{Home-C3ax1tQ7.js → Home-nxfCo0la.js} +1 -1
- package/dist/assets/{InfoOutlined-D3XnF0Vg.js → InfoOutlined-DwH0ULaz.js} +1 -1
- package/dist/assets/{Launch-Dz9mQnYC.js → Launch-CKjiZEMR.js} +1 -1
- package/dist/assets/{LaunchOutlined-E7HcQu_6.js → LaunchOutlined-Mxl2EzJD.js} +1 -1
- package/dist/assets/{MoreHoriz-DpKn_fkc.js → MoreHoriz-Bb60Z0iy.js} +1 -1
- package/dist/assets/{PlayArrow-CDOOUxMp.js → PlayArrow-DSHRafhE.js} +1 -1
- package/dist/assets/{TuneOutlined-D0gGDoIJ.js → TuneOutlined-C_bRiMjO.js} +1 -1
- package/dist/assets/{ViewList-C8G9e3ft.js → ViewList-B9N1x-5o.js} +1 -1
- package/dist/assets/{access-control-eEjmzQYf.js → access-control-B5entF50.js} +1 -1
- package/dist/assets/{actions-DP7pj6xB.js → actions-t0ZB56yH.js} +1 -1
- package/dist/assets/{add-component-core-pJP41zEE.js → add-component-core-BS3YTsy5.js} +1 -1
- package/dist/assets/{add-resource-CZeL421l.js → add-resource-DrFqIfnP.js} +1 -1
- package/dist/assets/{addon-CRj4Enw7.js → addon-DQC7Plj9.js} +1 -1
- package/dist/assets/{advanced-P0pT0XgG.js → advanced-DO1hLdXY.js} +1 -1
- package/dist/assets/{appearance-DeIbdwlo.js → appearance-Bf8ha2QN.js} +1 -1
- package/dist/assets/{audit-logs-DdN0-QQr.js → audit-logs-BmFsZWcQ.js} +1 -1
- package/dist/assets/{authorize-C_rSdM9R.js → authorize-C1krxa_8.js} +1 -1
- package/dist/assets/{base32-WurN0cIW.js → base32-CCf_iIfG.js} +1 -1
- package/dist/assets/{branding-HedBd6t0.js → branding-BsDB7rHi.js} +6 -6
- package/dist/assets/{branding-C6umqmKR.js → branding-DunUmlvH.js} +2 -2
- package/dist/assets/{bundle-avatar-B9he3Bf1.js → bundle-avatar-BTHmZ3_i.js} +1 -1
- package/dist/assets/{button-_1HExv7r.js → button-mmNFGQSs.js} +1 -1
- package/dist/assets/{click-to-copy-R7MF4AwY.js → click-to-copy-Fl7LHxeC.js} +1 -1
- package/dist/assets/{collapse-l9wHY9gJ.js → collapse-dxBbW7k2.js} +1 -1
- package/dist/assets/complete-CxDgHoQk.js +39 -0
- package/dist/assets/{component-cssFwqtY.js → component-BnKz-jfM.js} +61 -61
- package/dist/assets/{config-eQ2Et0RC.js → config-DuKJ9oR4.js} +1 -1
- package/dist/assets/{config-Cd14MJHa.js → config-WLdkaHr-.js} +1 -1
- package/dist/assets/config-navigation-CvCO7Fuh.js +26 -0
- package/dist/assets/{config-space-CQ7Atb1l.js → config-space-C_xex8-t.js} +1 -1
- package/dist/assets/{confirm-Tue92P8p.js → confirm-t4d18Hpz.js} +1 -1
- package/dist/assets/connect-Cv9tvvms.js +5 -0
- package/dist/assets/{connect-PdQoyrqe.js → connect-GdnRXixM.js} +1 -1
- package/dist/assets/{connect-to-FvVJBIsZ.js → connect-to-r0pjWPe7.js} +1 -1
- package/dist/assets/{dashboard-BhR1WNzF.js → dashboard-CEB4GFys.js} +3 -3
- package/dist/assets/{delete-confirm-CHnQ2leb.js → delete-confirm-DCJdTGPZ.js} +1 -1
- package/dist/assets/{did-address-Dq-4__HB.js → did-address-BJCF3XU3.js} +1 -1
- package/dist/assets/domain-Dkw0nuHL.js +9 -0
- package/dist/assets/{domain-action-card-Jvzi8kyL.js → domain-action-card-DnB964Ah.js} +1 -1
- package/dist/assets/domains-D6W7Zk5a.js +1 -0
- package/dist/assets/dot-DX56IFTM.js +7 -0
- package/dist/assets/{email-z4l1k3Mi.js → email-DY9qiGnc.js} +1 -1
- package/dist/assets/{exchange-passport-DSoEjAA_.js → exchange-passport-BOpw7kFp.js} +1 -1
- package/dist/assets/{fuel-CzrPInoR.js → fuel-CMua6nrK.js} +1 -1
- package/dist/assets/{gen-access-key-BU2nGVgA.js → gen-access-key-FrO6nmvQ.js} +1 -1
- package/dist/assets/{get-safe-url-Q70tRxL7.js → get-safe-url-BRxk530J.js} +1 -1
- package/dist/assets/{get-safe-url-c4iAcpvA.js → get-safe-url-DHdoXqD0.js} +1 -1
- package/dist/assets/{home-BZ8WpcWZ.js → home-C2Db_IXV.js} +1 -1
- package/dist/assets/{iframe-Dl8NEFc5.js → iframe-Bpfqnuq5.js} +1 -1
- package/dist/assets/{index-C3le1atN.js → index-0epbdrMx.js} +1 -1
- package/dist/assets/{index-B_NDUfon.js → index-3aRBjK5P.js} +30 -30
- package/dist/assets/{index-D0F0qx_R.js → index-ALHbqsn2.js} +1 -1
- package/dist/assets/{index-C1XrZATd.js → index-B7PoXGHo.js} +8 -8
- package/dist/assets/{index-klBzz5vO.js → index-B9IGWqlM.js} +1 -1
- package/dist/assets/{index-D2a97Hdb.js → index-BchkF3oT.js} +3 -3
- package/dist/assets/{index-BKKwhjBs.js → index-BkScmF5I.js} +1 -1
- package/dist/assets/{index-NQMMaHuW.js → index-BrhW0YAX.js} +1 -1
- package/dist/assets/{index-m831cH-_.js → index-ChEmNV9t.js} +1 -1
- package/dist/assets/{index-P2m0RlAs.js → index-DESkMgoq.js} +1 -1
- package/dist/assets/{index-ChHy6AQ7.js → index-DH-xhSUy.js} +1 -1
- package/dist/assets/{index-BUHyq-oP.js → index-DHmaMW97.js} +1 -1
- package/dist/assets/index-DIzYQ8YY.js +1 -0
- package/dist/assets/{index-D1kTR2xk.js → index-DTLUTgmo.js} +1 -1
- package/dist/assets/{index-I6_gMaPh.js → index-DjmlNqL1.js} +1 -1
- package/dist/assets/{index-DutfRO7F.js → index-DkNMM_jp.js} +1 -1
- package/dist/assets/{index-5EytSaVA.js → index-Dq0Wocff.js} +1 -1
- package/dist/assets/{index-DrHUHp5S.js → index-HT1eRd1i.js} +1 -1
- package/dist/assets/{index-hkk3GUEf.js → index-bu2nusyV.js} +1 -1
- package/dist/assets/index-xbFMe1Dq.js +99 -0
- package/dist/assets/{invitation-CGjIZ62g.js → invitation-DqS1y9EI.js} +1 -1
- package/dist/assets/{invite-CS_4jRwt.js → invite-Do31CPZ_.js} +1 -1
- package/dist/assets/{issue-passport-B6-OzJX7.js → issue-passport-BawbYt3J.js} +1 -1
- package/dist/assets/{item-CuLwkmbx.js → item-CPlmWuOr.js} +1 -1
- package/dist/assets/{landing-page-DrVLCVAm.js → landing-page-k0HqFOEl.js} +1 -1
- package/dist/assets/{layout-CNC_rrzE.js → layout-CneuYz3Y.js} +1 -1
- package/dist/assets/list-C3bba0fZ.js +2 -0
- package/dist/assets/{list-BTBbj1K4.js → list-DqFW_ONs.js} +1 -1
- package/dist/assets/localization-B18AVgXP.js +1 -0
- package/dist/assets/{log-29oTWiWO.js → log-B7EGR5B1.js} +1 -1
- package/dist/assets/{logger-BAVOmOw2.js → logger-C5_0IJ1n.js} +1 -1
- package/dist/assets/{login-C52vMwpY.js → login-CmoMzUKP.js} +1 -1
- package/dist/assets/{login-oauth-callback-BrnNJIOK.js → login-oauth-callback-6CWB9fPF.js} +1 -1
- package/dist/assets/{logo-uploader-Cir_HrSm.js → logo-uploader-BGnE-EpW.js} +3 -3
- package/dist/assets/{lost-passport-C2-kDXqq.js → lost-passport-BIGYYNZH.js} +1 -1
- package/dist/assets/{open-window-Bl24RBAD.js → open-window-DAuoY35p.js} +1 -1
- package/dist/assets/{overview-BKOb0zVP.js → overview-DO_rMORL.js} +1 -1
- package/dist/assets/{page-header-BWqvvXOk.js → page-header-CzGtYXZB.js} +1 -1
- package/dist/assets/{passport-item-OEfv-Vh7.js → passport-item-B0b6IIEi.js} +1 -1
- package/dist/assets/{permission-DSHe73ba.js → permission-CG_0ilL-.js} +1 -1
- package/dist/assets/{preferences-BzGNV3pM.js → preferences-nmcizF2n.js} +1 -1
- package/dist/assets/{profile-embed-iA-d50c3.js → profile-embed-D9vov7el.js} +1 -1
- package/dist/assets/{publish-resource-DayX-x8-.js → publish-resource-BAxsxiDk.js} +1 -1
- package/dist/assets/{react-beautiful-dnd.esm-Ck4xzwyU.js → react-beautiful-dnd.esm-vqdGm7Q2.js} +1 -1
- package/dist/assets/{runtime-BbgMhX7n.js → runtime-4wAQAE28.js} +1 -1
- package/dist/assets/sanitize-CC0-oYfL.js +2 -0
- package/dist/assets/sdk-DnmwcxEc.js +1 -0
- package/dist/assets/{security-DFHcsUZl.js → security-BO4vz2A4.js} +1 -1
- package/dist/assets/{session-C_8V_o-O.js → session-yHau46Qm.js} +1 -1
- package/dist/assets/setup-C9eWBBt5.js +30 -0
- package/dist/assets/{spaces-DApg1wzn.js → spaces-WDzH-r9r.js} +1 -1
- package/dist/assets/{start-B8F850CZ.js → start-CvbMSa4N.js} +1 -1
- package/dist/assets/{starting-progress-BHUTOY2b.js → starting-progress-BWNdTquJ.js} +1 -1
- package/dist/assets/{status-D5JgbTyM.js → status-B87zOhDx.js} +1 -1
- package/dist/assets/{step-actions-1pM57149.js → step-actions-qe5T0fbR.js} +1 -1
- package/dist/assets/{studio-1mTu0Fgs.js → studio-COaDgEOK.js} +1 -1
- package/dist/assets/{switch-control-CpCSorUo.js → switch-control-DvnJyz2a.js} +1 -1
- package/dist/assets/{table-tips-BfSSGl9N.js → table-tips-3qAdlLSz.js} +1 -1
- package/dist/assets/{traffic-Dvs1P0Re.js → traffic-CSdm4uyu.js} +1 -1
- package/dist/assets/{transfer-bax-fMxe.js → transfer-DsmSmlf-.js} +1 -1
- package/dist/assets/{unsubscribe-DwUfpwja.js → unsubscribe-BBPlZQOy.js} +1 -1
- package/dist/assets/{use-blocklet-logo-BZU9LLmz.js → use-blocklet-logo-vRumIAeK.js} +1 -1
- package/dist/assets/useAsync-Dv214fz8.js +1 -0
- package/dist/assets/useAsync-KYUBhVsb.js +1 -0
- package/dist/assets/{useLocalStorage-D6gvgmEW.js → useLocalStorage-DiA2Rpy-.js} +1 -1
- package/dist/assets/{user-center-DQ_Kc4sL.js → user-center-p3JKDvby.js} +3 -3
- package/dist/assets/{util-DMfPwzVN.js → util-CKnnktVh.js} +1 -1
- package/dist/assets/{util-BiCOL9ao.js → util-SIt5hlfb.js} +1 -1
- package/dist/assets/{vendor-arcblock-BlrkGjK9.js → vendor-arcblock-BPZ1V4pg.js} +1 -1
- package/dist/assets/{vendor-ux-did-connect-2jRoUb28.js → vendor-ux-did-connect-CJ8Q_v7u.js} +2 -2
- package/dist/assets/{wrap-locale-0GIFYj8p.js → wrap-locale-Dz5tBqNC.js} +1 -1
- package/dist/index.html +3 -3
- package/dist/service-worker.js +1 -1
- package/package.json +30 -30
- package/dist/assets/complete-D7dveRTo.js +0 -39
- package/dist/assets/config-navigation-0pU9J0da.js +0 -26
- package/dist/assets/connect-Cm-sTMiW.js +0 -5
- package/dist/assets/domain-FY9-unAU.js +0 -9
- package/dist/assets/domains-CiBZW8yk.js +0 -1
- package/dist/assets/dot-itVN8XTt.js +0 -7
- package/dist/assets/index-DC3jOsuk.js +0 -99
- package/dist/assets/index-DQD2rqsI.js +0 -1
- package/dist/assets/list-BNMEncjS.js +0 -2
- package/dist/assets/localization-Bb0kc8SQ.js +0 -1
- package/dist/assets/sdk-DeS3iq37.js +0 -1
- package/dist/assets/setup-Do62jucF.js +0 -30
- package/dist/assets/useAsync-510ntT1B.js +0 -1
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{j as r,ab as f,T as h,H as y,ah as x}from"./vendor-mui-core-BV2FUxWJ.js";import"./vendor-react-DEoibe3W.js";import{A as g}from"./vendor-utils-rHXShPKm.js";import{_ as w}from"./useAsync-510ntT1B.js";import{a as C,aS as T,C as i,b3 as j,a0 as k,aq as S}from"./vendor-ux-did-connect-2jRoUb28.js";import{u as v,s as P}from"./index-B_NDUfon.js";import"./vendor-hooks-BgUTpb6X.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-BlrkGjK9.js";function U({children:p}){const{t:n,locale:u}=C(),{api:c,session:o}=v(),{encryptKey:l,decrypt:m}=T(),s=w(async()=>{var t;const e=new URL(window.location.href);e.pathname=g(((t=window==null?void 0:window.env)==null?void 0:t.apiPrefix)??"/","/api/did/setup/token"),e.searchParams.set("_ek_",l);const{data:a}=await c.get(e.href);return a}),d=async e=>{const a=Array.isArray(e)?e.find(t=>t.sessionToken):e;P(m(a.sessionToken));try{await o.refresh()}catch(t){k.error(t.message)}};return!s.value||s.loading||o.loading?r.jsx(i,{relative:"parent",children:r.jsx(f,{})}):o.user?p:s.error?r.jsx(i,{relative:"parent",children:r.jsx(h,{children:s.error.message})}):r.jsx(b,{popup:!0,open:!0,hideCloseButton:!0,action:"pre-setup",checkFn:c.get,checkTimeout:10*60*1e3,webWalletUrl:j(),onSuccess:d,locale:u,messages:{title:n("setup.connect.title"),scan:n("setup.connect.scan"),confirm:n("setup.connect.confirm"),success:n("setup.connect.success")},extraParams:{setup:!0,nw:s.value.url}})}U.propTypes={children:y.any.isRequired};const b=x(S)`
|
|
2
|
-
.action-info-desc {
|
|
3
|
-
padding: 0 72px;
|
|
4
|
-
}
|
|
5
|
-
`;export{U as default};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{j as o,aa as e,H as h,ah as v}from"./vendor-mui-core-BV2FUxWJ.js";import{k as C,f as k,am as b,d as B}from"./index-B_NDUfon.js";import{D as w,a as I,b as E}from"./domain-action-card-Jvzi8kyL.js";import{b4 as T}from"./vendor-ux-did-connect-2jRoUb28.js";import{P as A}from"./page-header-BWqvvXOk.js";import{r}from"./vendor-react-DEoibe3W.js";import{_ as L}from"./useSetState-CWq0AVWn.js";import{S as x}from"./button-_1HExv7r.js";import{S as W}from"./layout-CNC_rrzE.js";import{S as H}from"./step-actions-1pM57149.js";import"./vendor-utils-rHXShPKm.js";import"./vendor-arcblock-BlrkGjK9.js";import"./vendor-hooks-BgUTpb6X.js";import"./lottie-web-jYmAQWuC.js";import"./ExpandLess-t1cH-Bc4.js";import"./permission-DSHe73ba.js";import"./session-C_8V_o-O.js";import"./dot-itVN8XTt.js";import"./useAsync-510ntT1B.js";import"./confirm-Tue92P8p.js";import"./index-8eXqqyHQ.js";import"./actions-DP7pj6xB.js";import"./MoreHoriz-DpKn_fkc.js";import"./delete-confirm-CHnQ2leb.js";import"./click-to-copy-R7MF4AwY.js";import"./util-BiCOL9ao.js";import"./InfoOutlined-D3XnF0Vg.js";import"./index-BUHyq-oP.js";import"./CheckCircle-Caqp5gKY.js";import"./content-layout-fV4nyVb5.js";import"./use-mobile-C21X4TYN.js";function d({onNext:s,onPrevious:D}){var u,f;const{t:n}=r.useContext(T),[S,p]=r.useState(!1),{blocklet:i}=C(),[l,j]=r.useState(""),y=(((i==null?void 0:i.site)||{}).domainAliases||[]).map(t=>k.replaceSlotToIp(t.value,l)),[a,m]=L({domain:"",invalidDNSDomain:null,type:"",addDomainState:{text:""}}),c=(f=(u=i.environments)==null?void 0:u.find(t=>t.key==="BLOCKLET_APP_PK"))==null?void 0:f.value,P=y.find(t=>b.isDidDomain(t));return r.useEffect(()=>{B.get(`/dns-resolve?hostname=${window.location.hostname}`).then(({data:t})=>{j(t.address||"")}).catch(t=>{console.error(t.message)})},[]),o.jsxs(_,{children:[o.jsx(e,{className:"header",children:o.jsx(A,{title:n("setup.domain.title"),subTitle:n("setup.domain.subTitle"),onClickBack:D})}),o.jsxs(e,{className:"form",sx:{display:"flex",flexDirection:"column",gap:3,overflowY:"auto"},children:[o.jsxs(e,{children:[o.jsx(e,{color:"text.primary",fontWeight:"fontWeightBold",fontSize:"1.125rem",children:o.jsx(e,{display:"inline",children:`${n("setup.domain.buyOrConnect")} (${n("common.optional")})`})}),o.jsx(e,{mt:1,children:o.jsx(I,{blocklet:i,bugDidDomainProps:{appPk:c,appId:i.appPid,siteId:i.site.id,teamDid:i.meta.did,inBlockletSetup:!0},connectDomainProps:{autoFocus:!1,appPk:c,appId:i.appPid,siteId:i.site.id,teamDid:i.meta.did,cnameDomain:P,currentIp:l,inBlockletSetup:!0,shouldCheckDomain:!0,onInputDomain:t=>{m({domain:t.domain,type:t.type}),p(t.error)},onStateChange:t=>m({addDomainState:t}),onSuccess:t=>{const g={domain:t.domain,type:t.type,nftDid:t.nftDid,chainHost:t.chainHost};m(g),s()},onError:p}})})]}),o.jsx(e,{children:o.jsx(E,{inSetup:!0,showAllDomains:!0,systemTips:o.jsx(e,{color:"text.primary",fontWeight:"fontWeightBold",fontSize:"1.125rem",mb:1,children:o.jsx(e,{display:"inline",children:n("setup.domain.skipDescription")})})})})]}),o.jsx(H,{mt:8,disabled:!!a.addDomainState.text,blocklet:i,onStartNow:()=>s("complete"),children:a.domain?o.jsx(x,{variant:"contained",loading:!!a.addDomainState.text,disabled:S||!!a.addDomainState.text||!a.domain,onClick:()=>s(),children:a.addDomainState.text||n("setup.continue")}):o.jsx(x,{variant:"contained",disabled:!!a.addDomainState.text,onClick:()=>s(),children:n("setup.continue")})})]})}function xt(s){return o.jsx(w,{children:o.jsx(d,{...s})})}d.propTypes={onNext:h.func,onPrevious:h.func};d.defaultProps={onNext:()=>{},onPrevious:()=>{}};const _=v(W)`
|
|
2
|
-
height: 100%;
|
|
3
|
-
overflow-y: hidden;
|
|
4
|
-
|
|
5
|
-
.form {
|
|
6
|
-
width: 100%;
|
|
7
|
-
height: 100%;
|
|
8
|
-
}
|
|
9
|
-
`;export{xt as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as m}from"./vendor-react-DEoibe3W.js";import{a as n}from"./vendor-ux-did-connect-2jRoUb28.js";import{G as p,D as l,M as c,f as u}from"./index-B_NDUfon.js";import{a as x,b as d}from"./domain-action-card-Jvzi8kyL.js";import{j as t,aa as k,al as f,ak as D}from"./vendor-mui-core-BV2FUxWJ.js";import"./vendor-utils-rHXShPKm.js";import"./vendor-hooks-BgUTpb6X.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-BlrkGjK9.js";import"./ExpandLess-t1cH-Bc4.js";import"./permission-DSHe73ba.js";import"./session-C_8V_o-O.js";import"./dot-itVN8XTt.js";import"./useAsync-510ntT1B.js";import"./confirm-Tue92P8p.js";import"./index-8eXqqyHQ.js";import"./actions-DP7pj6xB.js";import"./MoreHoriz-DpKn_fkc.js";import"./delete-confirm-CHnQ2leb.js";import"./click-to-copy-R7MF4AwY.js";import"./util-BiCOL9ao.js";import"./useSetState-CWq0AVWn.js";import"./InfoOutlined-D3XnF0Vg.js";import"./index-BUHyq-oP.js";import"./CheckCircle-Caqp5gKY.js";function h(){const{blocklet:o,actions:{updateBlockletDomainAliases:i}}=p(),{inService:r}=l(),{t:e}=n(),a=m.useMemo(()=>{let s=!0;return c(o)&&(s=s&&r),s},[r,o]);return t.jsxs(k,{component:f,sx:{maxWidth:820},gap:3,children:[t.jsxs(t.Fragment,{children:[u.isAccessible(o.status)===!1&&t.jsx(D,{severity:"warning",children:e("blocklet.router.noRunning")}),a&&t.jsx(x,{blocklet:o,updateBlockletDomainAliases:i,connectDomainProps:{shouldCheckDomain:!0}})]}),t.jsx(d,{showAllDomains:!0,updateBlockletDomainAliases:i})]})}h.propTypes={};export{h as default};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{z as m}from"./vendor-hooks-BgUTpb6X.js";import{r as v}from"./vendor-react-DEoibe3W.js";import{u as y}from"./useAsync-510ntT1B.js";import{ah as p}from"./vendor-mui-core-BV2FUxWJ.js";var c={};Object.defineProperty(c,"__esModule",{value:!0});var t=m,i=v,b=t.__importDefault(y),A=function(r,e){e===void 0&&(e=[]);var a=i.useState(0),l=a[0],_=a[1],s=b.default(r,t.__spreadArrays(e,[l])),o=s.loading,d=i.useCallback(function(){o||_(function(f){return f+1})},t.__spreadArrays(e,[o]));return t.__assign(t.__assign({},s),{retry:d})},D=c.default=A;const n={success:"#3ab39d",error:"#D0021B"},u="10px",k=p.div`
|
|
2
|
-
display: inline-block;
|
|
3
|
-
min-width: ${r=>r.size||u};
|
|
4
|
-
min-height: ${r=>r.size||u};
|
|
5
|
-
background-color: ${r=>n[r.color]||r.color||n.success};
|
|
6
|
-
border-radius: 100%;
|
|
7
|
-
`;export{k as D,D as _};
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import{r as b}from"./vendor-react-DEoibe3W.js";import{a as D,Y as R,j as ie,B as z,b4 as be,ao as pe,bT as re,a0 as je,aC as Ce,bA as ke,c9 as Ke,b6 as Te,a9 as ve,a2 as Ae}from"./vendor-ux-did-connect-2jRoUb28.js";import{d as we}from"./Edit-CUl1Rt8i.js";import{f as Se}from"./index-8eXqqyHQ.js";import{r as me}from"./passport-item-OEfv-Vh7.js";import{D as B,n as M,aM as De,G as Ie,f as Re}from"./index-B_NDUfon.js";import{u as $}from"./dashboard-BhR1WNzF.js";import{j as e,H as x,bo as O,br as G,bn as H,q as V,aa as f,al as Q,O as E,ab as Be,bs as $e,bR as _e,ah as P,T as N,ad as ce,ak as Ne}from"./vendor-mui-core-BV2FUxWJ.js";import{B as Pe,W as We}from"./vendor-arcblock-BlrkGjK9.js";import{T as ue}from"./index-NQMMaHuW.js";import{C as xe}from"./confirm-Tue92P8p.js";import{a0 as Ue}from"./vendor-utils-rHXShPKm.js";import{C as F}from"./click-to-copy-R7MF4AwY.js";import{D as qe}from"./delete-confirm-CHnQ2leb.js";import{P as Le}from"./permission-DSHe73ba.js";import{l as ze,y as Me}from"./vendor-hooks-BgUTpb6X.js";import{U as Ee,C as Fe,I as Oe}from"./index-D1kTR2xk.js";import{B as Ge}from"./bundle-avatar-B9he3Bf1.js";import{p as He}from"./util-DMfPwzVN.js";import{W as le}from"./did-address-Dq-4__HB.js";import{A as Ve}from"./actions-DP7pj6xB.js";import{u as Qe}from"./use-mobile-BAa0wi8o.js";import{T as de}from"./table-tips-BfSSGl9N.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-D6gvgmEW.js";import"./PlayArrow-CDOOUxMp.js";import"./get-safe-url-c4iAcpvA.js";import"./session-C_8V_o-O.js";import"./use-blocklet-logo-BZU9LLmz.js";import"./InfoOutlined-D3XnF0Vg.js";import"./dot-itVN8XTt.js";import"./useAsync-510ntT1B.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-C21X4TYN.js";import"./vendor-mui-x-Bo-XOtzq.js";import"./AdapterDayjs-CDDcwz3P.js";import"./Phone-BkOMNOMO.js";import"./Location-DxPzfR_p.js";import"./Email-BirbvqZ3.js";import"./Timezone-D91Of94T.js";import"./base32-WurN0cIW.js";import"./MoreHoriz-DpKn_fkc.js";function Y({value:t}){const{t:s,locale:m}=D(),l=new Date;return new Date(t)<l?e.jsxs("span",{style:{color:"red"},children:[e.jsx(R,{value:t,locale:m}),`${s("setting.accessKey.expired",{time:""})}`]}):e.jsx(R,{value:t,locale:m,type:"all"})}Y.propTypes={value:x.string.isRequired};function J({value:t,onChange:s,...m}){const{t:l}=D(),d=b.useMemo(()=>[{value:"signature",title:l("setting.accessKey.signature"),description:l("setting.accessKey.signatureDesc")},{value:"simple",title:l("setting.accessKey.simple"),description:l("setting.accessKey.simpleDesc")}],[l]);return e.jsxs(O,{style:{width:"100%"},variant:"outlined",...m,children:[e.jsx(G,{children:l("setting.accessKey.authType")}),e.jsx(H,{value:t,onChange:s,fullWidth:!0,label:l("setting.accessKey.authType"),children:d.map(o=>e.jsx(V,{value:o.value,children:e.jsxs(f,{children:[e.jsx("span",{children:o.title}),e.jsx(f,{maxWidth:510,fontSize:12,color:"#999",whiteSpace:"normal",children:o.description})]})},o.value))})]})}J.propTypes={value:x.string.isRequired,onChange:x.func.isRequired};const U=()=>{const t=ie.RBAC_CONFIG.roles.filter(d=>d.passport),{inService:s}=B(),{roles:m}=$(),l=[...t,...s?m:[]];return Ue(l,"name").filter(d=>d.name!==ie.ROLES.OWNER)};function X(t){const{remark:s,onCreate:m}=t,{api:l}=B(),{teamDid:d}=$(),{t:o}=D(),[k,j]=b.useState(!1),[c,h]=b.useState(null),y=U(),v=()=>{j(!1),h(null)},K=async a=>{const{remark:T,passport:r,authType:n}=a;j(!0);const u=await l.createAccessKey({input:{teamDid:d,remark:T.trim(),passport:r,expireAt:a.expireAt?new Date(a.expireAt).getTime():null,authType:n}}),{data:S}=u;m(S),h(null),j(!1)},g={title:`${o("common.create")} ${o("accessKey")}`,description:(a,T,r)=>e.jsxs(Q,{gap:3,children:[e.jsx(E,{label:o("setting.accessKey.tip"),autoComplete:"off",variant:"outlined",name:"remark",inputProps:{"data-cy":"remark-input"},fullWidth:!0,autoFocus:!0,margin:"dense",value:a.remark,onChange:n=>{T({...a,remark:n.target.value,__disableConfirm:!a.passport||!n.target.value.trim()}),n.target.value.trim()?r(""):r(o("setting.accessKey.remarkInvalid"))}}),e.jsxs(O,{style:{width:"100%"},variant:"outlined",children:[e.jsx(G,{children:o("setting.accessKey.passport")}),e.jsx(H,{"data-cy":"create-access-key-select-passport",value:a.passport,onChange:n=>{const u=n.target.value;r(null),T({...a,passport:u,__disableConfirm:!a.remark||!u})},fullWidth:!0,label:o("setting.accessKey.passport"),disabled:k,children:y.map(n=>e.jsx(V,{value:n.name,"data-cy":`create-access-key-passport-option-${n.name}`,children:e.jsxs(f,{children:[e.jsx("span",{children:n.title||n.name}),e.jsx(f,{maxWidth:440,fontSize:12,color:"#999",whiteSpace:"normal",textAlign:"justify",children:n.description})]})},n.name))})]}),e.jsx(J,{value:a.authType,onChange:n=>{T({...a,authType:n.target.value})}}),e.jsx(ue,{placeholder:o("setting.accessKey.expireTime"),value:a.expireAt,onChange:n=>{T({...a,expireAt:n,__disableConfirm:!a.passport||!a.remark||!n})}})]}),confirm:o("common.confirm"),cancel:o("common.cancel"),color:"primary",params:{remark:s,authType:"signature",__disableConfirm:!s.trim()},onConfirm:K,onCancel:v};return e.jsxs(e.Fragment,{children:[e.jsxs(z,{sx:{color:"common.white"},edge:"end",variant:"contained",color:"primary","data-cy":"add-access-key-btn",onClick:()=>h(g),className:"rule-action",children:[k?e.jsx(Be,{size:16}):e.jsx(Pe,{style:{fontSize:16}}),o("common.create")]}),c&&e.jsx(xe,{title:c.title,description:c.description,confirm:c.confirm,color:c.color,cancel:c.cancel,params:c.params,onConfirm:c.onConfirm,onCancel:c.onCancel})]})}X.propTypes={remark:x.string,onCreate:x.func};X.defaultProps={onCreate:()=>{},remark:""};function Z(t){const{onConfirm:s,accessKeyId:m,accessKeySecret:l,hideSecret:d}=t,{t:o}=b.useContext(be),[k,j]=b.useState(!1),[c,h]=b.useState(()=>d),y=()=>{h(!c)},v=a=>{j(a.target.checked)},K=b.useMemo(()=>{var a;return d?`const Client = require('@abtnode/client');
|
|
2
|
-
|
|
3
|
-
const client = new Client(fullEndpoint);
|
|
4
|
-
client.setAuthAccessKey({
|
|
5
|
-
accessKeyId: "${m}",
|
|
6
|
-
accessKeySecret: "${l}",
|
|
7
|
-
});
|
|
8
|
-
`:`curl -H "Authorization: Bearer ${l}" "${(a=window.blocklet)==null?void 0:a.appUrl}/.well-known/service/api/did/session"`},[d,m,l]),g=b.useMemo(()=>{var a;return d?`blocklet deploy --endpoint ${(a=window.blocklet)==null?void 0:a.appUrl} --access-key ${m} --access-secret ${l} {blockletPath}/.blocklet/bundle;`:null},[d,m,l]);return e.jsxs(pe,{title:o("common.createSuccess"),fullWidth:!0,open:!0,disableEscapeKeyDown:!0,onClose:s,showCloseButton:!1,actions:e.jsx("div",{children:e.jsx(z,{disabled:d?!k:!1,onClick:s,color:"primary",autoFocus:!0,variant:"contained","data-cy":"submit-confirm-dialog",children:o("common.confirm")})}),"aria-labelledby":"simple-dialog-title",children:[e.jsx("div",{children:e.jsx(Ye,{children:o(d?"setting.accessKey.saveSecretTip":"setting.accessKey.viewSecret")})}),e.jsx("div",{style:{marginTop:"20px"}}),e.jsxs(L,{children:[e.jsx(q,{children:o("setting.accessKey.accessKeyId")}),e.jsx(F,{children:m})]}),e.jsxs(L,{children:[e.jsx(q,{children:o("setting.accessKey.accessKeySecret")}),c?e.jsx(z,{"data-cy":"show-secret-btn",color:"primary",onClick:y,children:o("setting.accessKey.showSecret")}):e.jsx(F,{children:l})]}),!c&&e.jsxs(L,{children:[e.jsx(q,{children:`Access Key ${o("setting.accessKey.usage")}`}),e.jsx(re,{code:K,language:"javascript"}),g&&e.jsx(re,{code:g,language:"bash"})]}),d&&e.jsx("div",{children:e.jsx($e,{value:"end",disabled:c,control:e.jsx(_e,{checked:k,onChange:v}),label:o("setting.accessKey.iKnow"),labelPlacement:"end"})})]})}Z.propTypes={accessKeyId:x.string.isRequired,accessKeySecret:x.string.isRequired,onConfirm:x.func,hideSecret:x.bool};Z.defaultProps={onConfirm:()=>{},hideSecret:!0};const q=P.div`
|
|
9
|
-
display: flex;
|
|
10
|
-
justify-content: space-between;
|
|
11
|
-
align-items: center;
|
|
12
|
-
font-size: 16px;
|
|
13
|
-
margin-bottom: 8px;
|
|
14
|
-
`,L=P.div`
|
|
15
|
-
margin-bottom: 24px;
|
|
16
|
-
`,Ye=P.div`
|
|
17
|
-
font-size: 16px;
|
|
18
|
-
font-weight: bold;
|
|
19
|
-
`;function ee(t){const{t:s,locale:m}=D(),{api:l}=B(),{teamDid:d}=$(),{accessKeyId:o,time:k,remark:j,onDelete:c=()=>{},onClose:h=()=>{}}=t,y=()=>{h()},v=async()=>{try{await l.deleteAccessKey({input:{teamDid:d,accessKeyId:o}}),c()}catch(a){je.error(a==null?void 0:a.message)}finally{y()}},K=a=>({key:`<b>${o}</b>`,name:`<b>${j}</b>`,time:M(a,m),timeAge:We(new Date(a),De(m))}),g={keyName:j,title:s("setting.accessKey.title"),description:k?`${s("setting.accessKey.description",K(k))}`:`${s("setting.accessKey.descriptionNoTime",{key:`<b>${o}</b>`,name:`<b>${j}</b>`})}`,confirmPlaceholder:s("setting.accessKey.confirm_desc",{name:j}),confirm:s("common.delConfirm"),cancel:s("common.cancel"),onConfirm:v,onCancel:y};return e.jsx(qe,{keyName:g.keyName,title:g.title,description:g.description,confirmPlaceholder:g.confirmPlaceholder,confirm:g.confirm,cancel:g.cancel,params:g.params,onConfirm:g.onConfirm,onCancel:g.onCancel})}ee.propTypes={accessKeyId:x.string.isRequired,time:x.string.isRequired,remark:x.string.isRequired,onDelete:x.func,onClose:x.func};ee.defaultProps={onDelete:()=>{},onClose:()=>{}};function te(t){const{accessKeyId:s,remark:m,onUpdate:l,passport:d,expireAt:o,authType:k,onClose:j}=t,{api:c}=B(),{teamDid:h}=$(),{t:y}=D(),[v,K]=b.useState(!1),g=U(),a=()=>{K(!1),j()},T=async n=>{const{accessKeyId:u,remark:S="",passport:p,expireAt:I,authType:W}=n;K(!0),await c.updateAccessKey({input:{teamDid:h,accessKeyId:u,remark:S.trim(),passport:p,expireAt:I?new Date(I).getTime():null,authType:W}}),l(),a()},r={title:`${y("common.update")} ${y("accessKey")}`,description:(n,u,S)=>e.jsxs(Q,{gap:3,children:[e.jsx(E,{label:y("setting.accessKey.accessKeyId"),autoComplete:"off",variant:"outlined",name:"accessKeyId",fullWidth:!0,autoFocus:!0,margin:"dense",value:n.accessKeyId,disabled:!0}),e.jsx(E,{label:y("common.remark"),autoComplete:"off",variant:"outlined",name:"remark",fullWidth:!0,autoFocus:!0,value:n.remark,onChange:p=>{u({...n,remark:p.target.value,__disableConfirm:!p.target.value.trim()}),p.target.value.trim()?S(""):S(y("setting.accessKey.remarkInvalid"))}}),e.jsxs(O,{style:{width:"100%"},variant:"outlined",children:[e.jsx(G,{children:y("setting.accessKey.passport")}),e.jsx(H,{"data-cy":"update-access-key-select-passport",value:n.passport,onChange:p=>{const I=p.target.value;S(null),u({...n,passport:I,__disableConfirm:!n.remark||!I})},fullWidth:!0,label:y("setting.accessKey.passport"),disabled:v,children:g.map(p=>e.jsx(V,{value:p.name,"data-cy":`update-access-key-passport-option-${p.name}`,children:e.jsxs(f,{children:[e.jsx("span",{children:p.title||p.name}),e.jsx(f,{maxWidth:440,fontSize:12,color:"#999",whiteSpace:"normal",textAlign:"justify",children:p.description})]})},p.name))})]}),e.jsx(J,{disabled:!0,value:n.authType,onChange:p=>{u({...n,authType:p.target.value})}}),e.jsx(ue,{placeholder:y("setting.accessKey.expireTime"),value:n.expireAt,onChange:p=>{u({...n,expireAt:p,__disableConfirm:!n.passport||!n.remark||!p})}})]}),confirm:y("common.confirm"),cancel:y("common.cancel"),color:"primary",params:{accessKeyId:s,remark:m,passport:d,expireAt:o,authType:k},onConfirm:T,onCancel:a};return e.jsx(xe,{title:r.title,description:r.description,confirm:r.confirm,color:r.color,cancel:r.cancel,params:r.params,onConfirm:r.onConfirm,onCancel:r.onCancel})}te.propTypes={accessKeyId:x.string.isRequired,remark:x.string,passport:x.string,expireAt:x.string,authType:x.string,onUpdate:x.func,onClose:x.func};te.defaultProps={onUpdate:()=>{},remark:"",passport:"",expireAt:"",authType:"signature",onClose:()=>{}};function se({accessKey:t,onCancel:s}){const{t:m}=D();return e.jsx(pe,{title:m("accessKey"),onClose:s,open:!0,PaperProps:{style:{maxWidth:800}},fullWidth:!0,children:e.jsx(Je,{children:e.jsx(ye,{accessKey:t})})})}se.propTypes={accessKey:x.object.isRequired,onCancel:x.func.isRequired};se.defaultProps={};const Je=P(f)`
|
|
20
|
-
margin-top: -16px;
|
|
21
|
-
|
|
22
|
-
.tabs {
|
|
23
|
-
margin-left: 0;
|
|
24
|
-
margin-right: 0;
|
|
25
|
-
}
|
|
26
|
-
`;function ye({accessKey:t}){var a,T;const{t:s,locale:m}=D(),{api:l}=B(),{teamDid:d}=$(),{blocklet:o}=Ie(),k=U(),j=b.useCallback(async r=>r?(await l.getUser({input:{teamDid:d,user:{did:r}}})).user:null,[l,d]),c=ze(()=>j(t.createdBy),{}),h=((o==null?void 0:o.children)||[]).find(r=>{var n;return((n=r==null?void 0:r.meta)==null?void 0:n.did)===t.componentDid}),y=b.useMemo(()=>{var r;return He((r=c==null?void 0:c.data)==null?void 0:r.avatar,d,!0)},[(a=c==null?void 0:c.data)==null?void 0:a.avatar,d]),v=k.find(r=>r.name===t.passport),K=v?v.title:t.passport,g=[{title:s("common.baseInfo"),items:[{label:s("setting.accessKey.accessKeyId"),content:e.jsx(le,{did:t.accessKeyId,showQrcode:!0})},...t.authType==="simple"?[{label:s("setting.accessKey.accessKeySecret"),content:e.jsx(F,{children:`blocklet-${Ce.toBase58(t.accessKeyPublic)}`})}]:[],{label:s("common.role"),content:e.jsx(f,{children:me(K,t.passport)})},{label:s("common.createdVia"),content:t.createdVia},{label:s("common.createdBy"),content:c!=null&&c.data?e.jsx(f,{sx:{display:"flex",alignItems:"center",".MuiAvatar-root":{width:32,height:32}},children:e.jsx(Ee,{user:{...c.data,avatar:y},showDid:!0,cardType:Fe.Detailed,infoType:Oe.Minimal,sx:{border:0,padding:0}})}):t.createdBy?e.jsx(le,{did:t.createdBy,showQrcode:!0}):"-"}]},{title:s("common.timeInfo"),items:[{label:s("common.createdAt"),content:t.createdAt?e.jsx(R,{value:t.createdAt,type:"all",locale:m}):"-"},{label:s("common.lastUsedAt"),content:t.lastUsedAt?e.jsx(R,{value:t.lastUsedAt,type:"all",locale:m}):"-"},{label:s("common.expiredAt"),content:t.expireAt?e.jsx(Y,{value:t.expireAt}):s("common.neverExpired")}]},{title:s("common.otherInfo"),items:[{label:s("setting.accessKey.authType"),content:t.authType},{label:s("common.remark"),content:t.remark},...t.authType!=="signature"?[{label:s("setting.accessKey.resourceType"),content:t.resourceType||"-"},{label:s("setting.accessKey.resourceId"),content:t.resourceId||"-"}]:[],...h?[{label:s("setting.accessKey.component"),content:e.jsxs(f,{width:{xs:250,sm:400},display:"flex",alignItems:"center",children:[e.jsx(Ge,{blocklet:h,ancestors:[o]}),e.jsx(f,{ml:"16px",sx:{minWidth:0},children:e.jsxs(f,{className:"component-header",children:[e.jsx(f,{className:"component-name",children:Re.getDisplayName(h,!0)}),e.jsx(f,{className:"component-version",children:(T=h==null?void 0:h.meta)==null?void 0:T.version})]})})]},h)}]:[]]}];return e.jsx(Xe,{gap:3,children:e.jsx(f,{className:"info-area",children:g.map(r=>e.jsxs(f,{mb:3,children:[e.jsx(N,{variant:"h6",sx:{mb:1.5},children:r.title}),e.jsx(f,{className:"info-grid",children:r.items.map(n=>e.jsxs(f,{className:"info-item",children:[e.jsx(f,{className:"info-label",children:e.jsx(N,{variant:"subtitle2",color:"textSecondary",children:n.label})}),e.jsx(f,{children:n.content})]},n.label))})]},r.title))})})}ye.propTypes={accessKey:x.object.isRequired};const Xe=P(Q)`
|
|
27
|
-
.info-card {
|
|
28
|
-
margin-bottom: 24px;
|
|
29
|
-
overflow: hidden;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.card-content {
|
|
33
|
-
display: flex;
|
|
34
|
-
gap: 32px;
|
|
35
|
-
padding: 24px;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.passport-image {
|
|
39
|
-
width: 150px;
|
|
40
|
-
flex-shrink: 0;
|
|
41
|
-
transition: transform 0.2s ease-in-out;
|
|
42
|
-
cursor: pointer;
|
|
43
|
-
|
|
44
|
-
&:hover {
|
|
45
|
-
transform: scale(1.05);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.info-area {
|
|
50
|
-
flex: 1;
|
|
51
|
-
display: flex;
|
|
52
|
-
flex-direction: column;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.info-header {
|
|
56
|
-
padding-bottom: 16px;
|
|
57
|
-
border-bottom: 1px solid #eee;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.info-grid {
|
|
61
|
-
display: flex;
|
|
62
|
-
flex-direction: column;
|
|
63
|
-
gap: 12px;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.info-item {
|
|
67
|
-
display: flex;
|
|
68
|
-
gap: 8px;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.info-label {
|
|
72
|
-
display: flex;
|
|
73
|
-
align-items: center;
|
|
74
|
-
gap: 8px;
|
|
75
|
-
width: 140px;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.logs-card {
|
|
79
|
-
.card-header {
|
|
80
|
-
display: flex;
|
|
81
|
-
align-items: center;
|
|
82
|
-
gap: 8px;
|
|
83
|
-
padding: 16px 24px;
|
|
84
|
-
border-bottom: 1px solid #eee;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
.MuiTimeline-root {
|
|
88
|
-
padding: 24px;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.MuiTimelineContent-root {
|
|
92
|
-
padding: 0px 16px;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
.MuiTimelineDot-root {
|
|
96
|
-
margin: 0;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
`;function zt(){var oe,ae;const{t,locale:s}=D(),{api:m,inService:l}=B(),{teamDid:d}=$(),[o,k]=b.useState({}),[j,c]=b.useState(null),[h,y]=b.useState(null),[v,K]=b.useState(null),g=Qe(),a=U(),T=b.useRef(null),r=`access-keys-${d}`,n=ke(r),[u,S]=b.useState({searchText:n.searchText||"",pageSize:n.rowsPerPage||10,page:1}),p=Me(async()=>await m.getAccessKeys({input:{teamDid:d,paging:{page:u.page,pageSize:u.pageSize}}}),[u.page,u.pageSize]),{loading:I,error:W}=p,_=b.useMemo(()=>{var i;return((i=p.value)==null?void 0:i.list)||[]},[(oe=p.value)==null?void 0:oe.list]),fe=b.useMemo(()=>[{label:t("common.name"),name:"remark",options:{customBodyRender:(i,{rowIndex:A})=>{const w=_[A];return e.jsx(f,{display:"flex",alignItems:"center",gap:2,children:e.jsx(N,{children:w.remark||"N/A"})})}}},{label:"Access Key ID",name:"accessKeyId",options:{customBodyRender:i=>e.jsx(Ke,{showDidLogo:!1,children:i})}},{label:t("common.role"),name:"passport",options:{customBodyRender:i=>{const A=a.find(C=>C.name===i),w=A?A.title:i;return e.jsx(f,{children:me(w,i)})}}},{label:t("common.createdVia"),name:"createdVia",options:{customBodyRender:i=>e.jsx(N,{children:i})}},{label:t("setting.accessKey.authType"),name:"authType",options:{customBodyRender:i=>e.jsx(N,{children:t(`setting.accessKey.${i}`)})}},{label:t("common.createdAt"),name:"createdAt",options:{customBodyRender:i=>e.jsx(ce,{title:M(i,s),children:i?e.jsx(R,{value:i,locale:s}):"-"})}},{label:t("common.lastUsedAt"),name:"lastUsedAt",options:{customBodyRender:i=>e.jsx(ce,{title:M(i,s),children:i?e.jsx(R,{value:i,locale:s}):"-"})}},{label:t("common.expiredAt"),name:"expireAt",options:{customBodyRender:i=>i?e.jsx(Y,{value:i}):t("common.neverExpired")}},{label:t("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRender:(i,{rowIndex:A})=>{const w=_[A];return e.jsx(Ve,{"data-cy":"access-key-actions",actions:[{icon:e.jsx(we,{}),text:t("common.edit"),onClick:C=>{C.stopPropagation(),K(w)}},{icon:e.jsx(Te,{}),text:t("common.delete"),onClick:C=>{C.stopPropagation(),y(w)}}]})}}}],[_,s,t,a,y,K]),he=({page:i,rowsPerPage:A,searchText:w})=>{u.pageSize!==A?S(C=>({...C,searchText:"",pageSize:A,page:1})):u.page!==i+1?S(C=>({...C,searchText:"",page:i+1})):u.searchText!==w&&S(C=>({...C,searchText:w,page:1}))},ne=u.searchText?_.filter(i=>i.accessKeyId.toLowerCase().includes(u.searchText.toLowerCase())||(i.remark||"").toLowerCase().includes(u.searchText.toLowerCase())):_;return W?e.jsx(Ne,{severity:"error",children:Se(W)}):e.jsxs(f,{ref:T,sx:{".custom-toobar-btns":{gap:"8px"},".custom-toobar-title .custom-toobar-title-inner>span":{display:"flex",alignItems:"center","white-space":"inherit",height:"100%"}},children:[g?e.jsx(de,{title:t("setting.accessKey.listTitle"),tooltipTitle:t("setting.accessKey.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${s}/access-key`}):null,e.jsx(ve,{durable:r,durableKeys:["page","rowsPerPage"],data:ne,columns:fe,options:{sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,page:u.page-1,rowsPerPage:u.pageSize,count:((ae=p.value)==null?void 0:ae.count)||0,searchDebounceTime:600,onRowClick(i,{dataIndex:A},w){var C;if((C=T.current)!=null&&C.contains(w.target)){const ge=ne[A];c(ge)}}},loading:I,onChange:he,title:g?null:e.jsx(de,{title:t("setting.accessKey.listTitle"),tooltipTitle:t("setting.accessKey.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${s}/access-key`}),customButtons:[e.jsx(Le,{permission:l?"":"mutate_accessKey",children:e.jsx(X,{onCreate:i=>{const{accessKeyId:A,accessKeySecret:w,authType:C}=i;k({show:!0,accessKeyId:A,accessKeySecret:w,authType:C})}})})],emptyNode:e.jsx(Ae,{children:t("oauth.client.empty")})}),o.show&&e.jsx(Z,{hideSecret:o.authType==="signature",onConfirm:()=>{p.retry(),k({show:!1})},...o}),j&&e.jsx(se,{onCancel:()=>c(null),accessKey:j}),h&&e.jsx(ee,{accessKeyId:h.accessKeyId,time:h.lastUsedAt,remark:h.remark||"N/A",onDelete:p.retry,onClose:()=>y(null)}),v&&e.jsx(te,{...v,onUpdate:p.retry,onClose:()=>K(null)})]})}export{zt as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as B,a0 as q,bT as U,I as ge,bU as fe,a2 as je,a9 as ye,bA as we}from"./vendor-ux-did-connect-2jRoUb28.js";import{t as ke,l as de,j as Ee}from"./vendor-hooks-BgUTpb6X.js";import{r as T,b as Q}from"./vendor-react-DEoibe3W.js";import{d as X}from"./InfoOutlined-D3XnF0Vg.js";import{j as ve,B as Ce}from"./vendor-arcblock-BlrkGjK9.js";import{D as F,aB as Se,aC as K,G as pe,y as Te}from"./index-B_NDUfon.js";import{u as _}from"./dashboard-BhR1WNzF.js";import{u as Re}from"./use-mobile-BAa0wi8o.js";import{H as t,j as e,D as Ie,aj as ze,t as De,aa as m,O as re,T as R,ab as M,ak as Z,z as Pe,y as H,bs as le,bR as Y,ad as $,L as J,A as G,bc as Ae,E as L,I as ee,C as We,bq as Oe,al as D,cg as qe,X as $e,bb as V,bp as Le,b4 as Be,ch as Me,ci as He,b5 as Ne,an as Fe,c0 as _e,s as ue,v as Ue,cj as Ke,ck as Ye,cl as Ve,cm as Je}from"./vendor-mui-core-BV2FUxWJ.js";import{d as Ge}from"./ExpandLess-t1cH-Bc4.js";import{b as he,z as Qe,A as Xe}from"./vendor-utils-rHXShPKm.js";import{C as Ze}from"./confirm-Tue92P8p.js";import{A as et}from"./actions-DP7pj6xB.js";import{T as ae}from"./table-tips-BfSSGl9N.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-D6gvgmEW.js";import"./index-8eXqqyHQ.js";import"./PlayArrow-CDOOUxMp.js";import"./get-safe-url-c4iAcpvA.js";import"./session-C_8V_o-O.js";import"./use-blocklet-logo-BZU9LLmz.js";import"./dot-itVN8XTt.js";import"./useAsync-510ntT1B.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-C21X4TYN.js";import"./MoreHoriz-DpKn_fkc.js";const tt=o=>{var f,w;const[p,u]=T.useState(null),[E,s]=T.useState(!o),[I,c]=T.useState(null),{blocklet:a}=pe(),d=(w=(f=a==null?void 0:a.site)==null?void 0:f.domainAliases[0])==null?void 0:w.value,j=T.useMemo(()=>{const b={};return p&&(p.sources.forEach(l=>{b[l.did]={source:l,events:[],count:0}}),p.events.forEach(l=>{b[l.source]&&(b[l.source].events.push(l),b[l.source].count+=1)})),b},[p]),y=async()=>{try{if(s(!0),!d)return;const l=await(await fetch(`https://${d}/.well-known/service/openevent.json`)).json();u(l),c(null)}catch(b){c(b instanceof Error?b:new Error(String(b)))}finally{s(!1)}};return T.useEffect(()=>{y()},[d]),{openEvent:p,setOpenEvent:u,eventsBySource:j,loading:E,error:I,loadData:y}};function te({eventsBySource:o,selectedEvents:p,setSelectedEvents:u,error:E}){const{t:s}=B(),[I,c]=T.useState({}),a=T.useMemo(()=>{const l={};return Object.entries(o).forEach(([g,{events:h}])=>{const S=h.filter(x=>p[`${x.type}-${x.source}`]).length;l[g]=S}),l},[o,p]),d=T.useMemo(()=>Object.values(a).reduce((l,g)=>l+g,0),[a]),j=T.useMemo(()=>Object.values(o).reduce((l,{events:g})=>l+g.length,0),[o]),y=(l,g)=>{g.stopPropagation(),c({...I,[l]:!I[l]})},f=l=>{const g=`${l.type}-${l.source}`;u(h=>({...h,[g]:!h[g]}))},w=(l,g)=>{const h={};l.forEach(S=>{const x=`${S.type}-${S.source}`;h[x]=!g}),u(S=>({...S,...h}))},b=l=>{const g={};Object.values(o).forEach(({events:h})=>{h.forEach(S=>{const x=`${S.type}-${S.source}`;g[x]=l.target.checked})}),u(g)};return e.jsxs(m,{sx:{width:"100%"},children:[e.jsxs(m,{sx:{display:"flex",alignItems:"center",mb:1,mt:1},children:[e.jsx(le,{control:e.jsx(Y,{onChange:b,checked:d>0&&d===j}),label:e.jsxs(m,{sx:{display:"flex",alignItems:"center",cursor:"pointer"},children:[s("webhookEndpoint.selectAllEvents"),e.jsx(m,{sx:{display:"flex",alignItems:"center"},children:e.jsx($,{title:s("webhookEndpoint.selectAllEventsTooltip"),placement:"right",children:e.jsx(X,{fontSize:"small",sx:{ml:.5,cursor:"help"}})})})]}),sx:{m:0}}),d>0&&e.jsx(R,{variant:"body2",color:"primary",sx:{ml:"auto"},children:s("webhookEndpoint.selectedEventsCount",{count:d})})]}),e.jsx(m,{sx:{maxHeight:"50vh",overflow:"auto"},children:e.jsx(J,{disablePadding:!0,sx:{border:"1px solid",borderColor:"divider",borderRadius:"4px"},children:Object.entries(o).map(([l,{source:g,events:h,count:S}],x)=>{const z=a[l]>0,k=a[l]===h.length&&h.length>0,A=I[l];return e.jsxs(Q.Fragment,{children:[e.jsx(G,{sx:{borderBottom:({palette:i})=>x<Object.keys(o).length-1?`1px solid ${i.divider}`:"none",px:2,py:1.5,"&:hover":{bgcolor:"rgba(0, 0, 0, 0.02)"}},children:e.jsxs(m,{sx:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center"},onClick:i=>{i.target.closest(".MuiFormControlLabel-root")||y(l,i)},children:[e.jsx(m,{sx:{display:"flex",alignItems:"center"},children:h.length>0&&e.jsx(le,{control:e.jsx(Y,{checked:k,indeterminate:z&&!k,onChange:i=>{i.stopPropagation(),w(h,k)}}),label:e.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:1},children:[g.logo&&e.jsx(Ae,{src:g.logo,sx:{width:24,height:24}}),e.jsx(m,{children:g.title||l}),z&&e.jsx(L,{label:s("webhookEndpoint.selectedCount",{count:a[l]}),size:"small",sx:{mt:"2px",height:"20px",fontSize:"12px",bgcolor:i=>`${i.palette.primary.main}20`,color:"primary.main",fontWeight:500}})]}),sx:{m:0,"& .MuiFormControlLabel-label":{flex:1}}})}),e.jsxs(m,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(R,{variant:"body2",color:"text.secondary",sx:{mr:1},children:s("webhookEndpoint.eventsCount",{count:S})}),h.length>0&&e.jsx(ee,{size:"small",edge:"end",children:A?e.jsx(Ge,{}):e.jsx(ve,{})})]})]})}),h.length>0&&e.jsx(We,{in:A,timeout:"auto",unmountOnExit:!0,children:e.jsx(J,{disablePadding:!0,sx:{pl:2,pr:2,py:1,bgcolor:"rgba(0, 0, 0, 0.01)"},children:h.map(i=>{const r=`${i.type}-${i.source}`,n=!!p[r];return e.jsx(G,{dense:!0,sx:{py:.75},onClick:()=>f(i),children:e.jsxs(m,{sx:{display:"flex",alignItems:"flex-start",width:"100%"},children:[e.jsx(Y,{checked:n,sx:{mr:1}}),e.jsxs(m,{children:[e.jsx(R,{variant:"body1",sx:{cursor:"pointer"},children:i.type}),e.jsx(R,{variant:"caption",color:"text.disabled",sx:{display:"block",cursor:"pointer"},children:i.description})]})]})},r)})})})]},l)})})}),E&&e.jsx(Oe,{error:!0,sx:{mt:1},children:E})]})}te.propTypes={eventsBySource:t.objectOf(t.shape({source:t.shape({did:t.string.isRequired,title:t.string,description:t.string,version:t.string,logo:t.string}).isRequired,events:t.arrayOf(t.shape({type:t.string.isRequired,description:t.string.isRequired,source:t.string.isRequired})).isRequired,count:t.number.isRequired})).isRequired,selectedEvents:t.objectOf(t.bool).isRequired,setSelectedEvents:t.func.isRequired,error:t.string};te.defaultProps={error:null};function oe({id:o,url:p,description:u,enabledEvents:E,onSubmit:s,onClose:I}){var i;const{t:c}=B(),[a,d]=T.useState({}),{teamDid:j}=_(),{api:y}=F(),{loading:f,error:w,eventsBySource:b}=tt(),{control:l,handleSubmit:g,formState:{errors:h},reset:S,setValue:x,trigger:z}=Se({defaultValues:{url:"",description:""}});T.useEffect(()=>{const r=Object.values(a).some(n=>n);x("selectedEvents",r?"valid":""),z("selectedEvents")},[a,x,z]);const k=()=>{d({}),S(),I()},A=async r=>{const n=Object.keys(a).filter(v=>a[v]),C={url:r.url,description:r.description,enabledEvents:n.map(v=>{const[P,O]=v.split("-");return!P||!O?null:{type:P,source:O}}).filter(Boolean)};try{if(o){const v=await y.updateWebhookEndpoint({input:{teamDid:j,id:o,data:C}});q.success(`${c("webhookEndpoint.updateWebhook")} ${c("webhookEndpoint.success")}`),s(v)}else{const v=await y.createWebhookEndpoint({input:{teamDid:j,input:C}});q.success(`${c("webhookEndpoint.createWebhook")} ${c("webhookEndpoint.success")}`),s(v)}}catch(v){q.error(v==null?void 0:v.message)}k()};return T.useEffect(()=>{S({url:p,description:u}),d(E.reduce((r,n)=>(r[`${n.type}-${n.source}`]=!0,r),{}))},[S,d,p,u,E]),e.jsx(Ie,{open:!0,onClose:k,maxWidth:"lg",fullWidth:!0,sx:{"& .MuiDialog-paper":{minHeight:600}},children:e.jsxs("form",{onSubmit:g(A),children:[e.jsx(ze,{children:c(o?"webhookEndpoint.editWebhookTitle":"webhookEndpoint.createWebhookTitle")}),e.jsx(De,{children:e.jsxs(m,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[e.jsx(K,{name:"url",control:l,rules:{required:c("webhookEndpoint.validation.urlRequired"),pattern:{value:/^(http|https):\/\/[^ "]+$/,message:c("webhookEndpoint.validation.urlInvalid")}},render:({field:r})=>{var n;return e.jsx(re,{...r,label:c("webhookEndpoint.url.label"),fullWidth:!0,error:!!h.url,helperText:(n=h.url)==null?void 0:n.message})}}),e.jsx(K,{name:"description",control:l,rules:{required:c("webhookEndpoint.validation.descriptionRequired")},render:({field:r})=>{var n;return e.jsx(re,{...r,label:c("webhookEndpoint.description.label"),fullWidth:!0,multiline:!0,minRows:2,maxRows:4,error:!!h.description,helperText:(n=h.description)==null?void 0:n.message})}}),e.jsx(K,{name:"selectedEvents",control:l,rules:{required:c("webhookEndpoint.validation.eventRequired")},render:({field:r})=>e.jsx("input",{type:"hidden",...r})}),!f&&b&&Object.keys(b).length>0&&e.jsx(te,{eventsBySource:b,selectedEvents:a,setSelectedEvents:d,error:(i=h.selectedEvents)==null?void 0:i.message}),!f&&(!b||Object.keys(b).length===0)&&e.jsx(R,{color:"text.secondary",children:c("webhookEndpoint.noAvailableEvents")}),f&&e.jsx(m,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"500px",width:"100%"},children:e.jsx(M,{size:20})}),w&&e.jsx(Z,{severity:"error",children:c("webhookEndpoint.loadingError",{message:w==null?void 0:w.message})})]})}),e.jsxs(Pe,{sx:{p:"8px 24px 24px"},children:[e.jsx(H,{onClick:k,children:c("common.cancel")}),e.jsx(H,{type:"submit",variant:"contained",color:"primary",children:c(o?"webhookEndpoint.updateWebhook":"webhookEndpoint.saveWebhook")})]})]})})}oe.propTypes={onSubmit:t.func.isRequired,id:t.string,url:t.string,description:t.string,enabledEvents:t.arrayOf(t.shape({type:t.string.isRequired,source:t.string.isRequired})),onClose:t.func};oe.defaultProps={id:null,url:"",description:"",enabledEvents:[],onClose:()=>{}};function xe(o){switch(o){case"enabled":return"success";case"disabled":default:return"default"}}const ot=(o="en")=>o==="tw"?"zh":o;function N(o,p="YYYY-MM-DD HH:mm:ss",u="en"){return o?Te(o).locale(ot(u)).format(p):"-"}function st(o){return typeof o=="number"?!1:he(o)}function nt(o){return o>=200&&o<300}function W(o){const p=st(o.value);return e.jsxs(e.Fragment,{children:[e.jsxs(D,{direction:"column",alignItems:"flex-start",children:[e.jsxs(R,{component:"div",variant:"body1",mb:1,color:"text.primary",sx:{fontWeight:500},children:[o.label,!!o.tip&&e.jsx($,{title:o.tip,children:e.jsx(qe,{fontSize:"small"})})]}),e.jsx(R,{component:"div",variant:"body1",color:p?"text.disabled":"text.secondary",sx:{width:"100%",minHeight:"24px"},children:p?"-":o.value})]}),o.divider&&e.jsx($e,{orientation:"vertical",flexItem:!0})]})}W.propTypes={label:t.oneOfType([t.string,t.node]).isRequired,value:t.oneOfType([t.string,t.node]).isRequired,tip:t.oneOfType([t.string,t.node]),divider:t.bool};W.defaultProps={tip:"",divider:!1};function se(o){return e.jsxs(D,{className:"section-header",direction:"row",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:1,sx:{mb:o.mb,mt:o.mt,pb:1},children:[e.jsx(R,{variant:"h3",sx:{fontSize:{xs:"18px",md:"1.09375rem"}},component:"div",children:o.title}),o.children]})}se.propTypes={title:t.oneOfType([t.string,t.node]).isRequired,children:t.node,mb:t.number,mt:t.number};se.defaultProps={children:null,mb:1.5,mt:1.5};const it=o=>{const p={};return o.forEach(u=>{var s;const E=new Date(u.createdAt).toLocaleDateString();p[E]||(p[E]=[]),(s=p[E])==null||s.push(u)}),p};function ne({eventId:o,webhookEndpointId:p,event:u}){const{api:E}=F(),{t:s}=B(),{teamDid:I}=_(),{blocklet:c}=pe(),{data:a,loadMore:d,loadingMore:j,loading:y}=ke(x=>{const k=x?Math.ceil(x.list.length/15)+1:1;return E.getWebhookAttempts({input:{teamDid:I,input:{eventId:o,webhookId:p},paging:{page:k,pageSize:15}}})},{reloadDeps:[o,p]}),f=(a==null?void 0:a.list)||[],[w,b]=T.useState(null),l=it(f);T.useEffect(()=>{!w&&(a!=null&&a.list.length)&&b(a.list[0])},[a==null?void 0:a.list.length,w]);const g=x=>{b(x)};if(y)return e.jsx(M,{});const h=a&&a.list.length<a.paging.total,S=x=>{var z,k,A,i,r;if(x.responseBody&&((z=x.responseBody)!=null&&z.sessionId)&&((k=x.responseBody)!=null&&k.projectId)&&((A=x.responseBody)!=null&&A.agentId)){const n=(r=(i=c==null?void 0:c.site)==null?void 0:i.domainAliases[0])==null?void 0:r.value,C=(c.children||[]).find(P=>{var O;return((O=P==null?void 0:P.meta)==null?void 0:O.name)==="ai-studio"}),v=Qe(Xe(`https://${n}`,(C==null?void 0:C.mountPoint)||"","projects",x.responseBody.projectId,"logs/main"),{sessionId:x.responseBody.sessionId,agentId:x.responseBody.agentId});return e.jsx(ee,{sx:{fontSize:20},onClick:()=>window.open(v,"_blank"),children:e.jsx(m,{component:ge,icon:fe})})}return null};return e.jsxs(V,{container:!0,spacing:{xs:0,md:1},sx:{height:1},children:[e.jsx(V,{item:!0,xs:12,md:4,height:1,children:he(Object.keys(l))?e.jsx(R,{color:"text.secondary",children:s("webhookEndpoint.waitingForEvents")}):e.jsxs(e.Fragment,{children:[e.jsx(J,{sx:{maxHeight:"calc(100% - 40px)",py:0,overflowY:"auto"},children:Object.entries(l).map(([x,z])=>e.jsxs(Q.Fragment,{children:[e.jsx(Le,{children:x}),z.map(k=>e.jsxs(G,{sx:{cursor:"pointer"},onClick:()=>g(k),selected:w===k,secondaryAction:e.jsx(R,{color:"text.secondary",children:N(k.createdAt,"HH:mm:ss")}),children:[e.jsx(Be,{sx:{minWidth:0,mr:1.5},children:nt(k.responseStatus)===!1?e.jsx(Me,{color:"error"}):e.jsx(He,{color:"success"})}),e.jsx(Ne,{primary:e.jsx(R,{color:"text.primary",children:k.event.type})})]},k.id))]},x))}),h&&e.jsx(m,{display:"flex",justifyContent:"center",alignItems:"center",width:1,children:e.jsx(H,{variant:"text",type:"button",color:"inherit",onClick:d,disabled:j,sx:{color:x=>x.palette.text.disabled},children:s(j?"webhookEndpoint.loadingMore":"webhookEndpoint.loadMore")})})]})}),e.jsxs(V,{item:!0,xs:12,md:8,height:1,children:[w&&e.jsxs(D,{height:1,overflow:"auto",direction:"column",spacing:2,sx:{pl:{xs:0,md:1},mt:{xs:2,md:0},borderLeft:{xs:"none"}},children:[e.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(R,{variant:"h6",children:o?w.endpoint.url:w.event.type}),e.jsx(m,{children:S(w)})]}),e.jsxs(m,{children:[e.jsxs(R,{variant:"h6",children:[s("webhookEndpoint.response")," (",w.responseStatus,")"]}),e.jsx(U,{language:"json",children:JSON.stringify(w.responseBody,null,2)})]}),e.jsxs(m,{children:[e.jsx(D,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(R,{variant:"h6",children:s("webhookEndpoint.request")})}),e.jsx(U,{language:"json",sx:{margin:0},children:JSON.stringify(w.event,null,2)})]})]}),(a==null?void 0:a.list.length)===0&&u&&e.jsxs(m,{children:[e.jsx(D,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(R,{variant:"h6",children:s("webhookEndpoint.eventData")})}),e.jsx(U,{language:"json",sx:{margin:0},children:JSON.stringify(u.data,null,2)})]})]})]})}ne.propTypes={eventId:t.string,webhookEndpointId:t.string,event:t.shape({type:t.string,data:t.object,request:t.object,requestInfo:t.object})};ne.defaultProps={eventId:"",webhookEndpointId:"",event:null};function me({id:o,onClose:p}){var j,y,f,w;const{t:u}=B(),{api:E}=F(),{teamDid:s}=_(),{loading:I,error:c,data:a}=de(()=>E.getWebhookEndpoint({input:{teamDid:s,id:o}})),d=a==null?void 0:a.data;return c?e.jsx(Z,{severity:"error",children:c.message}):I||!d?e.jsx(m,{display:"flex",justifyContent:"center",alignItems:"center",height:1,width:1,children:e.jsx(M,{})}):e.jsxs(rt,{direction:"column",sx:{height:{xs:"auto",md:1}},children:[e.jsxs(m,{children:[e.jsxs(D,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e.jsx(D,{flex:1,width:0,children:e.jsxs(m,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(R,{variant:"h5",fontWeight:600,sx:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},children:d.description}),e.jsx($,{title:d.url,children:e.jsx(X,{sx:{fontSize:"16px",marginTop:"2px"}})})]})}),e.jsx(D,{direction:"row",alignItems:"center",children:e.jsx(ee,{edge:"end",color:"inherit",onClick:p,children:e.jsx(_e,{})})})]}),e.jsx(m,{mt:2,children:e.jsxs(D,{className:"section-body",direction:{xs:"column",md:"row"},spacing:{xs:1,md:3},justifyContent:"flex-start",flexWrap:"wrap",sx:{pt:2,mt:2,borderTop:"1px solid #eee"},children:[e.jsx(W,{label:u("common.status"),value:e.jsx(L,{size:"small",variant:"filled",label:d.status,color:xe(d.status),sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}}),divider:!0}),e.jsx(W,{label:u("webhookEndpoint.listen"),value:e.jsx($,{arrow:!0,title:e.jsx("ul",{style:{padding:0,margin:0},children:d.enabledEvents.map(b=>e.jsx("li",{style:{fontSize:"0.7875rem"},children:b==null?void 0:b.type},b))}),children:e.jsx(L,{size:"small",variant:"filled",label:u("webhookEndpoint.eventsCount",{count:d.enabledEvents.length}),sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})}),divider:!0}),e.jsx(W,{label:u("webhookEndpoint.version"),value:d.apiVersion,divider:!0}),e.jsx(W,{label:u("common.createdAt"),value:N(d.createdAt),divider:!0}),e.jsx(W,{label:u("common.updatedAt"),value:N(d.updatedAt),divider:!0}),e.jsx(W,{label:u("common.createdBy"),value:e.jsx($,{arrow:!0,title:(j=d.createUser)==null?void 0:j.did,children:e.jsx(L,{size:"small",variant:"filled",label:(y=d.createUser)==null?void 0:y.fullName,sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})}),divider:!0}),e.jsx(W,{label:u("common.updatedBy"),value:e.jsx($,{arrow:!0,title:(f=d.updateUser)==null?void 0:f.did,children:e.jsx(L,{size:"small",variant:"filled",label:(w=d.updateUser)==null?void 0:w.fullName,sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})})})]})})]}),e.jsxs(D,{className:"section",flex:1,height:0,overflow:"hidden",children:[e.jsx(se,{title:u("webhookEndpoint.attempts"),mb:0,mt:4}),e.jsx(D,{height:0,flex:1,overflow:"hidden",children:e.jsx(ne,{webhookEndpointId:d.id})})]})]})}me.propTypes={id:t.string.isRequired,onClose:t.func.isRequired};const rt=ue(D)``;function be({open:o,onClose:p,id:u}){return e.jsx(Fe,{anchor:"right",open:o,onClose:p,PaperProps:{sx:{width:"90vw",maxWidth:"1200px"}},children:e.jsx(m,{sx:{height:"100vh",p:3},children:e.jsx(me,{id:u,onClose:p})})})}be.propTypes={open:t.bool.isRequired,onClose:t.func.isRequired,id:t.string.isRequired};function ce(){return null}const ie=Q.memo(({options:o,columns:p,toolbar:u=!0,footer:E=!0,hasRowLink:s=!1,emptyNodeText:I="",...c})=>{const{locale:a}=B(),d=Ue(f=>f.breakpoints.down("md")),j={print:!1,download:!1,filter:!1,selectableRows:"none",rowsPerPage:d?5:10,rowsPerPageOptions:[5,10,20,50,100],searchDebounceTime:300,tableBodyHeight:"100%",loading:!0},y={};return u||(y.TableToolbar=ce),E||(y.TableFooter=ce),e.jsx(lt,{locale:a,options:{...j,...o},columns:(p||[]).map(f=>(f.options=f.options||{},f.options.filter=f.options.filter||!1,f.options.sort=f.options.sort||!1,f)),emptyNode:e.jsx(je,{children:I}),...c,components:y,hasRowLink:s,isMobile:d})});ie.propTypes={options:t.object,columns:t.array,toolbar:t.bool,footer:t.bool,hasRowLink:t.bool,emptyNodeText:t.node,durable:t.string,durableKeys:t.array,data:t.array,loading:t.bool,onChange:t.func,title:t.node,components:t.object};ie.defaultProps={options:{},columns:[],toolbar:!0,footer:!0,hasRowLink:!1,emptyNodeText:null,durable:"",durableKeys:[],data:[],loading:!1,onChange:()=>{},title:null,components:{}};const lt=ue(ye)``,at=ie;function Ot(){const{teamDid:o}=_(),p=Re(),u=`webhook-endpoints-${o}`,E=we(u),{t:s,locale:I}=B(),{api:c}=F(),[a,d]=T.useState(""),[j,y]=T.useState({webhookDetail:{open:!1,id:null},createEdit:{open:!1,id:null,url:"",description:"",enabledEvents:[]},deleteConfirm:null}),[f,w]=Ee(u,{defaultValue:{pageSize:E.rowsPerPage||20,page:E.page?E.page+1:1}}),{loading:b,error:l,data:g,refresh:h}=de(()=>c.getWebhookEndpoints({input:{teamDid:o,paging:{page:f.page,pageSize:f.pageSize}}}));T.useEffect(()=>{h()},[f,h]);const S=T.useCallback(async(i,r)=>{try{await c.updateWebhookEndpoint({input:{teamDid:o,id:i.id,data:{status:r?"disabled":"enabled"}}}),h(),q.success(`${s(r?"webhookEndpoint.disable":"webhookEndpoint.enable")}${s("webhookEndpoint.success")}`)}catch(n){q.error(n==null?void 0:n.message)}},[c,o,h,s]),x=T.useCallback(async i=>{try{await c.deleteWebhookEndpoint({input:{teamDid:o,id:i}}),h(),y(r=>({...r,deleteConfirm:null})),q.success(`${s("common.delete")}${s("webhookEndpoint.success")}`)}catch(r){q.error(r==null?void 0:r.message)}},[c,o,h,s]),z=(i,r)=>{let n=i.page+1;const C=i.searchText||"";if(C!==a){d(C);return}if(r==="changePage"||r==="changeRowsPerPage"){r!=="changePage"&&(n=1);const v={page:n,pageSize:i.rowsPerPage};d(""),w(v)}};if(l)return e.jsx(Z,{severity:"error",children:l.message});if(b||!g)return e.jsx(m,{display:"flex",justifyContent:"center",alignItems:"center",width:1,height:500,children:e.jsx(M,{})});const k=((g==null?void 0:g.list)||[]).filter(i=>{if(!a)return!0;const r=a.toLowerCase();return i.description.toLowerCase().includes(r)||i.url.toLowerCase().includes(r)}),A=[{label:"URL",name:"url",options:{customBodyRenderLite:(i,r)=>{const n=k[r];return e.jsxs(m,{sx:{display:"flex",alignItems:"center",cursor:"pointer",gap:.5},children:[e.jsx(R,{variant:"body2",children:n.description}),e.jsx(m,{sx:{display:"flex"},onClick:C=>{C.stopPropagation()},children:e.jsx($,{title:n.url,children:e.jsx(X,{sx:{fontSize:"15px",marginTop:"1px"}})})})]})}}},{label:"Events",name:"events",options:{customBodyRenderLite:(i,r)=>{const n=k[r];return e.jsx(m,{sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"wrap"},children:n.enabledEvents.map(C=>e.jsx(L,{size:"small",variant:"filled",label:C.type,sx:{borderRadius:"4px",textTransform:"capitalize"}},`${n.source}-${C.type}`))})}}},{label:s("common.status"),name:"status",options:{customBodyRenderLite:(i,r)=>{const n=k[r];return e.jsx(L,{size:"small",variant:"filled",label:s(`webhookEndpoint.${n==null?void 0:n.status}`),color:xe(n==null?void 0:n.status),sx:{borderRadius:"4px",textTransform:"capitalize"}},`status-${n.status}`)}}},{label:s("common.createdAt"),name:"createdAt",minWidth:200,options:{customBodyRender:i=>N(i)}},{label:s("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRenderLite:(i,r)=>{const n=k[r],C=(n==null?void 0:n.status)==="enabled";return e.jsx(et,{actions:[{icon:C?e.jsx(Ke,{}):e.jsx(Ye,{}),text:s(C?"webhookEndpoint.disable":"webhookEndpoint.enable"),onClick:v=>{v.stopPropagation(),S(n,C)}},{icon:e.jsx(Ve,{}),text:s("common.edit"),onClick:v=>{v.stopPropagation(),y(P=>({...P,createEdit:{open:!0,id:n.id,url:n.url,description:n.description,enabledEvents:n.enabledEvents}}))}},{icon:e.jsx(Je,{}),text:s("common.delete"),onClick:v=>{v.stopPropagation(),y(P=>({...P,deleteConfirm:{title:s("webhookEndpoint.deleteWebhook.title"),description:s("webhookEndpoint.deleteWebhook.description"),confirm:s("common.confirm"),cancel:s("common.cancel"),onConfirm:()=>x(n.id),onCancel:()=>y(O=>({...O,deleteConfirm:null}))}}))}}]})}}}];return e.jsxs(m,{sx:{".custom-toobar-btns":{gap:"8px"},".custom-toobar-title .custom-toobar-title-inner>span":{display:"flex",alignItems:"center","white-space":"inherit",height:"100%"}},children:[p?e.jsx(ae,{title:s("webhookEndpoint.listTitle"),tooltipTitle:s("webhookEndpoint.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${I}/webhook`}):null,e.jsx(at,{durable:u,durableKeys:["page","rowsPerPage"],data:k,columns:A,options:{count:g.count,page:f.page-1,rowsPerPage:f.pageSize,viewColumns:!1,onRowClick:(i,{dataIndex:r})=>{const n=g.list[r];y(C=>({...C,webhookDetail:{open:!0,id:n.id}}))}},loading:b,onChange:z,emptyNodeText:e.jsx(D,{gap:1,children:s("webhookEndpoint.noWebhooksAdded")}),title:p?null:e.jsx(ae,{title:s("webhookEndpoint.listTitle"),tooltipTitle:s("webhookEndpoint.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${I}/webhook`}),customButtons:[e.jsxs(H,{sx:{color:"common.white"},edge:"end",variant:"contained",color:"primary",onClick:()=>y(i=>({...i,createEdit:{...i.createEdit,open:!0}})),className:"rule-action",children:[b?e.jsx(M,{size:16}):e.jsx(Ce,{style:{fontSize:16}}),s("common.create")]},"add")]}),j.webhookDetail.open&&e.jsx(be,{open:!0,onClose:()=>y(i=>({...i,webhookDetail:{open:!1,id:null}})),id:j.webhookDetail.id}),j.createEdit.open&&e.jsx(oe,{onSubmit:h,...j.createEdit,onClose:()=>y(i=>({...i,createEdit:{id:null,url:"",description:"",enabledEvents:[],open:!1}}))}),j.deleteConfirm&&e.jsx(Ze,{title:j.deleteConfirm.title,description:j.deleteConfirm.description,confirm:j.deleteConfirm.confirm,cancel:j.deleteConfirm.cancel,params:j.deleteConfirm.params,onConfirm:j.deleteConfirm.onConfirm,onCancel:j.deleteConfirm.onCancel})]})}export{Ot as default};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-D2a97Hdb.js","assets/vendor-ux-did-connect-2jRoUb28.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-BlrkGjK9.js","assets/index-Bs1kxR8_.js","assets/index-B_NDUfon.js","assets/index-DOq-_YXu.css","assets/index-DVQCgvFb.js","assets/index-AgKpYdvC.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as U,b as be}from"./vendor-react-DEoibe3W.js";import{a as F,d as H,j as K,a0 as M,_ as ve,$ as ne,Y as $,b6 as ye,a9 as Ce,a2 as we}from"./vendor-ux-did-connect-2jRoUb28.js";import{H as o,j as e,D as G,aj as Q,I as X,t as Y,al as W,T as I,aa as p,O as T,bq as y,bK as Te,bQ as oe,bs as se,bR as ae,X as J,ak as ce,z as ue,y as L,ab as Z,ad as Se}from"./vendor-mui-core-BV2FUxWJ.js";import{B as de}from"./vendor-arcblock-BlrkGjK9.js";import{d as ke}from"./Edit-CUl1Rt8i.js";import{_ as Ie}from"./dot-itVN8XTt.js";import{l as pe}from"./index-BKKwhjBs.js";import{D as B,aB as he,aC as S,G as Ae}from"./index-B_NDUfon.js";import{u as _}from"./dashboard-BhR1WNzF.js";import{o as Re,c as qe,A as re}from"./vendor-utils-rHXShPKm.js";import{T as Oe}from"./index-NQMMaHuW.js";import{E as Pe}from"./empty-spinner-BdaCO6xq.js";import{C as v}from"./click-to-copy-R7MF4AwY.js";import{D as Ne}from"./delete-confirm-CHnQ2leb.js";import{b as Ee}from"./passport-item-OEfv-Vh7.js";import{A as We}from"./actions-DP7pj6xB.js";import{T as le}from"./table-tips-BfSSGl9N.js";import{u as De}from"./use-mobile-BAa0wi8o.js";import"./vendor-hooks-BgUTpb6X.js";import"./lottie-web-jYmAQWuC.js";import"./useAsync-510ntT1B.js";import"./useLocalStorage-D6gvgmEW.js";import"./index-8eXqqyHQ.js";import"./confirm-Tue92P8p.js";import"./PlayArrow-CDOOUxMp.js";import"./get-safe-url-c4iAcpvA.js";import"./session-C_8V_o-O.js";import"./use-blocklet-logo-BZU9LLmz.js";import"./InfoOutlined-D3XnF0Vg.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-C21X4TYN.js";import"./vendor-mui-x-Bo-XOtzq.js";import"./AdapterDayjs-CDDcwz3P.js";import"./index-D1kTR2xk.js";import"./Phone-BkOMNOMO.js";import"./Location-DxPzfR_p.js";import"./Email-BirbvqZ3.js";import"./Timezone-D91Of94T.js";import"./did-address-Dq-4__HB.js";import"./util-DMfPwzVN.js";import"./base32-WurN0cIW.js";import"./MoreHoriz-DpKn_fkc.js";const ze={clientName:"",clientUri:"",redirectUris:"",scope:["profile:read"],contacts:"",tosUri:"",policyUri:""};function me({onCreated:r,onClose:d}){const[t,m]=U.useState(!1),{t:n,locale:s}=F(),{api:g}=B(),{teamDid:h}=_(),{control:f,handleSubmit:q,formState:{errors:a},watch:k,setValue:x}=he({defaultValues:ze,mode:"onChange"}),w=k("scope"),A=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:Re(u,qe)}}),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:[n("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(W,{spacing:4,sx:{mt:2},children:[e.jsx(I,{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 u;return e.jsxs(e.Fragment,{children:[e.jsx(T,{size:"small",...c,label:n("oauth.client.name"),required:!0,fullWidth:!0,placeholder:n("oauth.client.input.clientNamePlaceholder"),error:!!a.clientName,helperText:(u=a.clientName)==null?void 0:u.message}),e.jsx(y,{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 u;return e.jsxs(e.Fragment,{children:[e.jsx(T,{size:"small",...c,label:n("oauth.client.input.clientUri"),required:!0,fullWidth:!0,placeholder:n("oauth.client.input.clientUriPlaceholder"),error:!!a.clientUri,helperText:(u=a.clientUri)==null?void 0:u.message}),e.jsx(y,{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 u;return e.jsxs(e.Fragment,{children:[e.jsx(T,{size:"small",...c,label:n("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,placeholder:n("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:n("oauth.client.helperText.redirectUris")}),e.jsx(y,{children:n("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:n("oauth.client.helperText.document")}),e.jsx(y,{children:n("oauth.client.helperText.more")})]})]})}})}),e.jsxs(Te,{variant:"outlined",sx:{p:2,display:"none"},children:[e.jsx(I,{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(K.OAUTH_SCOPES).map(([c,u])=>e.jsx(se,{control:e.jsx(ae,{checked:w.includes(c),onChange:()=>A(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(J,{}),e.jsx(I,{variant:"h6",gutterBottom:!0,children:n("oauth.client.optionalInformation")}),e.jsx(W,{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 u;return e.jsxs(e.Fragment,{children:[e.jsx(T,{size:"small",...c,label:n("oauth.client.input.contacts"),fullWidth:!0,placeholder:n("oauth.client.input.contactsPlaceholder"),error:!!a.contacts,helperText:(u=a.contacts)==null?void 0:u.message}),e.jsx(y,{children:n("oauth.client.helperText.contacts")})]})}})}),e.jsxs(W,{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 u;return e.jsxs(p,{sx:{width:"50%"},children:[e.jsx(T,{size:"small",...c,label:n("oauth.client.input.tosUri"),fullWidth:!0,placeholder:n("oauth.client.input.tosUriPlaceholder"),error:!!a.tosUri,helperText:(u=a.tosUri)==null?void 0:u.message}),e.jsx(y,{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 u;return e.jsxs(p,{sx:{width:"50%"},children:[e.jsx(T,{size:"small",...c,label:n("oauth.client.input.policyUri"),fullWidth:!0,placeholder:n("oauth.client.input.policyUriPlaceholder"),error:!!a.policyUri,helperText:(u=a.policyUri)==null?void 0:u.message}),e.jsx(y,{children:n("oauth.client.helperText.policyUri")})]})}})]}),a.error&&e.jsx(ce,{severity:"error",children:a.error.message})]})}),e.jsxs(ue,{children:[e.jsx(L,{onClick:d,children:n("common.cancel")}),e.jsxs(L,{onClick:q(N),disabled:t,variant:"contained",color:"primary",children:[t?e.jsx(Z,{size:20,sx:{mr:1}}):null,n("oauth.client.registerButton")]})]})]})}me.propTypes={onCreated:o.func.isRequired,onClose:o.func.isRequired};function V({scope:r,...d}){if(!r)return null;const t=r.split(" ").filter(Boolean);return e.jsx(W,{direction:"row",flexWrap:"wrap",gap:1,...d,children:t.map(m=>e.jsx(be.Fragment,{children:e.jsx(Se,{title:K.OAUTH_SCOPES[m],children:e.jsx(v,{children:m})})},m))})}V.propTypes={scope:o.string};V.defaultProps={scope:""};const ee=r=>{const{prefix:d}=B(),{blocklet:t}=Ae(),m=re(d,"/api/media/upload",t.appPid),n=U.useCallback(g=>g?g.startsWith("http")?g:`${re(d,"/api/media/upload",t.appPid)}/${g}`:"",[d,t.appPid]);return{clientLogoUrl:U.useMemo(()=>n(r),[r,n]),apiPath:m,getClientLogoUrl:n}},Le=U.lazy(()=>ve(()=>import("./index-D2a97Hdb.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,n]=U.useState(!1),{t:s,locale:g}=F(),h=U.useRef(null),{api:f}=B(),{teamDid:q}=_(),{control:a,handleSubmit:k,formState:{errors:x},watch:w,setValue:A,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||"",clientSecretExpiresAt:r.clientSecretExpiresAt||null},mode:"onChange"}),c=w("scope"),u=w("logoUri"),{clientLogoUrl:O,apiPath:E}=ee(u),R=l=>{l!=="profile:read"&&A("scope",c.includes(l)?c.filter(i=>i!==l):[...c,l])},D=async l=>{const i={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:q,input:i}})},z=async l=>{n(!0);try{await D(l),d(),t()}catch(i){M.error(i.message||s("oauth.client.updateFailed"))}finally{n(!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(W,{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 l;(l=h.current)==null||l.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(L,{sx:{mt:2},variant:"outlined",size:"small",onClick:()=>{var l;(l=h.current)==null||l.open()},children:s(O?"common.change":"common.upload")})]}),e.jsx(p,{sx:{display:"flex",alignItems:"center"},children:e.jsx(U.Suspense,{fallback:e.jsx(Pe,{}),children:e.jsx(Le,{ref:h,locale:g,popup:!0,onUploadFinish:l=>{A("logoUri",l.data.filename),D(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:E,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:l})=>{var i;return e.jsxs(e.Fragment,{children:[e.jsx(T,{...l,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:l})=>{var i;return e.jsxs(e.Fragment,{children:[e.jsx(T,{...l,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:l})=>{var i;return e.jsxs(e.Fragment,{children:[e.jsx(T,{...l,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.jsx(S,{name:"clientSecretExpiresAt",control:a,render:({field:l})=>e.jsx(Oe,{placeholder:s("oauth.client.input.expireTime"),value:l.value*1e3,onChange:i=>{l.onChange(i)}})}),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(([l,i])=>e.jsx(se,{control:e.jsx(ae,{checked:c.includes(l),onChange:()=>R(l),disabled:l==="profile:read",color:"primary"}),label:e.jsx(p,{children:e.jsx(I,{variant:"body2",sx:{fontWeight:500},children:i})})},l))})})]}),e.jsx(J,{}),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:l})=>{var i;return e.jsxs(e.Fragment,{children:[e.jsx(T,{...l,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(W,{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 i;return e.jsxs(p,{sx:{width:"50%"},children:[e.jsx(T,{...l,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:l})=>{var i;return e.jsxs(p,{sx:{width:"50%"},children:[e.jsx(T,{...l,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(L,{onClick:t,children:s("common.cancel")}),e.jsx(L,{onClick:k(z),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:d,onClose:t}){return e.jsx(xe,{client:r,onUpdate:m=>d(m),onClose:t})}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:d}=F(),{api:t}=B(),{teamDid:m}=_(),{clientId:n,clientName:s,onDelete:g=()=>{},onClose:h=()=>{}}=r,f=()=>{h()},q=async()=>{try{await t.deleteOAuthClient({input:{teamDid:m,clientId:n}}),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:q,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:o.string.isRequired,clientName:o.string.isRequired,onDelete:o.func,onClose:o.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(W,{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:o.string.isRequired,items:o.arrayOf(o.shape({label:o.string.isRequired,value:o.any})).isRequired};function fe({client:r,onClose:d}){const{t,locale:m}=F(),{teamDid:n}=_(),{clientName:s,clientId:g,clientSecret:h,redirectUris:f,scope:q,clientUri:a,logoUri:k,contacts:x,tosUri:w,policyUri:A,jwksUri:N,jwks:c,softwareId:u,softwareVersion:O,clientIdIssuedAt:E,clientSecretExpiresAt:R,updatedAt:D,createUser:z}=r,{clientLogoUrl:l}=ee(k),i=j=>{try{const P=new URL(window.blocklet.appUrl);return P.pathname=j,P.toString()}catch{return"-"}},C=pe.fromAppDid(g,n),b=[{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:l,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:q})},{label:t("oauth.client.createUser"),value:z?Ee(z,!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:A?e.jsx(v,{children:A}):"-"},{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:E?e.jsx($,{value:E*1e3,type:"all",locale:m}):"-"},{label:t("oauth.client.clientSecretExpiresAt"),value:R?e.jsx($,{value:R*1e3,type:"all",locale:m}):"-"},{label:t("common.updatedAt"),value:D?e.jsx($,{value:D,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:b.map((j,P)=>e.jsxs(p,{children:[e.jsx(ge,{title:j.title,items:j.items}),P!==b.length-1&&e.jsx(J,{sx:{my:2}})]},j.title))})})]})}fe.propTypes={client:o.object.isRequired,onClose:o.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:o.object,onClose:o.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:o.bool.isRequired,onCreated:o.func.isRequired,onClose:o.func.isRequired};function At(){var l;const[r,d]=U.useState({searchText:"",pageSize:10,page:1}),[t,m]=U.useState(null),[n,s]=U.useState(!1),g=U.useRef(null),{t:h,locale:f}=F(),{api:q}=B(),{teamDid:a}=_(),[k,x]=U.useState(null),[w,A]=U.useState(null),N=De(),{getClientLogoUrl:c}=ee(),u=Ie(async()=>await q.getOAuthClients({input:{teamDid:a,paging:{page:r.page,pageSize:r.pageSize}}}),[r.page,r.pageSize]),{loading:O}=u,E=U.useMemo(()=>{var i;return((i=u.value)==null?void 0:i.list)||[]},[(l=u.value)==null?void 0:l.list]),R=U.useMemo(()=>r.searchText?E.filter(i=>i.clientName.toLowerCase().includes(r.searchText.toLowerCase())||i.clientId.toLowerCase().includes(r.searchText.toLowerCase())||i.scope.toLowerCase().includes(r.searchText.toLowerCase())):E,[r.searchText,E]),D=U.useMemo(()=>[{label:h("oauth.client.name"),name:"clientName",options:{customBodyRender:(i,{rowIndex:C})=>{const b=R[C],j=c(b.logoUri),P=pe.fromAppDid(b.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:P.address,src:j,size:48}),e.jsxs(W,{gap:.5,children:[e.jsx(p,{sx:{color:"text.primary"},children:b.clientName}),e.jsx(p,{sx:{color:"text.secondary"},children:b.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 b=R[C];return e.jsx(We,{actions:[{icon:e.jsx(ke,{}),text:h("common.edit"),onClick:j=>{j.stopPropagation(),x(b)}},{icon:e.jsx(ye,{}),text:h("common.delete"),onClick:j=>{j.stopPropagation(),A(b)}}]})}}}],[R,h,c,a,x,A]),z=({page:i,rowsPerPage:C,searchText:b})=>{r.pageSize!==C?d(j=>({...j,searchText:"",pageSize:C,page:1})):r.page!==i+1?d(j=>({...j,searchText:"",page:i+1})):r.searchText!==b&&d(j=>({...j,searchText:b,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(Ce,{data:R,columns:D,options:{sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,page:r.page-1,rowsPerPage:r.pageSize,count:R.length,searchDebounceTime:400,onRowClick(i,{dataIndex:C},b){var j;if((j=g.current)!=null&&j.contains(b.target)){const P=R[C];m(P)}}},onChange:z,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(L,{variant:"contained",size:"small",onClick:()=>s(!0),children:[O?e.jsx(Z,{size:16}):e.jsx(de,{style:{fontSize:16}}),h("common.create")]},"add")],loading:!1,emptyNode:e.jsx(we,{children:h("oauth.client.empty")})}),e.jsx(ie,{selected:t,onClose:()=>m(null)}),e.jsx(Ue,{open:n,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:()=>A(null)})]})}export{At as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./vendor-mui-core-BV2FUxWJ.js";import"./vendor-react-DEoibe3W.js";import{S as t}from"./studio-1mTu0Fgs.js";import"./vendor-ux-did-connect-2jRoUb28.js";import"./vendor-utils-rHXShPKm.js";import"./vendor-hooks-BgUTpb6X.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-BlrkGjK9.js";import"./TuneOutlined-D0gGDoIJ.js";function d(){return o.jsx(t,{children:"Coming soon..."})}export{d as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{aZ as o}from"./vendor-ux-did-connect-2jRoUb28.js";const e=o();export{e as b};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/connect-Cm-sTMiW.js","assets/vendor-mui-core-BV2FUxWJ.js","assets/vendor-react-DEoibe3W.js","assets/vendor-utils-rHXShPKm.js","assets/useAsync-510ntT1B.js","assets/vendor-hooks-BgUTpb6X.js","assets/vendor-ux-did-connect-2jRoUb28.js","assets/lottie-web-jYmAQWuC.js","assets/vendor-ux-did-connect-DpSGLE7B.css","assets/index-B_NDUfon.js","assets/vendor-arcblock-BlrkGjK9.js","assets/index-DOq-_YXu.css","assets/config-eQ2Et0RC.js","assets/index-ChHy6AQ7.js","assets/Done-BTd13H2U.js","assets/collapse-l9wHY9gJ.js","assets/Google-Bn3zPWiu.js","assets/cloneDeep-UpFQ2VNg.js","assets/logo-uploader-Cir_HrSm.js","assets/index-DVQCgvFb.js","assets/page-header-BWqvvXOk.js","assets/layout-CNC_rrzE.js","assets/content-layout-fV4nyVb5.js","assets/step-actions-1pM57149.js","assets/use-mobile-C21X4TYN.js","assets/button-_1HExv7r.js","assets/index-D0F0qx_R.js","assets/config-space-CQ7Atb1l.js","assets/spaces-DApg1wzn.js","assets/api-BjteVZFg.js","assets/connect-to-FvVJBIsZ.js","assets/index-8eXqqyHQ.js","assets/DeleteOutline-DpNyWtNL.js","assets/domain-FY9-unAU.js","assets/domain-action-card-Jvzi8kyL.js","assets/ExpandLess-t1cH-Bc4.js","assets/permission-DSHe73ba.js","assets/session-C_8V_o-O.js","assets/dot-itVN8XTt.js","assets/confirm-Tue92P8p.js","assets/actions-DP7pj6xB.js","assets/MoreHoriz-DpKn_fkc.js","assets/delete-confirm-CHnQ2leb.js","assets/click-to-copy-R7MF4AwY.js","assets/util-BiCOL9ao.js","assets/useSetState-CWq0AVWn.js","assets/InfoOutlined-D3XnF0Vg.js","assets/index-BUHyq-oP.js","assets/CheckCircle-Caqp5gKY.js","assets/access-control-eEjmzQYf.js","assets/config-Cd14MJHa.js","assets/fuel-CzrPInoR.js","assets/Launch-Dz9mQnYC.js","assets/did-address-Dq-4__HB.js","assets/complete-D7dveRTo.js","assets/launch-result-message-FuvJDCvp.js","assets/get-safe-url-Q70tRxL7.js","assets/starting-progress-BHUTOY2b.js","assets/addon-CRj4Enw7.js","assets/QuestionMarkCircle-DTGyWFVS.js","assets/use-server-logo-CxuMvwKh.js","assets/use-mobile-BAa0wi8o.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{a as $,aV as q,j as N,_ as m}from"./vendor-ux-did-connect-2jRoUb28.js";import{j as e,a7 as X,ah as U,e as G,bD as J,aa as Y,ab as ee,b6 as te}from"./vendor-mui-core-BV2FUxWJ.js";import{r as i,h as se,f as ae,i as ne,j as h,k as oe}from"./vendor-react-DEoibe3W.js";import{B as re,z as ie,A as n,_ as le,ad as ce}from"./vendor-utils-rHXShPKm.js";import{C as pe}from"./config-space-CQ7Atb1l.js";import{H as ue}from"./addon-CRj4Enw7.js";import{S as de,L as he,c as S}from"./vendor-arcblock-BlrkGjK9.js";import{r as me,k as fe,u as _e,t as g,v as Le,w as xe,x as V,N as Ce,f as ge,S as Ee}from"./index-B_NDUfon.js";import{g as ye}from"./get-safe-url-Q70tRxL7.js";import{y as ve}from"./vendor-hooks-BgUTpb6X.js";import{u as Pe}from"./use-server-logo-CxuMvwKh.js";const Se=s=>i.createElement("svg",{width:32,height:32,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},i.createElement("path",{d:"M4.00572 31C3.25866 31 2.53839 30.7217 1.98537 30.2194C1.43235 29.7171 1.08623 29.0269 1.01451 28.2833L1.00049 27.9948V5.95637C1.00052 5.2093 1.27881 4.48903 1.78109 3.93601C2.28336 3.38299 2.9736 3.03688 3.71722 2.96516L4.00572 2.95113H13.0214C13.7682 2.95112 14.4882 3.22913 15.0412 3.73099C15.5941 4.23285 15.9405 4.92261 16.0126 5.66586L16.0267 5.95637V6.46526L20.4123 1.91934C20.9292 1.38325 21.6267 1.05817 22.3696 1.00708C23.1125 0.956001 23.8479 1.18256 24.4333 1.64285L24.6657 1.84521L30.1893 7.30472C30.7197 7.82899 31.0362 8.53173 31.0773 9.27635C31.1184 10.021 30.8812 10.7543 30.4117 11.3337L30.2054 11.5661L25.5753 15.9738H26.0441C26.7909 15.9738 27.5109 16.2518 28.0639 16.7537C28.6168 17.2555 28.9631 17.9453 29.0353 18.6886L29.0494 18.9791V27.9948C29.0494 28.7415 28.7714 29.4615 28.2695 30.0145C27.7676 30.5675 27.0779 30.9138 26.3346 30.986L26.0441 31H4.00572ZM14.0232 17.9773H3.00398V27.9948C3.00388 28.1993 3.06641 28.399 3.18317 28.567C3.29993 28.735 3.46533 28.8632 3.65712 28.9344L3.82541 28.9805L4.00572 28.9965H14.0232V17.9773ZM26.0441 17.9773H16.0267V28.9965H26.0441C26.2786 28.9966 26.5056 28.9144 26.6858 28.7643C26.8659 28.6142 26.9876 28.4057 27.0298 28.1751L27.0459 27.9948V18.9791C27.0459 18.7446 26.9638 18.5175 26.8137 18.3374C26.6636 18.1573 26.4551 18.0355 26.2244 17.9933L26.0441 17.9773ZM16.0267 12.3876V15.9738H19.6129L16.0267 12.3876ZM13.0214 4.95462H4.00572C3.77126 4.95455 3.5442 5.03671 3.36409 5.18681C3.18397 5.3369 3.06221 5.54542 3.02001 5.77605L3.00398 5.95637V15.9738H14.0232V5.95637C14.0233 5.75179 13.9607 5.55209 13.844 5.38411C13.7272 5.21613 13.5618 5.08792 13.37 5.01673L13.2017 4.97065L13.0214 4.95462ZM23.2833 3.29774C23.1148 3.13081 22.8929 3.02865 22.6565 3.00922C22.4202 2.9898 22.1845 3.05436 21.9911 3.19155L21.8548 3.31176L16.6137 8.74723C16.4555 8.91127 16.358 9.12433 16.3373 9.35125C16.3165 9.57817 16.3737 9.80539 16.4995 9.99541L16.6257 10.1517L21.8668 15.3908C22.0273 15.5515 22.2377 15.653 22.4634 15.6785C22.6891 15.7039 22.9167 15.652 23.109 15.531L23.2653 15.4088L28.7909 10.1457C28.9556 9.97892 29.0567 9.7597 29.0764 9.52614C29.0962 9.29259 29.0334 9.0595 28.8991 8.86744L28.7809 8.7292L23.2833 3.29774Z"})),O="https://launcher.arcblock.io",je=s=>{if(!s)return O;const{protocol:t,host:f}=le(ce(s));return`${t}//${f}`},we=s=>s?{"__did-connect__":re.from(JSON.stringify({switchBehavior:"auto",forceConnected:s,showClose:!1}),"utf8").toString("base64")}:{};function Re(s,t=O,f=""){const{t:_}=$(),E=we(f),{loading:u,value:p,error:a,retry:l}=ve(async()=>{if(s!=="serverless")return null;const y=je(t),L=await me(y),v=ie(n(L,"/u/apps"),E);return{text:_("launchBlocklet.nav.myApps"),appText:_("launchBlocklet.nav.viewMyApps"),link:v,buttonProps:{sx:{fontSize:"1rem"}},icon:e.jsx(X,{component:Se,fontSize:"small",viewBox:"0 0 32 32"})}},[s,t,f,_]);return s!=="serverless"||p===null?{}:u?{loading:!0}:a?{error:a,retry:l}:p||{}}const Ae=U.span`
|
|
3
|
-
color: ${s=>s.theme.palette.error.main};
|
|
4
|
-
&::before {
|
|
5
|
-
content: '*';
|
|
6
|
-
}
|
|
7
|
-
`,j=Ae,Ie=i.lazy(()=>m(()=>import("./connect-Cm-sTMiW.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]))),ke=i.lazy(()=>m(()=>import("./config-eQ2Et0RC.js"),__vite__mapDeps([12,1,2,3,6,5,7,8,13,14,15,16,17,9,10,11,18,19,20,21,22,23,24,25]))),Te=i.lazy(()=>m(()=>import("./index-D0F0qx_R.js"),__vite__mapDeps([26,1,2,6,3,5,7,8,20,9,10,11,27,28,29,30,31,32,23,24,21,22]))),Be=i.lazy(()=>m(()=>import("./domain-FY9-unAU.js"),__vite__mapDeps([33,1,2,9,6,3,5,7,8,10,11,34,35,36,37,38,4,39,31,40,41,42,43,44,45,46,47,48,20,25,21,22,23,24]))),Ne=i.lazy(()=>m(()=>import("./access-control-eEjmzQYf.js"),__vite__mapDeps([49,1,2,6,3,5,7,8,50,20,9,10,11,21,22,23,24,25]))),Ve=i.lazy(()=>m(()=>import("./fuel-CzrPInoR.js"),__vite__mapDeps([51,1,2,3,52,6,5,7,8,53,20,9,10,11,21,22,23,24,25]))),$e=i.lazy(()=>m(()=>import("./complete-D7dveRTo.js"),__vite__mapDeps([54,1,2,6,3,5,7,8,9,10,11,55,56,25,21,22,57,27,28,29,58,59,60,61])));function Ue(){var k,T,B;const s=G(),{t,locale:f}=$(),[_,E]=se(),u=ae(),{meta:p,blocklet:a,actions:l,loading:y,launcherSession:L}=fe(),v=localStorage.getItem("blocklet-server-url"),{session:w}=_e(),b=Pe({onClick:()=>{window.open(ye(v,{allowDomains:null}))}}),H=g("fromLauncher"),D=g("launcherUrl"),M=g("launchType"),R=g("visitorId"),z=Re(M,D,L==null?void 0:L.userDid);R&&(q(R),_.delete("visitorId"),E(_)),i.useEffect(()=>{Le(),w.user&&(l==null||l.refreshMeta(),l==null||l.refreshBlocklet({showError:!1}))},[w.user]),i.useEffect(()=>{l.refreshFuel({showError:!1})},[(k=a==null?void 0:a.meta)==null?void 0:k.did]);const o=`${N.WELLKNOWN_SERVICE_PATH_PREFIX}/setup`,F=c=>{var C;const r=(C=c==null?void 0:c.capabilities)==null?void 0:C.didSpace;return r?r===S.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED||r===S.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP?{key:"did-space",name:e.jsxs(e.Fragment,{children:[t("setup.steps.didSpace")," ",e.jsx(j,{})]}),path:n(o,"did-space")}:r===S.BLOCKLET_APP_SPACE_REQUIREMENT.OPTIONAL?{key:"did-space",name:e.jsx(e.Fragment,{children:t("setup.steps.didSpace")}),path:n(o,"did-space")}:(console.warn(`capabilities.didSpace cannot take the value ${r}`),null):null},d=[{key:"access",name:t("setup.steps.access"),path:n(o,"access")},{key:"domain",name:t("setup.domain.title"),path:n(o,"domain")},F(a),{key:"config",name:e.jsxs(e.Fragment,{children:[t("setup.steps.config")," ",xe(p)&&e.jsx(j,{})]}),path:n(o,"config")},(B=(T=p==null?void 0:p.requirements)==null?void 0:T.fuels)!=null&&B.length?{key:"fuel",name:e.jsxs(e.Fragment,{children:[t("setup.steps.fuel")," ",e.jsx(j,{})]}),path:n(o,"fuel")}:null].filter(Boolean),P=d.findIndex(c=>`${V.replace(/\/$/,"")}${o}/${c.key}`===window.location.pathname),Q=n(V,N.WELLKNOWN_SERVICE_PATH_PREFIX,`/blocklet/logo?v=${a==null?void 0:a.updatedAt}`),W=async c=>{const{search:r}=new URL(window.location.href);if(!c)d[P+1]?u(`${n(o,d[P+1].key)}${r}`):u(`${n(o,"complete")}${r}`);else{const C=d.findIndex(K=>K.key===c);C>-1?u(`${n(o,d[C].key)}${r}`):u(`${n(o,"complete")}${r}`)}await l.refreshBlocklet()},Z=()=>{u(-1)};function x(c,r){return e.jsxs(Ie,{children:[!a&&e.jsx(Y,{width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center",children:e.jsx(ee,{})}),a&&e.jsx(c,{blocklet:a,...r,onNext:W,onPrevious:Z,buttonText:P===d.length-1?t("setup.startNow"):""})]})}const A=[{key:"install",name:t("launchBlocklet.steps.installApp"),path:n(o,"install")},{key:"setup",name:t("setup.steps.launchApp"),children:d}];let I=[{key:"agreement",name:t("launchBlocklet.introduction"),path:n(o,"agreement")},...A];return H&&(I=[{key:"purchase-space",name:t("launchBlocklet.steps.purchaseSpace")},{key:"prepare-space",name:t("launchBlocklet.steps.prepareSpace")},...A]),e.jsx(de,{steps:I,children:e.jsx(Ce,{children:e.jsxs(pe,{children:[e.jsx(J,{styles:Oe}),e.jsx(be,{children:e.jsx(he,{locale:f,loading:y,blockletMeta:{...p,title:ge.getDisplayName({...a,meta:p})},navLogo:b,pcWidth:"80%",style:{height:"100%"},logoUrl:Q,useOfSkeleton:!1,extraNav:z,headerEndAddons:e.jsx(ue,{SessionContext:Ee,sessionManagerProps:{disableLogout:!0}}),theme:s,launchingText:t("setup.title"),children:e.jsxs(ne,{children:[e.jsx(h,{path:"access",element:x(Ne)}),e.jsx(h,{path:"domain",element:x(Be)}),e.jsx(h,{path:"did-space",element:x(Te)}),e.jsx(h,{path:"config",element:x(ke)}),e.jsx(h,{path:"fuel",element:x(Ve)}),e.jsx(h,{path:"complete",element:x($e,{launcherSession:L})}),e.jsx(h,{path:"*",element:e.jsx(oe,{to:`access${window.location.search}`,replace:!0})})]})})})]})})})}const Oe=te`
|
|
8
|
-
html,
|
|
9
|
-
body,
|
|
10
|
-
#app,
|
|
11
|
-
#app > .wrapper {
|
|
12
|
-
height: 100%;
|
|
13
|
-
}
|
|
14
|
-
`,be=U("div")`
|
|
15
|
-
/* display: flex;
|
|
16
|
-
min-width: 0;
|
|
17
|
-
flex: 1 1 0; */
|
|
18
|
-
height: 100%;
|
|
19
|
-
|
|
20
|
-
& .layout-content {
|
|
21
|
-
min-width: 0;
|
|
22
|
-
flex: 1 1 0;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
& .ll-header {
|
|
26
|
-
@media (max-width: 960px) {
|
|
27
|
-
padding: 0 12px;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
`,Ge=Object.freeze(Object.defineProperty({__proto__:null,default:Ue},Symbol.toStringTag,{value:"Module"}));export{we as a,je as g,Ge as s};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{z as A}from"./vendor-hooks-BgUTpb6X.js";import{r as d}from"./vendor-react-DEoibe3W.js";var q={},f={},o={},M;function R(){if(M)return o;M=1,Object.defineProperty(o,"__esModule",{value:!0});var e=d;function r(){var t=e.useRef(!1),a=e.useCallback(function(){return t.current},[]);return e.useEffect(function(){return t.current=!0,function(){t.current=!1}},[]),a}return o.default=r,o}var p;function $(){if(p)return f;p=1,Object.defineProperty(f,"__esModule",{value:!0});var e=A,r=d,t=e.__importDefault(R());function a(n,c,l){c===void 0&&(c=[]),l===void 0&&(l={loading:!1});var i=r.useRef(0),_=t.default(),g=r.useState(l),y=g[0],v=g[1],F=r.useCallback(function(){for(var b=[],s=0;s<arguments.length;s++)b[s]=arguments[s];var m=++i.current;return y.loading||v(function(u){return e.__assign(e.__assign({},u),{loading:!0})}),n.apply(void 0,b).then(function(u){return _()&&m===i.current&&v({value:u,loading:!1}),u},function(u){return _()&&m===i.current&&v({error:u,loading:!1}),u})},c);return[y,F]}return f.default=a,f}Object.defineProperty(q,"__esModule",{value:!0});var h=A,k=d,S=h.__importDefault($());function U(e,r){r===void 0&&(r=[]);var t=S.default(e,r,{loading:!0}),a=t[0],n=t[1];return k.useEffect(function(){n()},[n]),a}var E=q.default=U;export{E as _,q as u};
|