@abtnode/blocklet-services 1.16.52 → 1.16.53-beta-20251009-113612-7a16b6a0
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/dist/assets/{access-control-DmggL7jZ.js → access-control-CTocOnrY.js} +1 -1
- package/dist/assets/{add-component-core-DWKb11rZ.js → add-component-core-ChMhkX_e.js} +1 -1
- package/dist/assets/{add-resource-CIE_Ytx_.js → add-resource-BQMxE4TR.js} +1 -1
- package/dist/assets/{addon-DHl2cxRr.js → addon-B1SOMf-o.js} +1 -1
- package/dist/assets/{advanced-BSm5CLLg.js → advanced-BeUvs5a-.js} +1 -1
- package/dist/assets/{aigne-BaADN_Ge.js → aigne-BFbK-Dx1.js} +1 -1
- package/dist/assets/{appearance-BUZooc3t.js → appearance-BjJHVOrD.js} +1 -1
- package/dist/assets/{arrow-down.svg-Di8Y-JsX.js → arrow-down.svg-CnYWDYHP.js} +1 -1
- package/dist/assets/{audit-logs-eECPB5oA.js → audit-logs-CYyFSo7D.js} +1 -1
- package/dist/assets/{authorize-0PkXj9UT.js → authorize-C9NR3hcn.js} +1 -1
- package/dist/assets/{bind-account-DP1UFrvX.js → bind-account-EzHCVNcL.js} +1 -1
- package/dist/assets/{branding-CAzTSYks.js → branding-C6k_gnic.js} +1 -1
- package/dist/assets/{branding-BkGIm8P3.js → branding-D14MEcTS.js} +1 -1
- package/dist/assets/{branding-CbllXHP7.js → branding-iucefL5d.js} +1 -1
- package/dist/assets/{bundle-avatar-sZTyiJPk.js → bundle-avatar-Bbip6Pw_.js} +1 -1
- package/dist/assets/{complete-mBrYJnVB.js → complete-DBBI-G-v.js} +1 -1
- package/dist/assets/{component-CnoEGL3c.js → component-BuKDir1W.js} +2 -2
- package/dist/assets/{config-C75mhsiC.js → config-B7yZVsVx.js} +1 -1
- package/dist/assets/{config-xHTw-lTo.js → config-CGESXcGy.js} +1 -1
- package/dist/assets/{config-navigation-DWOLS3z9.js → config-navigation-Ci4sw2Mg.js} +2 -2
- package/dist/assets/{config-space-BhJD7jRS.js → config-space-CIxZdD1U.js} +1 -1
- package/dist/assets/{config-Bkb5q4ut.js → config-uTQPBtNY.js} +1 -1
- package/dist/assets/{confirm-CbKYjtHR.js → confirm-CRSsToIg.js} +1 -1
- package/dist/assets/{connect--3Rc5BLv.js → connect-BA-e5Sky.js} +1 -1
- package/dist/assets/{connect-2JyiC0Xu.js → connect-D_SRcELW.js} +1 -1
- package/dist/assets/{connect-to-jAGN3h14.js → connect-to-DPxJtWAi.js} +1 -1
- package/dist/assets/{dashboard-Bl5ef4iX.js → dashboard-CdEA39BJ.js} +2 -2
- package/dist/assets/{delete-confirm-DwRy8bv4.js → delete-confirm-BOL7KX0x.js} +1 -1
- package/dist/assets/{domain-BRz6giPY.js → domain-C02xJ2j2.js} +1 -1
- package/dist/assets/{domain-action-card-BkD9wIWF.js → domain-action-card-BYDa5XpT.js} +1 -1
- package/dist/assets/{domains-CNFr3aJ9.js → domains-CeH-Is8l.js} +1 -1
- package/dist/assets/{email-CeJztQEY.js → email-CgqDRKYJ.js} +1 -1
- package/dist/assets/engine-Dde2jLpF.js +1 -0
- package/dist/assets/{exchange-passport-gkmIW3RX.js → exchange-passport-SXEaleiF.js} +1 -1
- package/dist/assets/{form-Dv0kmMaX.js → form-kOntOXIX.js} +1 -1
- package/dist/assets/{fuel-CUYeoZDd.js → fuel-DvIA5Tre.js} +1 -1
- package/dist/assets/{gen-access-key-SE9pLi9q.js → gen-access-key-D6gAc7bG.js} +1 -1
- package/dist/assets/{gen-simple-access-key-CSKqRGTV.js → gen-simple-access-key-BfvI0i1-.js} +1 -1
- package/dist/assets/{get-safe-url-sB_Gq16A.js → get-safe-url-BVWVLDco.js} +1 -1
- package/dist/assets/{home-BnT7J-uf.js → home-Bbu96BmU.js} +1 -1
- package/dist/assets/{iframe-DsSE-oEM.js → iframe-B-WaBiaG.js} +1 -1
- package/dist/assets/{index-PgN3JS_8.js → index-B0HVlpUv.js} +1 -1
- package/dist/assets/{index-CM4RAJ4n.js → index-B5ctIRcA.js} +1 -1
- package/dist/assets/{index-BcQQWjIN.js → index-B9UOYoTi.js} +1 -1
- package/dist/assets/{index-BEC672yJ.js → index-BPjsO-fA.js} +1 -1
- package/dist/assets/{index-CgGF98-I.js → index-BWkRqWUV.js} +1 -1
- package/dist/assets/{index-DZsbm1LJ.js → index-Bne2IVDb.js} +2 -2
- package/dist/assets/{index-DmYn3vUs.js → index-BqNVAj3b.js} +1 -1
- package/dist/assets/{index-BtpIrTNZ.js → index-BtyqZ8ix.js} +1 -1
- package/dist/assets/{index-BMQaM_ON.js → index-BwK-dbsY.js} +1 -1
- package/dist/assets/{index-0863PXVJ.js → index-C5weIh5R.js} +4 -4
- package/dist/assets/{index-C3yfW-2l.js → index-CCGTCthU.js} +1 -1
- package/dist/assets/{index-3WoNnYUW.js → index-CW83LAem.js} +1 -1
- package/dist/assets/{index-UrBf_SB9.js → index-ChG9_ZZV.js} +1 -1
- package/dist/assets/{index-BPURBp6_.js → index-CsM_pYF8.js} +1 -1
- package/dist/assets/{index-DvDgqPNe.js → index-CuH2SZN0.js} +1 -1
- package/dist/assets/{index-Dy8Kzeqi.js → index-Czh1GNRc.js} +1 -1
- package/dist/assets/{index-gv-XKOxx.js → index-DI0tEMGN.js} +1 -1
- package/dist/assets/{index-WBm9SNDx.js → index-DeWjB4q9.js} +1 -1
- package/dist/assets/{index-Cn4da4ZP.js → index-Dn2h6APz.js} +1 -1
- package/dist/assets/{index-mXteQQPA.js → index-DtY0rQzd.js} +3 -3
- package/dist/assets/{index-2fKHLT0z.js → index-EE_leCro.js} +1 -1
- package/dist/assets/{index-CKsdJhzZ.js → index-KhL4--33.js} +1 -1
- package/dist/assets/{index-B6_ijjdG.js → index-MSxXwe2g.js} +1 -1
- package/dist/assets/{index-C8Q2YcwS.js → index-MjpHZ4K2.js} +1 -1
- package/dist/assets/{index-CMvQOzZf.js → index-pSrG3Rtm.js} +1 -1
- package/dist/assets/{index-B5D1W27l.js → index-yyZ56Avq.js} +1 -1
- package/dist/assets/{invitation-D8EnCl9v.js → invitation-DvFWKTOM.js} +1 -1
- package/dist/assets/{invitations-CRg01RPR.js → invitations-CD5qt7h8.js} +1 -1
- package/dist/assets/{invite-62TCTCVU.js → invite-CMqMLqon.js} +1 -1
- package/dist/assets/{isURL-DbBjhWuw.js → isURL-Drc7oe8g.js} +1 -1
- package/dist/assets/{issue-passport-hXFTyGgX.js → issue-passport-BR40SDVR.js} +1 -1
- package/dist/assets/{item-BJo9HqUj.js → item-DwykRAIj.js} +1 -1
- package/dist/assets/{landing-page-CC5bHMck.js → landing-page-BTu1Wo51.js} +1 -1
- package/dist/assets/{layout-ByznRMFd.js → layout-_Ka_GN5x.js} +1 -1
- package/dist/assets/{list-Bx2-rBf0.js → list-C4b_Znkz.js} +1 -1
- package/dist/assets/{list-9Jqi3lQE.js → list-TG9HMVa3.js} +1 -1
- package/dist/assets/{localization-CFDfUyEy.js → localization-CqBu9Ts-.js} +1 -1
- package/dist/assets/{log-DCvCOn17.js → log-BFOgPn13.js} +1 -1
- package/dist/assets/{login-f_fCkRk4.js → login-CUoIcXNe.js} +1 -1
- package/dist/assets/{login-oauth-callback-C24AF8iv.js → login-oauth-callback-BuNQ-CRv.js} +1 -1
- package/dist/assets/{logo-uploader-lmGtrzV4.js → logo-uploader-l9C8sEUo.js} +1 -1
- package/dist/assets/{lost-passport-Dswad9ou.js → lost-passport-lnqu8OpR.js} +1 -1
- package/dist/assets/{open-window-DarxerYh.js → open-window-B52q5qrk.js} +1 -1
- package/dist/assets/{over-due-invoice-payment-Bof_qZPj.js → over-due-invoice-payment-DKbbN5W7.js} +1 -1
- package/dist/assets/{overview-3AanlBU3.js → overview-BITUbq3E.js} +1 -1
- package/dist/assets/{passport-NHswVCpX.js → passport-WPJBoZJA.js} +1 -1
- package/dist/assets/{passport-item-CIkdGD7k.js → passport-item-gIxDDwjF.js} +1 -1
- package/dist/assets/{permission-C6ZxgW4_.js → permission-BeGf253a.js} +1 -1
- package/dist/assets/{preferences-c_uf0vV_.js → preferences-D0Ol69r8.js} +1 -1
- package/dist/assets/{profile-embed-zfqLFKjJ.js → profile-embed-YGIFeQVj.js} +1 -1
- package/dist/assets/{publish-resource-C-rSUOye.js → publish-resource-fDNwoZVu.js} +1 -1
- package/dist/assets/{runtime-C43nnM4D.js → runtime-DPpYl0V4.js} +1 -1
- package/dist/assets/sdk-Jn7q4_AB.js +1 -0
- package/dist/assets/{security-DrN96KLp.js → security-Jp9VavjR.js} +1 -1
- package/dist/assets/{session-BU5Mzwxi.js → session-DEBZccHT.js} +1 -1
- package/dist/assets/{setup-Boeg5oQO.js → setup-3SRIuMWN.js} +1 -1
- package/dist/assets/{spaces-DOKeNRJF.js → spaces-_v4BsoCo.js} +1 -1
- package/dist/assets/{start-D12bNg0Z.js → start-BaF8jQQs.js} +1 -1
- package/dist/assets/{starting-progress-CCgq7_fl.js → starting-progress-Bdr1122s.js} +1 -1
- package/dist/assets/{status-q9lLrXQc.js → status-Kru479eT.js} +1 -1
- package/dist/assets/{step-actions-q6EMp_pM.js → step-actions-z2PSGmvy.js} +1 -1
- package/dist/assets/{studio-Cwi9XV2J.js → studio-C8Cis2HF.js} +1 -1
- package/dist/assets/{team-8eI9KzkS.js → team-DjK1LiLV.js} +1 -1
- package/dist/assets/{traffic-C-k1EeLv.js → traffic-CxwOXUbM.js} +1 -1
- package/dist/assets/{transfer-DkQcWtDu.js → transfer-M0yRAOWx.js} +1 -1
- package/dist/assets/{unsubscribe-DEQjVih1.js → unsubscribe-CULX4z09.js} +1 -1
- package/dist/assets/{use-app-logo-CPtVQ5QR.js → use-app-logo-BOmNYQgU.js} +1 -1
- package/dist/assets/{user-center-Bi3mP5L8.js → user-center-1elUCI9j.js} +2 -2
- package/dist/assets/{user-follower-ov8u2bSJ.js → user-follower-CYu4VkvK.js} +1 -1
- package/dist/assets/{user-sessions-CgEW_AWu.js → user-sessions-B_eqpmUt.js} +1 -1
- package/dist/assets/{util-6epwbzsz.js → util-DUiP0chO.js} +1 -1
- package/dist/assets/{util-D8_x37fq.js → util-DY1uHmM4.js} +1 -1
- package/dist/assets/{wait-connect-BAJddb0h.js → wait-connect-DMl1x3Ld.js} +1 -1
- package/dist/assets/{wizard-hHM4x0st.js → wizard-Cq7OgF_R.js} +1 -1
- package/dist/assets/{wizard-components-B_tklig-.js → wizard-components-CseIhcl0.js} +1 -1
- package/dist/assets/{wrap-locale-DAwNWfLv.js → wrap-locale-DtJXVWeM.js} +1 -1
- package/dist/assets/{zh-CNEGT1hb.js → zh-DS2mQXmf.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/service-worker.js +1 -1
- package/package.json +23 -23
- package/dist/assets/engine-B4S5pKzm.js +0 -1
- package/dist/assets/sdk-CJ48BTlZ.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[window.__toCdnUrl("assets/vendor-ux-DYcPPYq2.css"),window.__toCdnUrl("assets/index-DrVXX4fX.css"),window.__toCdnUrl("assets/index-gnjjKJuC.css"),window.__toCdnUrl("assets/add-component-core-G0iZE90Q.css")])))=>i.map(i=>d[i]);
|
|
2
|
-
import{c as tn,n as ht,H as F,T as B,aG as nn,aH as wo,a3 as So,M as on,P as rn,E as Et,w as jo,p as Co,k as ko,_}from"./vendor-ux-B9VfuZTg.js";import{j as i,W as S,aZ as Eo,cN as Io,d4 as _o,bb as To,dh as Lo,di as Do,cP as Ao,dj as Po,d8 as Ro,dk as Mo,I as Ne,aQ as Oo,aR as No,aX as gt,a3 as Uo,M as Bo,aO as zo,a6 as V,aP as $o,bi as Fo,at as Ue,T as ee,bq as Vo,b6 as It,br as _t,ak as I,D as pe,J as re,ah as Be,ao as Ho,dl as Wo,aj as qo,dm as sn,dn as an,dp as cn,am as de,a$ as _e,dq as Tt,U as Q,aN as ln,Y as un,b_ as Ko,dr as Go,ds as Qo,Q as Zo,dt as Xo}from"./vendor-mui-core-DRxbhqaK.js";import{r as m,L as dn,i as fn,g as Jo,k as Yo,j as er}from"./vendor-react-Dvs43sk9.js";import{X as ze,e as P,V as qe,am as Ke,c as R,W as Lt,bC as tr,$ as nr,a9 as or,t as rr,bD as sr,bE as pn,_ as te,bF as mn,aL as ir,bG as ar,U as cr,b2 as lr,b3 as ur,bH as dr,b4 as fr,bI as pr,bJ as mr,al as hr,bK as Ge,bL as gr,bM as br,b1 as xr,a as hn,B as gn,l as me,a7 as yr,k as vr,ab as wr,m as Dt,bN as At,h as Sr,j as jr,q as Cr,o as ie,n as kr,p as Er,P as Ir,G as _r,N as Tr,bv as Lr,Z as Dr,r as Ar}from"./index-0863PXVJ.js";import{aa as Pr,C as W,J as bn,Q as Rr,e as Mr}from"./vendor-utils-CUDP56Ff.js";import{o as Ae}from"./vendor-arcblock-DeeG8u0h.js";import{u as Pt}from"./useLocalStorage-BtAV-lV2.js";import{f as bt}from"./index-DBs9Ljax.js";import{C as Rt}from"./confirm-CbKYjtHR.js";import{g as Mt}from"./get-safe-url-sB_Gq16A.js";import{u as xn}from"./session-BU5Mzwxi.js";import{a as ne,l as Or}from"./vendor-hooks-BlA8TRnZ.js";import{j as Nr,b as Ur,M as Br,a as zr,T as $r,N as Fr}from"./team-8eI9KzkS.js";import{c as Ot}from"./passport-NHswVCpX.js";import{D as Vr,u as yn}from"./useAsyncRetry-EEjDgDMR.js";import{u as vn}from"./useSetState-DFuQZPPV.js";import{x as Hr,d as Wr}from"./index-CKsdJhzZ.js";import{O as qr}from"./over-due-invoice-payment-Bof_qZPj.js";import{u as Kr}from"./use-mobile-D6YQgajG.js";const wn=m.createContext({});function Sn({children:e,type:t="blocklets"}){const[n,r]=m.useState([]),o=m.useRef([]),s=l=>{if(!o.current.includes(l)){const u=[...o.current,l];r(u),o.current=u}},a=l=>{if(o.current.includes(l)){const u=o.current.filter(d=>d!==l);r(u),o.current=u}},c=l=>{const u=n.filter(p=>l.find(f=>f===p));Pr(u,n).forEach(p=>a(p))};return i.jsx(wn.Provider,{value:{type:t,deletingBlocklets:n,addDeletingDid:s,removeDeletingDid:a,matchDeletingDid:c},children:e})}Sn.propTypes={type:S.string,children:S.node.isRequired};function ec(){return m.useContext(wn)}const Gr=e=>m.createElement("svg",{width:32,height:32,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},m.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.32989 8.20744C11.2787 6.82349 13.6098 6.08 16 6.08C18.3902 6.08 20.7213 6.82349 22.6701 8.20744C24.6189 9.59139 26.089 11.5473 26.8766 13.804C27.6642 16.0607 27.7304 18.5066 27.0659 20.8026C26.4419 22.9587 25.2026 24.8823 23.5044 26.3404H8.49555C6.79735 24.8823 5.55809 22.9587 4.9341 20.8026C4.26961 18.5066 4.33575 16.0607 5.12337 13.804C5.91098 11.5473 7.38107 9.59139 9.32989 8.20744ZM16 3.52C13.0786 3.52 10.2295 4.42871 7.84764 6.1202C5.46575 7.81169 3.66898 10.2022 2.70634 12.9604C1.7437 15.7187 1.66286 18.708 2.47501 21.5143C3.28717 24.3205 4.95211 26.8046 7.23909 28.6224C7.46554 28.8024 7.74628 28.9004 8.03554 28.9004H23.9644C24.2537 28.9004 24.5344 28.8024 24.7609 28.6224C27.0479 26.8046 28.7128 24.3205 29.5249 21.5143C30.3371 18.708 30.2563 15.7187 29.2936 12.9604C28.331 10.2022 26.5342 7.81169 24.1523 6.1202C21.7704 4.42871 18.9214 3.52 16 3.52ZM21.8829 13.5921C22.3827 13.0923 22.3827 12.2818 21.8829 11.7819C21.383 11.2821 20.5725 11.2821 20.0727 11.7819L17.868 13.9866C17.3072 13.7012 16.6724 13.5404 16 13.5404C13.7221 13.5404 11.8755 15.3869 11.8755 17.6648C11.8755 19.9427 13.7221 21.7892 16 21.7892C18.2779 21.7892 20.1244 19.9427 20.1244 17.6648C20.1244 16.9924 19.9635 16.3576 19.6782 15.7968L21.8829 13.5921ZM14.4355 17.6648C14.4355 16.8008 15.136 16.1004 16 16.1004C16.864 16.1004 17.5644 16.8008 17.5644 17.6648C17.5644 18.5288 16.864 19.2292 16 19.2292C15.136 19.2292 14.4355 18.5288 14.4355 17.6648Z",fill:"currentColor"})),Y={Start:Eo,Stop:Io,Restart:_o,Reload:Mo,Remove:To,Config:Ro,Log:Po,Group:Ao,Cancel:Lo,Dashboard:Gr,Overview:Do},Qr=(e,t)=>{if(!e)return"";if(!t)return e;const n=new URL(e),r=new URLSearchParams(n.searchParams),o=new URL(W(n.origin,t));return o.search=r.toString(),o.toString()},Zr="internal",Xr="external";function jn({blocklet:e,onStart:t,onComplete:n,variant:r="menu",hasPermission:o=!1,getComponentUrl:s=null,useBlockletUrlEvaluation:a=()=>({loading:!1,recommendedUrl:window?.location?.href}),...c}){const l=ze(),[u,d]=m.useState(null),[p,f]=m.useState(null),[b,y]=m.useState(!1),[h,C]=m.useState(null),{t:v}=m.useContext(tn),[j]=Pt("skip-blocklet-setup",!1),{loading:g,recommendedUrl:E}=a(e),[k]=Pt("blocklet-type-filter",Zr),x=P.isInProgress(e.status),[T,O]=m.useState(!1);m.useEffect(()=>{if(!e?.controller)return;O(e?.controller?.status?.value===qe.BLOCKLET_CONTROLLER_STATUS.suspended),(async()=>{try{const D=await l.api.getLauncherSession({input:{launcherSessionId:e?.controller?.launcherSessionId,launcherUrl:e?.controller?.launcherUrl}});if(D?.error){console.error("get launcher session failed",D.error);return}O([R.LAUNCH_SESSION_STATUS.overdue,R.LAUNCH_SESSION_STATUS.canceled,R.LAUNCH_SESSION_STATUS.terminated].includes(D?.launcherSession?.status))}catch(D){console.error("call getLauncherSession error",D)}})()},[]);const{inService:M}=l,N=(w,D,K=!1)=>async()=>{const G=async Se=>{t({action:w,blocklet:e}),y(!0),f(w);let je=!1;try{if(w==="remove")await D(Se);else if(w==="start"){if(!P.hasRunnableComponent(e)){F.error(v("blocklet.noComponent"));return}if(!M&&!j&&!e.settings?.initialized&&e.mode!==qe.BLOCKLET_MODES.DEVELOPMENT){if(!E||!Lt(E)){F.error(v("blocklet.gotoVisitError"));return}const U=tr(l.info),kt=new URL(E);kt.searchParams.set("serverUrl",U),window.open(Mt(kt.href,{allowDomains:null})),n({action:w,blocklet:e});return}const $=e.children.filter(U=>!P.isInProgress(U.status)&&U.status!=="running"||!P.isInProgress(U.greenStatus)&&U.greenStatus!=="running").map(U=>U.meta.did),J={did:e.meta.did,componentDids:$};await D({input:J})}else if(["stop","restart","reload"].includes(w)){const $=e.children.filter(U=>P.isDeletableBlocklet(U)).map(U=>U.meta.did),J={did:e.meta.did,componentDids:$};await D({input:J})}else{const $={did:e.meta.did};await D({input:$})}w==="remove"?je=!0:await nr(1e3),w==="reload"&&F.success(v("blocklet.reloadSuccess")),C(null),n({action:w,blocklet:e})}catch($){const J=`Blocklet ${w} failed: ${bt($)}`;throw n({action:w,blocklet:e,error:new Error(J)}),new Error(J)}finally{je||y(!1)}},ve=()=>{y(!1),C(null)},we=P.getDisplayName(e,!0),yo=e.mode===qe.BLOCKLET_MODES.DEVELOPMENT?{description:()=>i.jsx(ee,{component:"div",children:i.jsx(ee,{gutterBottom:!0,children:v("blocklet.action.removeApplicationDescription")})}),params:{removeType:"complete"}}:{description:(Se,je)=>i.jsxs(ee,{component:"div",children:[i.jsx(ee,{gutterBottom:!0,children:v("blocklet.action.removeApplicationDescription")}),i.jsxs(Vo,{name:"removeType",value:Se.removeType,onChange:$=>je({...Se,removeType:$.target.value}),children:[i.jsx(It,{value:"backup",control:i.jsx(_t,{}),label:v("blocklet.action.removeApplicationAfterBackup")}),i.jsx(It,{value:"complete",control:i.jsx(_t,{}),label:v("blocklet.action.removeApplicationComplete")})]})]}),params:{removeType:"backup"}},vo={stop:{title:`${v("common.stop")} ${we}`,description:v("blocklet.action.stopDescription"),confirm:v("blocklet.action.confirmStop"),cancel:v("common.cancel"),onConfirm:G,onCancel:ve},restart:{title:`${v("common.restart")} ${we}`,description:v("blocklet.action.restartDescription"),confirm:v("blocklet.action.confirmRestart"),cancel:v("common.cancel"),onConfirm:G,onCancel:ve},remove:{title:`${v("common.remove")} ${we}`,confirm:v("blocklet.action.confirmRemove"),cancel:v("common.cancel"),onConfirm:G,onCancel:ve,...yo},cancelDownload:{title:`${v("common.cancel")}`,description:v("blocklet.action.cancelDownloadDescription",{name:we}),confirm:v("common.confirm"),cancel:v("common.cancel"),onConfirm:G,onCancel:ve}};K?C(vo[w]):await G()},We=!!u,po=w=>{try{w.stopPropagation(),w.preventDefault()}catch{}d(w.currentTarget)},mo=w=>{try{w.stopPropagation(),w.preventDefault()}catch{}d(null)},Ct=async(w,D)=>{try{D.stopPropagation(),D.preventDefault()}catch{}if(typeof w.handler=="function")try{y(!0),f(w.action),await w.handler()}catch(K){console.error(`Blocklet ${w.name} failed: `,K)}finally{y(!1),d(null)}else d(null)},ho=!M&&P.isDeletableBlocklet(e)?{action:"remove",icon:Y.Remove,name:v("common.remove"),handler:N("remove",async({removeType:w})=>{w==="backup"&&await l.api.backupBlocklet({input:{appDid:e.appDid,to:"disk"}}),await l.api.deleteBlocklet({input:{did:e.meta.did,keepData:!1}})},!0),disabled:x}:null,go={action:"remove",icon:({sx:w,...D})=>i.jsx(Y.Cancel,{sx:{...w,paddingRight:"2px",zoom:.95},...D}),name:v("common.cancel"),handler:N("cancelDownload",l.api.cancelDownloadBlocklet,!0)},bo=P.getAppMissingConfigs(e),xo=()=>{const w=`/${e.mountPoint||"/"}`.replace(/\/+/g,"/"),D=s?.({mountPoint:w,blocklet:e});if(!D||!Lt(D)){F.error(v("blocklet.gotoVisitError"));return}const K=e?.site?.domainAliases;window.open(Mt(Qr(D,`${R.WELLKNOWN_SERVICE_PATH_PREFIX}/admin`),{allowDomains:K?.map(G=>G.value)}))};let ye=[{action:"start",icon:Y.Start,inExternal:!0,name:v("common.start"),handler:N("start",l.api.startBlocklet),disabled:T||e.children.every(w=>P.isBlockletRunning(w))||Ke(e.status)||g||x},{action:"stop",icon:Y.Stop,inExternal:!0,name:v("common.stop"),handler:N("stop",l.api.stopBlocklet,!0),disabled:!["running","starting"].includes(e.status)},{action:"restart",inExternal:!0,icon:Y.Restart,name:v("common.restart"),handler:N("restart",l.api.restartBlocklet,!0),disabled:T||e.status!=="running"},Ke(e.status)?go:ho,{separator:!0},M?null:{action:"dashboard",icon:({style:w,...D})=>i.jsx(Y.Dashboard,{...D,style:{...w,width:"26px",height:"26px",paddingRight:"3px"}}),name:v("sidebar.dashboard"),handler:xo}].filter(Boolean);return k===Xr&&(ye=ye.filter(w=>w.inExternal)),r==="menu"?i.jsxs(Nt,{"data-cy":"blocklet-actions",children:[i.jsx(Ne,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions","actions-blocklet-did":e.meta.did,onClick:po,size:"small",disabled:!o||!Ke(e.status)&&b,children:i.jsx(Oo,{})}),i.jsxs(No,{id:"actions-menu",anchorEl:u,keepMounted:!0,open:We,onClose:mo,PaperProps:{},children:[bo.length>0&&i.jsxs(gt,{style:{maxWidth:"400px"},severity:"error",children:[v("blocklet.config.missingRequired"),i.jsx("br",{}),i.jsx(dn,{to:`/blocklets/${e.meta.did}/components`,children:v("blocklet.config.gotoFix")})]}),ye.map((w,D)=>w.separator?i.jsx(Uo,{},`separator-${D}`):i.jsxs(Bo,{dense:!0,onClick:K=>Ct(w,K),disabled:b||w.disabled,"data-cy":`${w.action}-blocklet`,children:[i.jsx(zo,{style:{minWidth:24},children:p===w.action&&b?i.jsx(V,{size:16,sx:{marginRight:1}}):i.jsx(w.icon,{fontSize:"small"})}),i.jsx($o,{primary:w.name})]},w.name))]}),h&&i.jsx(Rt,{title:h.title,description:h.description,confirm:h.confirm,cancel:h.cancel,params:h.params,onConfirm:h.onConfirm,onCancel:h.onCancel})]}):i.jsxs(Nt,{"data-cy":"blocklet-actions",...c,children:[i.jsx(Fo,{children:ye.filter(w=>!w.separator&&!w.onlyInMenu).map(w=>i.jsxs(ht,{title:w.name,"data-cy":`${w.action}-blocklet`,onClick:()=>Ct(w),disabled:!!w.disabled||b,children:[p===w.action&&b?i.jsx(V,{size:16,sx:{marginRight:1}}):i.jsx(w.icon,{}),i.jsx("span",{className:"blocklet-action-text",children:w.name})]},w.name))}),h&&i.jsx(Rt,{title:h.title,description:h.description,confirm:h.confirm,cancel:h.cancel,params:h.params,onConfirm:h.onConfirm,onCancel:h.onCancel})]})}jn.propTypes={getComponentUrl:S.func,blocklet:S.object.isRequired,onStart:S.func.isRequired,onComplete:S.func.isRequired,variant:S.oneOf(["menu","group"]),hasPermission:S.bool,useBlockletUrlEvaluation:S.func};const Nt=Ue.div`
|
|
2
|
+
import{c as tn,n as ht,H as F,T as B,aG as nn,aH as wo,a3 as So,M as on,P as rn,E as Et,w as jo,p as Co,k as ko,_}from"./vendor-ux-B9VfuZTg.js";import{j as i,W as S,aZ as Eo,cN as Io,d4 as _o,bb as To,dh as Lo,di as Do,cP as Ao,dj as Po,d8 as Ro,dk as Mo,I as Ne,aQ as Oo,aR as No,aX as gt,a3 as Uo,M as Bo,aO as zo,a6 as V,aP as $o,bi as Fo,at as Ue,T as ee,bq as Vo,b6 as It,br as _t,ak as I,D as pe,J as re,ah as Be,ao as Ho,dl as Wo,aj as qo,dm as sn,dn as an,dp as cn,am as de,a$ as _e,dq as Tt,U as Q,aN as ln,Y as un,b_ as Ko,dr as Go,ds as Qo,Q as Zo,dt as Xo}from"./vendor-mui-core-DRxbhqaK.js";import{r as m,L as dn,i as fn,g as Jo,k as Yo,j as er}from"./vendor-react-Dvs43sk9.js";import{X as ze,e as P,V as qe,am as Ke,c as R,W as Lt,bC as tr,$ as nr,a9 as or,t as rr,bD as sr,bE as pn,_ as te,bF as mn,aL as ir,bG as ar,U as cr,b2 as lr,b3 as ur,bH as dr,b4 as fr,bI as pr,bJ as mr,al as hr,bK as Ge,bL as gr,bM as br,b1 as xr,a as hn,B as gn,l as me,a7 as yr,k as vr,ab as wr,m as Dt,bN as At,h as Sr,j as jr,q as Cr,o as ie,n as kr,p as Er,P as Ir,G as _r,N as Tr,bv as Lr,Z as Dr,r as Ar}from"./index-C5weIh5R.js";import{aa as Pr,C as W,J as bn,Q as Rr,e as Mr}from"./vendor-utils-CUDP56Ff.js";import{o as Ae}from"./vendor-arcblock-DeeG8u0h.js";import{u as Pt}from"./useLocalStorage-BtAV-lV2.js";import{f as bt}from"./index-DBs9Ljax.js";import{C as Rt}from"./confirm-CRSsToIg.js";import{g as Mt}from"./get-safe-url-BVWVLDco.js";import{u as xn}from"./session-DEBZccHT.js";import{a as ne,l as Or}from"./vendor-hooks-BlA8TRnZ.js";import{j as Nr,b as Ur,M as Br,a as zr,T as $r,N as Fr}from"./team-DjK1LiLV.js";import{c as Ot}from"./passport-WPJBoZJA.js";import{D as Vr,u as yn}from"./useAsyncRetry-EEjDgDMR.js";import{u as vn}from"./useSetState-DFuQZPPV.js";import{x as Hr,d as Wr}from"./index-KhL4--33.js";import{O as qr}from"./over-due-invoice-payment-DKbbN5W7.js";import{u as Kr}from"./use-mobile-D6YQgajG.js";const wn=m.createContext({});function Sn({children:e,type:t="blocklets"}){const[n,r]=m.useState([]),o=m.useRef([]),s=l=>{if(!o.current.includes(l)){const u=[...o.current,l];r(u),o.current=u}},a=l=>{if(o.current.includes(l)){const u=o.current.filter(d=>d!==l);r(u),o.current=u}},c=l=>{const u=n.filter(p=>l.find(f=>f===p));Pr(u,n).forEach(p=>a(p))};return i.jsx(wn.Provider,{value:{type:t,deletingBlocklets:n,addDeletingDid:s,removeDeletingDid:a,matchDeletingDid:c},children:e})}Sn.propTypes={type:S.string,children:S.node.isRequired};function ec(){return m.useContext(wn)}const Gr=e=>m.createElement("svg",{width:32,height:32,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},m.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.32989 8.20744C11.2787 6.82349 13.6098 6.08 16 6.08C18.3902 6.08 20.7213 6.82349 22.6701 8.20744C24.6189 9.59139 26.089 11.5473 26.8766 13.804C27.6642 16.0607 27.7304 18.5066 27.0659 20.8026C26.4419 22.9587 25.2026 24.8823 23.5044 26.3404H8.49555C6.79735 24.8823 5.55809 22.9587 4.9341 20.8026C4.26961 18.5066 4.33575 16.0607 5.12337 13.804C5.91098 11.5473 7.38107 9.59139 9.32989 8.20744ZM16 3.52C13.0786 3.52 10.2295 4.42871 7.84764 6.1202C5.46575 7.81169 3.66898 10.2022 2.70634 12.9604C1.7437 15.7187 1.66286 18.708 2.47501 21.5143C3.28717 24.3205 4.95211 26.8046 7.23909 28.6224C7.46554 28.8024 7.74628 28.9004 8.03554 28.9004H23.9644C24.2537 28.9004 24.5344 28.8024 24.7609 28.6224C27.0479 26.8046 28.7128 24.3205 29.5249 21.5143C30.3371 18.708 30.2563 15.7187 29.2936 12.9604C28.331 10.2022 26.5342 7.81169 24.1523 6.1202C21.7704 4.42871 18.9214 3.52 16 3.52ZM21.8829 13.5921C22.3827 13.0923 22.3827 12.2818 21.8829 11.7819C21.383 11.2821 20.5725 11.2821 20.0727 11.7819L17.868 13.9866C17.3072 13.7012 16.6724 13.5404 16 13.5404C13.7221 13.5404 11.8755 15.3869 11.8755 17.6648C11.8755 19.9427 13.7221 21.7892 16 21.7892C18.2779 21.7892 20.1244 19.9427 20.1244 17.6648C20.1244 16.9924 19.9635 16.3576 19.6782 15.7968L21.8829 13.5921ZM14.4355 17.6648C14.4355 16.8008 15.136 16.1004 16 16.1004C16.864 16.1004 17.5644 16.8008 17.5644 17.6648C17.5644 18.5288 16.864 19.2292 16 19.2292C15.136 19.2292 14.4355 18.5288 14.4355 17.6648Z",fill:"currentColor"})),Y={Start:Eo,Stop:Io,Restart:_o,Reload:Mo,Remove:To,Config:Ro,Log:Po,Group:Ao,Cancel:Lo,Dashboard:Gr,Overview:Do},Qr=(e,t)=>{if(!e)return"";if(!t)return e;const n=new URL(e),r=new URLSearchParams(n.searchParams),o=new URL(W(n.origin,t));return o.search=r.toString(),o.toString()},Zr="internal",Xr="external";function jn({blocklet:e,onStart:t,onComplete:n,variant:r="menu",hasPermission:o=!1,getComponentUrl:s=null,useBlockletUrlEvaluation:a=()=>({loading:!1,recommendedUrl:window?.location?.href}),...c}){const l=ze(),[u,d]=m.useState(null),[p,f]=m.useState(null),[b,y]=m.useState(!1),[h,C]=m.useState(null),{t:v}=m.useContext(tn),[j]=Pt("skip-blocklet-setup",!1),{loading:g,recommendedUrl:E}=a(e),[k]=Pt("blocklet-type-filter",Zr),x=P.isInProgress(e.status),[T,O]=m.useState(!1);m.useEffect(()=>{if(!e?.controller)return;O(e?.controller?.status?.value===qe.BLOCKLET_CONTROLLER_STATUS.suspended),(async()=>{try{const D=await l.api.getLauncherSession({input:{launcherSessionId:e?.controller?.launcherSessionId,launcherUrl:e?.controller?.launcherUrl}});if(D?.error){console.error("get launcher session failed",D.error);return}O([R.LAUNCH_SESSION_STATUS.overdue,R.LAUNCH_SESSION_STATUS.canceled,R.LAUNCH_SESSION_STATUS.terminated].includes(D?.launcherSession?.status))}catch(D){console.error("call getLauncherSession error",D)}})()},[]);const{inService:M}=l,N=(w,D,K=!1)=>async()=>{const G=async Se=>{t({action:w,blocklet:e}),y(!0),f(w);let je=!1;try{if(w==="remove")await D(Se);else if(w==="start"){if(!P.hasRunnableComponent(e)){F.error(v("blocklet.noComponent"));return}if(!M&&!j&&!e.settings?.initialized&&e.mode!==qe.BLOCKLET_MODES.DEVELOPMENT){if(!E||!Lt(E)){F.error(v("blocklet.gotoVisitError"));return}const U=tr(l.info),kt=new URL(E);kt.searchParams.set("serverUrl",U),window.open(Mt(kt.href,{allowDomains:null})),n({action:w,blocklet:e});return}const $=e.children.filter(U=>!P.isInProgress(U.status)&&U.status!=="running"||!P.isInProgress(U.greenStatus)&&U.greenStatus!=="running").map(U=>U.meta.did),J={did:e.meta.did,componentDids:$};await D({input:J})}else if(["stop","restart","reload"].includes(w)){const $=e.children.filter(U=>P.isDeletableBlocklet(U)).map(U=>U.meta.did),J={did:e.meta.did,componentDids:$};await D({input:J})}else{const $={did:e.meta.did};await D({input:$})}w==="remove"?je=!0:await nr(1e3),w==="reload"&&F.success(v("blocklet.reloadSuccess")),C(null),n({action:w,blocklet:e})}catch($){const J=`Blocklet ${w} failed: ${bt($)}`;throw n({action:w,blocklet:e,error:new Error(J)}),new Error(J)}finally{je||y(!1)}},ve=()=>{y(!1),C(null)},we=P.getDisplayName(e,!0),yo=e.mode===qe.BLOCKLET_MODES.DEVELOPMENT?{description:()=>i.jsx(ee,{component:"div",children:i.jsx(ee,{gutterBottom:!0,children:v("blocklet.action.removeApplicationDescription")})}),params:{removeType:"complete"}}:{description:(Se,je)=>i.jsxs(ee,{component:"div",children:[i.jsx(ee,{gutterBottom:!0,children:v("blocklet.action.removeApplicationDescription")}),i.jsxs(Vo,{name:"removeType",value:Se.removeType,onChange:$=>je({...Se,removeType:$.target.value}),children:[i.jsx(It,{value:"backup",control:i.jsx(_t,{}),label:v("blocklet.action.removeApplicationAfterBackup")}),i.jsx(It,{value:"complete",control:i.jsx(_t,{}),label:v("blocklet.action.removeApplicationComplete")})]})]}),params:{removeType:"backup"}},vo={stop:{title:`${v("common.stop")} ${we}`,description:v("blocklet.action.stopDescription"),confirm:v("blocklet.action.confirmStop"),cancel:v("common.cancel"),onConfirm:G,onCancel:ve},restart:{title:`${v("common.restart")} ${we}`,description:v("blocklet.action.restartDescription"),confirm:v("blocklet.action.confirmRestart"),cancel:v("common.cancel"),onConfirm:G,onCancel:ve},remove:{title:`${v("common.remove")} ${we}`,confirm:v("blocklet.action.confirmRemove"),cancel:v("common.cancel"),onConfirm:G,onCancel:ve,...yo},cancelDownload:{title:`${v("common.cancel")}`,description:v("blocklet.action.cancelDownloadDescription",{name:we}),confirm:v("common.confirm"),cancel:v("common.cancel"),onConfirm:G,onCancel:ve}};K?C(vo[w]):await G()},We=!!u,po=w=>{try{w.stopPropagation(),w.preventDefault()}catch{}d(w.currentTarget)},mo=w=>{try{w.stopPropagation(),w.preventDefault()}catch{}d(null)},Ct=async(w,D)=>{try{D.stopPropagation(),D.preventDefault()}catch{}if(typeof w.handler=="function")try{y(!0),f(w.action),await w.handler()}catch(K){console.error(`Blocklet ${w.name} failed: `,K)}finally{y(!1),d(null)}else d(null)},ho=!M&&P.isDeletableBlocklet(e)?{action:"remove",icon:Y.Remove,name:v("common.remove"),handler:N("remove",async({removeType:w})=>{w==="backup"&&await l.api.backupBlocklet({input:{appDid:e.appDid,to:"disk"}}),await l.api.deleteBlocklet({input:{did:e.meta.did,keepData:!1}})},!0),disabled:x}:null,go={action:"remove",icon:({sx:w,...D})=>i.jsx(Y.Cancel,{sx:{...w,paddingRight:"2px",zoom:.95},...D}),name:v("common.cancel"),handler:N("cancelDownload",l.api.cancelDownloadBlocklet,!0)},bo=P.getAppMissingConfigs(e),xo=()=>{const w=`/${e.mountPoint||"/"}`.replace(/\/+/g,"/"),D=s?.({mountPoint:w,blocklet:e});if(!D||!Lt(D)){F.error(v("blocklet.gotoVisitError"));return}const K=e?.site?.domainAliases;window.open(Mt(Qr(D,`${R.WELLKNOWN_SERVICE_PATH_PREFIX}/admin`),{allowDomains:K?.map(G=>G.value)}))};let ye=[{action:"start",icon:Y.Start,inExternal:!0,name:v("common.start"),handler:N("start",l.api.startBlocklet),disabled:T||e.children.every(w=>P.isBlockletRunning(w))||Ke(e.status)||g||x},{action:"stop",icon:Y.Stop,inExternal:!0,name:v("common.stop"),handler:N("stop",l.api.stopBlocklet,!0),disabled:!["running","starting"].includes(e.status)},{action:"restart",inExternal:!0,icon:Y.Restart,name:v("common.restart"),handler:N("restart",l.api.restartBlocklet,!0),disabled:T||e.status!=="running"},Ke(e.status)?go:ho,{separator:!0},M?null:{action:"dashboard",icon:({style:w,...D})=>i.jsx(Y.Dashboard,{...D,style:{...w,width:"26px",height:"26px",paddingRight:"3px"}}),name:v("sidebar.dashboard"),handler:xo}].filter(Boolean);return k===Xr&&(ye=ye.filter(w=>w.inExternal)),r==="menu"?i.jsxs(Nt,{"data-cy":"blocklet-actions",children:[i.jsx(Ne,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions","actions-blocklet-did":e.meta.did,onClick:po,size:"small",disabled:!o||!Ke(e.status)&&b,children:i.jsx(Oo,{})}),i.jsxs(No,{id:"actions-menu",anchorEl:u,keepMounted:!0,open:We,onClose:mo,PaperProps:{},children:[bo.length>0&&i.jsxs(gt,{style:{maxWidth:"400px"},severity:"error",children:[v("blocklet.config.missingRequired"),i.jsx("br",{}),i.jsx(dn,{to:`/blocklets/${e.meta.did}/components`,children:v("blocklet.config.gotoFix")})]}),ye.map((w,D)=>w.separator?i.jsx(Uo,{},`separator-${D}`):i.jsxs(Bo,{dense:!0,onClick:K=>Ct(w,K),disabled:b||w.disabled,"data-cy":`${w.action}-blocklet`,children:[i.jsx(zo,{style:{minWidth:24},children:p===w.action&&b?i.jsx(V,{size:16,sx:{marginRight:1}}):i.jsx(w.icon,{fontSize:"small"})}),i.jsx($o,{primary:w.name})]},w.name))]}),h&&i.jsx(Rt,{title:h.title,description:h.description,confirm:h.confirm,cancel:h.cancel,params:h.params,onConfirm:h.onConfirm,onCancel:h.onCancel})]}):i.jsxs(Nt,{"data-cy":"blocklet-actions",...c,children:[i.jsx(Fo,{children:ye.filter(w=>!w.separator&&!w.onlyInMenu).map(w=>i.jsxs(ht,{title:w.name,"data-cy":`${w.action}-blocklet`,onClick:()=>Ct(w),disabled:!!w.disabled||b,children:[p===w.action&&b?i.jsx(V,{size:16,sx:{marginRight:1}}):i.jsx(w.icon,{}),i.jsx("span",{className:"blocklet-action-text",children:w.name})]},w.name))}),h&&i.jsx(Rt,{title:h.title,description:h.description,confirm:h.confirm,cancel:h.cancel,params:h.params,onConfirm:h.onConfirm,onCancel:h.onCancel})]})}jn.propTypes={getComponentUrl:S.func,blocklet:S.object.isRequired,onStart:S.func.isRequired,onComplete:S.func.isRequired,variant:S.oneOf(["menu","group"]),hasPermission:S.bool,useBlockletUrlEvaluation:S.func};const Nt=Ue.div`
|
|
3
3
|
display: flex;
|
|
4
4
|
align-items: center;
|
|
5
5
|
|
|
@@ -61,7 +61,7 @@ ${r}
|
|
|
61
61
|
.header-brand-addon {
|
|
62
62
|
display: block;
|
|
63
63
|
}
|
|
64
|
-
`;function ta(){const{t:e,locale:t}=B(),{blocklet:n,launcherSession:r,refreshSubscription:o}=me(),{connectApi:s,session:a,api:c}=hn(),[l,u]=m.useState(!1),[d,p]=m.useState(""),[f,b]=Or({subscriptionURL:"#"});if(m.useEffect(()=>{(Dt(n,r)||At(r))&&Sr({launcherSessionId:n?.controller?.launcherSessionId,launcherUrl:n?.controller?.launcherUrl,locale:t}).then(v=>{b({subscriptionURL:v})}).catch(v=>{console.error("get subscription url error:",v)})},[n,r]),m.useEffect(()=>{if(n.controller?.launcherUrl){const v=W(n.controller.launcherUrl,"__blocklet__.js?type=json");fetch(v).then(j=>j.json()).then(j=>{const g=j.componentMountPoints?.find(k=>k.did==="z2qaCNvKMv5GjouKdcDWexv6WqtHbpNPQDnAk")?.mountPoint,E=W(n.controller.launcherUrl,g);p(E)})}},[n.controller?.launcherUrl]),!n||!r)return"";let y=null,h="",C="error";return jr(r)?(y=Cr(r)?i.jsx(_e,{href:f.subscriptionURL,children:e("blocklet.manageSubscription")}):i.jsx(Zo,{variant:"text",color:"error",onClick:()=>u(!0),sx:{lineHeight:"inherit",fontSize:"inherit"},children:e("blocklet.payNow")}),h=e("blocklet.suspendedCausedByPastDue",{deadline:ie(r?.reservedUntil,t)})):At(r)?(y=i.jsx(_e,{href:f.subscriptionURL,children:e("blocklet.manageSubscription")}),h=e("blocklet.willBeSuspendedSoon",{deadline:ie((r?.subscription?.cancel_at||0)*1e3,t)}),C="warning"):Dt(n,r)?(y=i.jsx(_e,{href:f.subscriptionURL,children:e("blocklet.manageSubscription")}),h=e("blocklet.suspendedCausedByExpired",{deadline:ie(r?.reservedUntil,t),canceledAt:ie((r?.subscription?.canceled_at||0)*1e3,t)})):kr(n,r)&&(y=i.jsx(dn,{to:W(R.WELLKNOWN_BLOCKLET_ADMIN_PATH,"/did-spaces"),children:e("common.backup")}),h=e("blocklet.suspendedCausedByTerminated",{canceledAt:ie(r?.terminatedAt,t),deadline:Er(r?.terminatedAt,t)})),h?i.jsxs(i.Fragment,{children:[i.jsxs(gt,{severity:C,sx:{mb:1},children:[h,i.jsx(ee,{sx:{display:"inline-block",fontSize:"inherit",lineHeight:"inherit",ml:1,a:{textDecoration:"auto"},"& .MuiButtonBase-root":{p:0,minWidth:"auto"}},children:y})]}),l&&d&&r&&i.jsx(Ir,{session:a,connect:s,baseUrl:d,authToken:r.subscription.authToken,children:i.jsx(qr,{dialogProps:{open:l,onClose:()=>u(!1)},subscriptionId:r.subscription.id,successToast:!0,onPaid:()=>{c.post("/blocklet/start?fromSetup=1"),o(),u(!1)}})})]}):null}const na=m.lazy(()=>_(()=>import("./log-DCvCOn17.js"),__vite__mapDeps([0,1]),import.meta.url)),oa=m.lazy(()=>_(()=>import("./index-DvDgqPNe.js"),__vite__mapDeps([0,1]),import.meta.url)),ra=m.lazy(()=>_(()=>import("./index-C3yfW-2l.js"),__vite__mapDeps([0,1]),import.meta.url)),sa=m.lazy(()=>_(()=>import("./index-mXteQQPA.js"),__vite__mapDeps([0,1,2]),import.meta.url)),ia=m.lazy(()=>_(()=>import("./overview-3AanlBU3.js"),__vite__mapDeps([0,1]),import.meta.url)),aa=m.lazy(()=>_(()=>import("./domains-CNFr3aJ9.js"),__vite__mapDeps([0,1]),import.meta.url)),ca=m.lazy(()=>_(()=>import("./index-BcQQWjIN.js"),__vite__mapDeps([0,1]),import.meta.url)),la=m.lazy(()=>_(()=>import("./appearance-BUZooc3t.js"),__vite__mapDeps([0,1]),import.meta.url)),ua=m.lazy(()=>_(()=>import("./audit-logs-eECPB5oA.js"),__vite__mapDeps([0,1,2]),import.meta.url)),da=m.lazy(()=>_(()=>import("./index-CgGF98-I.js"),__vite__mapDeps([0,1]),import.meta.url)),fa=m.lazy(()=>_(()=>import("./config-navigation-DWOLS3z9.js"),__vite__mapDeps([0,1]),import.meta.url)),pa=m.lazy(()=>_(()=>import("./index-2fKHLT0z.js"),__vite__mapDeps([0,1]),import.meta.url)),ma=m.lazy(()=>_(()=>import("./index-PgN3JS_8.js"),__vite__mapDeps([0,1]),import.meta.url)),ha=m.lazy(()=>_(()=>import("./security-DrN96KLp.js"),__vite__mapDeps([0,1]),import.meta.url)),ga=m.lazy(()=>_(()=>import("./branding-BkGIm8P3.js"),__vite__mapDeps([0,1]),import.meta.url)),ba=m.lazy(()=>_(()=>import("./advanced-BSm5CLLg.js"),__vite__mapDeps([0,1]),import.meta.url)),xa=m.lazy(()=>_(()=>import("./traffic-C-k1EeLv.js").then(e=>e.t),__vite__mapDeps([0,1]),import.meta.url)),ya=m.lazy(()=>_(()=>import("./runtime-C43nnM4D.js"),__vite__mapDeps([0,1]),import.meta.url)),va=m.lazy(()=>_(()=>import("./index-BMQaM_ON.js"),__vite__mapDeps([0,1]),import.meta.url)),wa=m.lazy(()=>_(()=>import("./list-Bx2-rBf0.js"),__vite__mapDeps([0,1]),import.meta.url)),Sa=m.lazy(()=>_(()=>import("./index-BtpIrTNZ.js"),__vite__mapDeps([0,1]),import.meta.url)),ja=m.lazy(()=>_(()=>import("./config-C75mhsiC.js").then(e=>e.c),__vite__mapDeps([0,1]),import.meta.url)),Ca=m.lazy(()=>_(()=>import("./observability-pdEZhjSl.js"),[],import.meta.url)),ka=m.lazy(()=>_(()=>import("./playground-C0bWoIDS.js"),[],import.meta.url)),Ea=m.lazy(()=>_(()=>import("./index-CM4RAJ4n.js").then(e=>e.i),__vite__mapDeps([0,1]),import.meta.url)),Ia=m.lazy(()=>_(()=>import("./component-CnoEGL3c.js"),__vite__mapDeps([0,1,2,3]),import.meta.url)),_a=m.lazy(()=>_(()=>import("./index-Cn4da4ZP.js"),__vite__mapDeps([0,1]),import.meta.url)),Ta=W(R.WELLKNOWN_SERVICE_PATH_PREFIX,"user","notifications"),La=e=>{const{enqueueSnackbar:t}=nn(),n=m.useCallback(r=>bn(Ta,{id:r.id,severity:r.severity||"all",componentDid:r.source==="system"?"system":r.componentDid||"all"}),[]);Lr(`${e}/${R.EVENTS.NOTIFICATION_BLOCKLET_CREATE}`,r=>{const o=n(r),{severity:s,description:a}=r||{},c=["error","warning"].includes(s)||r.sticky;r.source==="system"&&t(a,{variant:s,autoHideDuration:c?null:5e3,content:l=>i.jsx(cs,{viewAllUrl:o,keyId:l,notification:r,content:i.jsx(Fr,{notification:r,minimal:!0,rows:0})})})},[],"user")};function fo({blocklet:e,isAdmin:t}){return t?i.jsx(da,{blocklet:e}):i.jsx(Ar,{status:403})}fo.propTypes={blocklet:S.object.isRequired,isAdmin:S.bool.isRequired};const Da=e=>{const{t}=B(),{blocklet:n,actions:{refreshBlocklet:r},client:o,did:s}=me(),a=ne(()=>Mr(n,"settings.org.enabled",!1),[n]),c=n?.meta?.did,l=!n||Dr(n.status)?[]:P.getAppMissingConfigs(n),u={overview:[{label:t("common.overview"),value:"overview"},{label:i.jsx(Xo,{"data-cy":"blocklet-list",color:"error",variant:"dot",invisible:!l.length,children:t("common.components")}),labelText:t("common.components"),value:"components"}],"did-connect":[{label:t("common.members"),value:"members"},a?{label:t("common.orgs"),value:"orgs"}:null,{label:t("team.member.passports"),value:"passports"},{label:t("common.setting"),value:"settings"},{label:t("common.security"),value:"security"},{label:t("oauth.client.tab"),value:"oauth"}].filter(Boolean),aigne:[{label:t("setup.aigne.config"),value:"aigne-config"}],website:[{label:t("common.domains"),value:"domains"},{label:t("common.branding"),value:"branding"},{label:t("common.theming"),value:"theming"},{label:t("common.navigation"),value:"navigation"}],operations:[{label:t("common.notificationRecords"),value:"notifications",show:e},{label:t("common.analytics"),value:"analytics"},{label:t("common.auditLogs"),value:"audit-logs"},{label:t("common.advancedConfig"),value:"advanced"}],integrations:[{label:"Webhooks",value:"webhooks",show:e},{label:t("common.accessKeys"),value:"access-keys"},{label:t("common.mcpServers"),value:"mcp-servers"}],developers:[{label:t("common.logs"),value:"logs",show:n?.children?.length&&n.structVersion===R.APP_STRUCT_VERSION},{label:t("common.performance"),value:"performance"},{label:t("common.docs"),value:"docs"}]},d={overview:ia,components:Ia,members:i.jsx(oa,{type:"blocklet",createPassportSvg:Ot}),passports:i.jsx(ca,{createPassportSvg:Ot}),orgs:i.jsx(Ea,{editable:!1,mode:"dashboard",layout:"table"}),settings:i.jsx(ma,{orientation:"vertical"}),security:i.jsx(ha,{}),"did-spaces":i.jsx(pa,{navOrientation:"horizontal"}),domains:aa,branding:i.jsx(ga,{blocklet:n,onUpdate:r}),theming:i.jsx(la,{}),navigation:fa,sitemap:i.jsx(ko,{children:t("common.comingSoon")}),notifications:i.jsx(fo,{blocklet:n,isAdmin:e}),"audit-logs":i.jsx(ua,{scope:c,categories:["blocklet","team","security","certificates","gateway"]}),analytics:i.jsx(xa,{client:o,did:s}),advanced:i.jsx(ba,{blocklet:n,onUpdate:r}),webhooks:i.jsx(ra,{}),"access-keys":i.jsx(va,{}),"mcp-servers":i.jsx(Sa,{}),logs:na,performance:i.jsx(ya,{client:o,did:s}),docs:_a,publish:i.jsx(sa,{}),oauth:i.jsx(wa,{}),"aigne-config":i.jsx(I,{sx:{maxWidth:1536},children:i.jsx(ja,{})}),"aigne-observability":i.jsx(Ca,{}),"aigne-playground":i.jsx(ka,{})};return{tabGroups:u,renders:d}};function Aa(){const e=fn(),{tab:t="overview",subtab:n}=er(),{locale:r}=B(),{blocklet:o,refreshFlag:s}=me(),{session:a}=xn(),c=ne(()=>a?.user?.did,[a]),l=Kr(),u=ne(()=>a.user?.role&&gn.includes(a.user.role),[a]);La(c);const{tabGroups:d,renders:p}=Da(u),f=g=>{e(`${R.WELLKNOWN_SERVICE_PATH_PREFIX}/admin/${t}/${g}`)},b=(d[t]||[]).filter(g=>g.show===void 0||g.show),y=(b||[]).find(g=>g.value===n)?.value||b?.[0]?.value||t,h=p[y]||p.overview,C=["overview"].includes(t),v=o?i.jsxs(Sn,{type:"components",children:[b.length>0&&i.jsxs(I,{sx:{mb:2,display:"flex",alignItems:"center",gap:2},children:[i.jsx(Co,{tabs:b,current:y,onChange:f,scrollButtons:"auto"}),C&&!l&&i.jsx(I,{sx:{flex:1,display:"flex",justifyContent:"flex-end"},children:i.jsx(I,{component:"div",className:"page-header",children:o?i.jsx(Ut,{className:"page-actions",hasPermission:!0,blocklet:o,onStart:()=>{},onComplete:({error:g}={})=>{g&&F.error(g.message)},variant:"group"}):null})})]}),i.jsx(I,{className:"page-content",children:i.jsx(m.Suspense,{fallback:i.jsx(Ae,{relative:"parent",children:i.jsx(V,{})}),children:m.isValidElement(h)?h:i.jsx(h,{blocklet:o})})})]}):i.jsx(Ae,{relative:"parent",children:i.jsx(V,{})}),j=ne(()=>{const g=window.blocklet?.navigation?.find(M=>M.id==="/team"&&M.section==="dashboard"),E=o?.meta?.title||"";let k="";if(g){const M=W(R.WELLKNOWN_BLOCKLET_ADMIN_PATH,t,t==="publish"?n:"");k=g.items.find(We=>We.link===M)?.title?.[r]||""}const x=b.find(M=>M.value===n),O=[x?.labelText||x?.label||b?.[0]?.labelText||b?.[0]?.label||"",k].filter(Boolean).join(" - ");return E?O?`${O} | ${E}`:E:O||""},[t,n,o,r]);return i.jsx(Tr,{children:i.jsx($r,{children:i.jsx(uo,{title:j,children:i.jsxs(Ra,{children:[l&&C&&i.jsx(I,{component:"div",className:"page-header",sx:{mb:2},children:o?i.jsx(Ut,{className:"page-actions",hasPermission:!0,blocklet:o,onStart:()=>{},onComplete:({error:g}={})=>{g&&F.error(g.message)},variant:"group"}):null}),i.jsx(es,{}),i.jsx(ta,{}),v]})},`${s}`)})})}function Pa(){const{blocklet:e}=me(),t=e?.meta?.did;return m.useEffect(()=>{const n=_r();return t&&n.connect(),()=>{t&&n.isConnected()&&n.disconnect()}},[t]),i.jsx(Aa,{})}const Ra=Ue.main`
|
|
64
|
+
`;function ta(){const{t:e,locale:t}=B(),{blocklet:n,launcherSession:r,refreshSubscription:o}=me(),{connectApi:s,session:a,api:c}=hn(),[l,u]=m.useState(!1),[d,p]=m.useState(""),[f,b]=Or({subscriptionURL:"#"});if(m.useEffect(()=>{(Dt(n,r)||At(r))&&Sr({launcherSessionId:n?.controller?.launcherSessionId,launcherUrl:n?.controller?.launcherUrl,locale:t}).then(v=>{b({subscriptionURL:v})}).catch(v=>{console.error("get subscription url error:",v)})},[n,r]),m.useEffect(()=>{if(n.controller?.launcherUrl){const v=W(n.controller.launcherUrl,"__blocklet__.js?type=json");fetch(v).then(j=>j.json()).then(j=>{const g=j.componentMountPoints?.find(k=>k.did==="z2qaCNvKMv5GjouKdcDWexv6WqtHbpNPQDnAk")?.mountPoint,E=W(n.controller.launcherUrl,g);p(E)})}},[n.controller?.launcherUrl]),!n||!r)return"";let y=null,h="",C="error";return jr(r)?(y=Cr(r)?i.jsx(_e,{href:f.subscriptionURL,children:e("blocklet.manageSubscription")}):i.jsx(Zo,{variant:"text",color:"error",onClick:()=>u(!0),sx:{lineHeight:"inherit",fontSize:"inherit"},children:e("blocklet.payNow")}),h=e("blocklet.suspendedCausedByPastDue",{deadline:ie(r?.reservedUntil,t)})):At(r)?(y=i.jsx(_e,{href:f.subscriptionURL,children:e("blocklet.manageSubscription")}),h=e("blocklet.willBeSuspendedSoon",{deadline:ie((r?.subscription?.cancel_at||0)*1e3,t)}),C="warning"):Dt(n,r)?(y=i.jsx(_e,{href:f.subscriptionURL,children:e("blocklet.manageSubscription")}),h=e("blocklet.suspendedCausedByExpired",{deadline:ie(r?.reservedUntil,t),canceledAt:ie((r?.subscription?.canceled_at||0)*1e3,t)})):kr(n,r)&&(y=i.jsx(dn,{to:W(R.WELLKNOWN_BLOCKLET_ADMIN_PATH,"/did-spaces"),children:e("common.backup")}),h=e("blocklet.suspendedCausedByTerminated",{canceledAt:ie(r?.terminatedAt,t),deadline:Er(r?.terminatedAt,t)})),h?i.jsxs(i.Fragment,{children:[i.jsxs(gt,{severity:C,sx:{mb:1},children:[h,i.jsx(ee,{sx:{display:"inline-block",fontSize:"inherit",lineHeight:"inherit",ml:1,a:{textDecoration:"auto"},"& .MuiButtonBase-root":{p:0,minWidth:"auto"}},children:y})]}),l&&d&&r&&i.jsx(Ir,{session:a,connect:s,baseUrl:d,authToken:r.subscription.authToken,children:i.jsx(qr,{dialogProps:{open:l,onClose:()=>u(!1)},subscriptionId:r.subscription.id,successToast:!0,onPaid:()=>{c.post("/blocklet/start?fromSetup=1"),o(),u(!1)}})})]}):null}const na=m.lazy(()=>_(()=>import("./log-BFOgPn13.js"),__vite__mapDeps([0,1]),import.meta.url)),oa=m.lazy(()=>_(()=>import("./index-CuH2SZN0.js"),__vite__mapDeps([0,1]),import.meta.url)),ra=m.lazy(()=>_(()=>import("./index-CCGTCthU.js"),__vite__mapDeps([0,1]),import.meta.url)),sa=m.lazy(()=>_(()=>import("./index-DtY0rQzd.js"),__vite__mapDeps([0,1,2]),import.meta.url)),ia=m.lazy(()=>_(()=>import("./overview-BITUbq3E.js"),__vite__mapDeps([0,1]),import.meta.url)),aa=m.lazy(()=>_(()=>import("./domains-CeH-Is8l.js"),__vite__mapDeps([0,1]),import.meta.url)),ca=m.lazy(()=>_(()=>import("./index-B9UOYoTi.js"),__vite__mapDeps([0,1]),import.meta.url)),la=m.lazy(()=>_(()=>import("./appearance-BjJHVOrD.js"),__vite__mapDeps([0,1]),import.meta.url)),ua=m.lazy(()=>_(()=>import("./audit-logs-CYyFSo7D.js"),__vite__mapDeps([0,1,2]),import.meta.url)),da=m.lazy(()=>_(()=>import("./index-BWkRqWUV.js"),__vite__mapDeps([0,1]),import.meta.url)),fa=m.lazy(()=>_(()=>import("./config-navigation-Ci4sw2Mg.js"),__vite__mapDeps([0,1]),import.meta.url)),pa=m.lazy(()=>_(()=>import("./index-EE_leCro.js"),__vite__mapDeps([0,1]),import.meta.url)),ma=m.lazy(()=>_(()=>import("./index-B0HVlpUv.js"),__vite__mapDeps([0,1]),import.meta.url)),ha=m.lazy(()=>_(()=>import("./security-Jp9VavjR.js"),__vite__mapDeps([0,1]),import.meta.url)),ga=m.lazy(()=>_(()=>import("./branding-D14MEcTS.js"),__vite__mapDeps([0,1]),import.meta.url)),ba=m.lazy(()=>_(()=>import("./advanced-BeUvs5a-.js"),__vite__mapDeps([0,1]),import.meta.url)),xa=m.lazy(()=>_(()=>import("./traffic-CxwOXUbM.js").then(e=>e.t),__vite__mapDeps([0,1]),import.meta.url)),ya=m.lazy(()=>_(()=>import("./runtime-DPpYl0V4.js"),__vite__mapDeps([0,1]),import.meta.url)),va=m.lazy(()=>_(()=>import("./index-BwK-dbsY.js"),__vite__mapDeps([0,1]),import.meta.url)),wa=m.lazy(()=>_(()=>import("./list-C4b_Znkz.js"),__vite__mapDeps([0,1]),import.meta.url)),Sa=m.lazy(()=>_(()=>import("./index-BtyqZ8ix.js"),__vite__mapDeps([0,1]),import.meta.url)),ja=m.lazy(()=>_(()=>import("./config-B7yZVsVx.js").then(e=>e.c),__vite__mapDeps([0,1]),import.meta.url)),Ca=m.lazy(()=>_(()=>import("./observability-pdEZhjSl.js"),[],import.meta.url)),ka=m.lazy(()=>_(()=>import("./playground-C0bWoIDS.js"),[],import.meta.url)),Ea=m.lazy(()=>_(()=>import("./index-B5ctIRcA.js").then(e=>e.i),__vite__mapDeps([0,1]),import.meta.url)),Ia=m.lazy(()=>_(()=>import("./component-BuKDir1W.js"),__vite__mapDeps([0,1,2,3]),import.meta.url)),_a=m.lazy(()=>_(()=>import("./index-Dn2h6APz.js"),__vite__mapDeps([0,1]),import.meta.url)),Ta=W(R.WELLKNOWN_SERVICE_PATH_PREFIX,"user","notifications"),La=e=>{const{enqueueSnackbar:t}=nn(),n=m.useCallback(r=>bn(Ta,{id:r.id,severity:r.severity||"all",componentDid:r.source==="system"?"system":r.componentDid||"all"}),[]);Lr(`${e}/${R.EVENTS.NOTIFICATION_BLOCKLET_CREATE}`,r=>{const o=n(r),{severity:s,description:a}=r||{},c=["error","warning"].includes(s)||r.sticky;r.source==="system"&&t(a,{variant:s,autoHideDuration:c?null:5e3,content:l=>i.jsx(cs,{viewAllUrl:o,keyId:l,notification:r,content:i.jsx(Fr,{notification:r,minimal:!0,rows:0})})})},[],"user")};function fo({blocklet:e,isAdmin:t}){return t?i.jsx(da,{blocklet:e}):i.jsx(Ar,{status:403})}fo.propTypes={blocklet:S.object.isRequired,isAdmin:S.bool.isRequired};const Da=e=>{const{t}=B(),{blocklet:n,actions:{refreshBlocklet:r},client:o,did:s}=me(),a=ne(()=>Mr(n,"settings.org.enabled",!1),[n]),c=n?.meta?.did,l=!n||Dr(n.status)?[]:P.getAppMissingConfigs(n),u={overview:[{label:t("common.overview"),value:"overview"},{label:i.jsx(Xo,{"data-cy":"blocklet-list",color:"error",variant:"dot",invisible:!l.length,children:t("common.components")}),labelText:t("common.components"),value:"components"}],"did-connect":[{label:t("common.members"),value:"members"},a?{label:t("common.orgs"),value:"orgs"}:null,{label:t("team.member.passports"),value:"passports"},{label:t("common.setting"),value:"settings"},{label:t("common.security"),value:"security"},{label:t("oauth.client.tab"),value:"oauth"}].filter(Boolean),aigne:[{label:t("setup.aigne.config"),value:"aigne-config"}],website:[{label:t("common.domains"),value:"domains"},{label:t("common.branding"),value:"branding"},{label:t("common.theming"),value:"theming"},{label:t("common.navigation"),value:"navigation"}],operations:[{label:t("common.notificationRecords"),value:"notifications",show:e},{label:t("common.analytics"),value:"analytics"},{label:t("common.auditLogs"),value:"audit-logs"},{label:t("common.advancedConfig"),value:"advanced"}],integrations:[{label:"Webhooks",value:"webhooks",show:e},{label:t("common.accessKeys"),value:"access-keys"},{label:t("common.mcpServers"),value:"mcp-servers"}],developers:[{label:t("common.logs"),value:"logs",show:n?.children?.length&&n.structVersion===R.APP_STRUCT_VERSION},{label:t("common.performance"),value:"performance"},{label:t("common.docs"),value:"docs"}]},d={overview:ia,components:Ia,members:i.jsx(oa,{type:"blocklet",createPassportSvg:Ot}),passports:i.jsx(ca,{createPassportSvg:Ot}),orgs:i.jsx(Ea,{editable:!1,mode:"dashboard",layout:"table"}),settings:i.jsx(ma,{orientation:"vertical"}),security:i.jsx(ha,{}),"did-spaces":i.jsx(pa,{navOrientation:"horizontal"}),domains:aa,branding:i.jsx(ga,{blocklet:n,onUpdate:r}),theming:i.jsx(la,{}),navigation:fa,sitemap:i.jsx(ko,{children:t("common.comingSoon")}),notifications:i.jsx(fo,{blocklet:n,isAdmin:e}),"audit-logs":i.jsx(ua,{scope:c,categories:["blocklet","team","security","certificates","gateway"]}),analytics:i.jsx(xa,{client:o,did:s}),advanced:i.jsx(ba,{blocklet:n,onUpdate:r}),webhooks:i.jsx(ra,{}),"access-keys":i.jsx(va,{}),"mcp-servers":i.jsx(Sa,{}),logs:na,performance:i.jsx(ya,{client:o,did:s}),docs:_a,publish:i.jsx(sa,{}),oauth:i.jsx(wa,{}),"aigne-config":i.jsx(I,{sx:{maxWidth:1536},children:i.jsx(ja,{})}),"aigne-observability":i.jsx(Ca,{}),"aigne-playground":i.jsx(ka,{})};return{tabGroups:u,renders:d}};function Aa(){const e=fn(),{tab:t="overview",subtab:n}=er(),{locale:r}=B(),{blocklet:o,refreshFlag:s}=me(),{session:a}=xn(),c=ne(()=>a?.user?.did,[a]),l=Kr(),u=ne(()=>a.user?.role&&gn.includes(a.user.role),[a]);La(c);const{tabGroups:d,renders:p}=Da(u),f=g=>{e(`${R.WELLKNOWN_SERVICE_PATH_PREFIX}/admin/${t}/${g}`)},b=(d[t]||[]).filter(g=>g.show===void 0||g.show),y=(b||[]).find(g=>g.value===n)?.value||b?.[0]?.value||t,h=p[y]||p.overview,C=["overview"].includes(t),v=o?i.jsxs(Sn,{type:"components",children:[b.length>0&&i.jsxs(I,{sx:{mb:2,display:"flex",alignItems:"center",gap:2},children:[i.jsx(Co,{tabs:b,current:y,onChange:f,scrollButtons:"auto"}),C&&!l&&i.jsx(I,{sx:{flex:1,display:"flex",justifyContent:"flex-end"},children:i.jsx(I,{component:"div",className:"page-header",children:o?i.jsx(Ut,{className:"page-actions",hasPermission:!0,blocklet:o,onStart:()=>{},onComplete:({error:g}={})=>{g&&F.error(g.message)},variant:"group"}):null})})]}),i.jsx(I,{className:"page-content",children:i.jsx(m.Suspense,{fallback:i.jsx(Ae,{relative:"parent",children:i.jsx(V,{})}),children:m.isValidElement(h)?h:i.jsx(h,{blocklet:o})})})]}):i.jsx(Ae,{relative:"parent",children:i.jsx(V,{})}),j=ne(()=>{const g=window.blocklet?.navigation?.find(M=>M.id==="/team"&&M.section==="dashboard"),E=o?.meta?.title||"";let k="";if(g){const M=W(R.WELLKNOWN_BLOCKLET_ADMIN_PATH,t,t==="publish"?n:"");k=g.items.find(We=>We.link===M)?.title?.[r]||""}const x=b.find(M=>M.value===n),O=[x?.labelText||x?.label||b?.[0]?.labelText||b?.[0]?.label||"",k].filter(Boolean).join(" - ");return E?O?`${O} | ${E}`:E:O||""},[t,n,o,r]);return i.jsx(Tr,{children:i.jsx($r,{children:i.jsx(uo,{title:j,children:i.jsxs(Ra,{children:[l&&C&&i.jsx(I,{component:"div",className:"page-header",sx:{mb:2},children:o?i.jsx(Ut,{className:"page-actions",hasPermission:!0,blocklet:o,onStart:()=>{},onComplete:({error:g}={})=>{g&&F.error(g.message)},variant:"group"}):null}),i.jsx(es,{}),i.jsx(ta,{}),v]})},`${s}`)})})}function Pa(){const{blocklet:e}=me(),t=e?.meta?.did;return m.useEffect(()=>{const n=_r();return t&&n.connect(),()=>{t&&n.isConnected()&&n.disconnect()}},[t]),i.jsx(Aa,{})}const Ra=Ue.main`
|
|
65
65
|
.page-header {
|
|
66
66
|
display: flex;
|
|
67
67
|
justify-content: space-between;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,ak as o,aX as h,T as j,z as g,W as i}from"./vendor-mui-core-DRxbhqaK.js";import{T as _}from"./vendor-ux-B9VfuZTg.js";import{C as b}from"./click-to-copy-CO6UIqva.js";import{C as T}from"./confirm-
|
|
1
|
+
import{j as e,ak as o,aX as h,T as j,z as g,W as i}from"./vendor-mui-core-DRxbhqaK.js";import{T as _}from"./vendor-ux-B9VfuZTg.js";import{C as b}from"./click-to-copy-CO6UIqva.js";import{C as T}from"./confirm-CRSsToIg.js";function k({title:c,description:l,confirmPlaceholder:m,cancel:d="",confirm:u="Confirm",params:p={},onCancel:f=()=>{},onConfirm:C,keyName:t}){const{t:a}=_(),n={title:()=>e.jsx(o,{children:c}),description:(s,y)=>{const x=r=>{y({...r,__disableConfirm:r.__disableConfirm})};return e.jsxs(o,{children:[e.jsx(h,{severity:"warning",style:{width:"100%"},children:a("common.notice")}),e.jsx(o,{sx:{my:3,b:{wordBreak:"break-word"}},dangerouslySetInnerHTML:{__html:l}}),e.jsxs(o,{style:{marginBottom:24},children:[a("common.click"),":",e.jsx(b,{"data-cy":"click-copy",children:t})]}),e.jsx(j,{component:"div",children:e.jsx(g,{label:m,autoComplete:"off","data-cy":"delete-confirm-input",variant:"outlined",fullWidth:!0,autoFocus:!0,value:s.inputVal,onChange:r=>{x({...s,inputVal:r.target.value,__disableConfirm:t!==r.target.value})}})})]})},confirm:u,cancel:d,onConfirm:C,onCancel:f,params:{inputVal:"",__disableConfirm:!0,...p}};return e.jsx(T,{title:n.title,description:n.description,confirm:n.confirm,cancel:n.cancel,params:n.params,onConfirm:n.onConfirm,onCancel:n.onCancel})}k.propTypes={title:i.any.isRequired,keyName:i.any.isRequired,description:i.any.isRequired,confirmPlaceholder:i.any.isRequired,cancel:i.string,confirm:i.string,params:i.object,onCancel:i.func,onConfirm:i.func.isRequired};export{k as D};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as o,ak as i,at as k,W as u}from"./vendor-mui-core-DRxbhqaK.js";import{l as v,e as C,aa as b,d as B}from"./index-
|
|
1
|
+
import{j as o,ak as i,at as k,W as u}from"./vendor-mui-core-DRxbhqaK.js";import{l as v,e as C,aa as b,d as B}from"./index-C5weIh5R.js";import{D as E,a as I,b as w}from"./domain-action-card-BYDa5XpT.js";import{c as T}from"./vendor-ux-B9VfuZTg.js";import{a as W}from"./page-header-DvSb4Cmz.js";import{r,u as A}from"./vendor-react-Dvs43sk9.js";import{u as L}from"./useSetState-DFuQZPPV.js";import{S as x}from"./button-BmGMF4AE.js";import{S as $}from"./layout-_Ka_GN5x.js";import{S as z}from"./step-actions-z2PSGmvy.js";import"./vendor-arcblock-DeeG8u0h.js";import"./vendor-utils-CUDP56Ff.js";import"./vendor-hooks-BlA8TRnZ.js";import"./permission-BeGf253a.js";import"./session-DEBZccHT.js";import"./useAsyncRetry-EEjDgDMR.js";import"./useAsync-DVtDVEv6.js";import"./confirm-CRSsToIg.js";import"./index-DBs9Ljax.js";import"./actions-B4VXcSRp.js";import"./delete-confirm-BOL7KX0x.js";import"./click-to-copy-CO6UIqva.js";import"./useAsync-fWwm3Jbj.js";import"./index-Ba9-ArMT.js";import"./util-DY1uHmM4.js";import"./engine-Dde2jLpF.js";import"./lottie-web-4koyQiv_.js";import"./content-layout-B9tc9LCL.js";import"./use-mobile-D6YQgajG.js";function h({onNext:a=()=>{},onPrevious:f=()=>{}}){const{t:s}=r.useContext(T),[D,d]=r.useState(!1),{blocklet:e}=v(),[p,S]=r.useState(""),j=((e?.site||{}).domainAliases||[]).map(t=>C.replaceSlotToIp(t.value,p)),[n,m]=L({domain:"",invalidDNSDomain:null,type:"",addDomainState:{text:""}}),c=e.environments?.find(t=>t.key==="BLOCKLET_APP_PK")?.value,y=j.find(t=>b.isDidDomain(t)),[l,P]=A();return r.useEffect(()=>{B.get(`/dns-resolve?hostname=${window.location.hostname}`).then(({data:t})=>{S(t.address||"")}).catch(t=>{console.error(t.message)})},[]),o.jsxs(H,{children:[o.jsx(i,{className:"header",children:o.jsx(W,{title:s("setup.domain.title"),subTitle:s("setup.domain.subTitle"),onClickBack:f})}),o.jsxs(i,{className:"form form-container",sx:{display:"flex",flexDirection:"column",gap:3,overflowY:"auto"},children:[o.jsxs(i,{children:[o.jsx(i,{sx:{color:"text.primary",fontWeight:"fontWeightBold",fontSize:"1.125rem"},children:o.jsx(i,{sx:{display:"inline"},children:`${s("setup.domain.buyOrConnect")} (${s("common.optional")})`})}),o.jsx(i,{sx:{mt:1},children:o.jsx(I,{blocklet:e,bugDidDomainProps:{appPk:c,appId:e.appPid,siteId:e.site.id,teamDid:e.meta.did,inBlockletSetup:!0},connectDomainProps:{autoFocus:!1,appPk:c,appId:e.appPid,siteId:e.site.id,teamDid:e.meta.did,cnameDomain:y,currentIp:p,inBlockletSetup:!0,shouldCheckDomain:!0,onInputDomain:t=>{m({domain:t.domain,type:t.type}),d(t.error)},onStateChange:t=>m({addDomainState:t}),onSuccess:t=>{const g={domain:t.domain,type:t.type,nftDid:t.nftDid,chainHost:t.chainHost};l.set("redirect",t.domain),P(l,{replace:!0}),m(g),a()},onError:d}})})]}),o.jsx(i,{children:o.jsx(w,{inSetup:!0,showAllDomains:!0,systemTips:o.jsx(i,{sx:{color:"text.primary",fontWeight:"fontWeightBold",fontSize:"1.125rem",mb:1},children:o.jsx(i,{sx:{display:"inline"},children:s("setup.domain.skipDescription")})})})})]}),o.jsx(z,{mt:8,disabled:!!n.addDomainState.text,blocklet:e,onStartNow:()=>a("complete"),children:n.domain?o.jsx(x,{variant:"contained",loading:!!n.addDomainState.text,disabled:D||!!n.addDomainState.text||!n.domain,onClick:()=>a(),children:n.addDomainState.text||s("setup.continue")}):o.jsx(x,{variant:"contained",disabled:!!n.addDomainState.text,onClick:()=>a(),children:s("setup.continue")})})]})}function ht(a){return o.jsx(E,{children:o.jsx(h,{...a})})}h.propTypes={onNext:u.func,onPrevious:u.func};const H=k($)`
|
|
2
2
|
height: 100%;
|
|
3
3
|
overflow-y: hidden;
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{at as bn,Q as vn,T as A,b as Cn,H as E,n as te,k as wn,S as ze}from"./vendor-ux-B9VfuZTg.js";import{j as e,cR as Ne,cS as Sn,ak as h,a6 as z,b0 as Rn,T as R,aX as ye,D as H,J as ie,am as L,aN as $e,W as t,bb as _e,M as Oe,aO as An,aP as kn,cT as Tn,b7 as In,b9 as Pn,cU as qn,cV as En,b1 as W,P as We,ci as Ln,bh as Fn,at as Mn,a$ as Bn,cW as Un,cX as zn,cY as Nn,cZ as $n,c_ as Te,c$ as _,d0 as _n,z as On,n as Wn,bf as Hn,d1 as Vn,cb as Gn}from"./vendor-mui-core-DRxbhqaK.js";import{C as ee,J as Xn,a as Qn,e as Zn,H as je,a4 as Jn,a5 as Kn,n as Q}from"./vendor-utils-CUDP56Ff.js";import{r as j,e as He,g as Yn}from"./vendor-react-Dvs43sk9.js";import{u as se}from"./useSetState-DFuQZPPV.js";import{l as et,k as nt,b as Z,m as tt,w as it}from"./vendor-hooks-BlA8TRnZ.js";import{bg as Ve,ai as Ge,bh as st,bi as Xe,X as F,a9 as oe,V as Ie,$ as ot,aL as Pe,bj as rt,B as at,ab as lt,bk as Qe,aa as fe,bl as Ze,bm as ct,bn as dt,bo as mt,aV as ut,e as xe,bp as pt,bq as ft}from"./index-0863PXVJ.js";import{w as Je}from"./permission-C6ZxgW4_.js";import{u as xt,D as qe}from"./useAsyncRetry-EEjDgDMR.js";import{C as re}from"./confirm-CbKYjtHR.js";import{A as ht}from"./actions-B4VXcSRp.js";import{D as gt}from"./delete-confirm-DwRy8bv4.js";import{o as Ee}from"./vendor-arcblock-DeeG8u0h.js";import{u as Dt}from"./useAsync-fWwm3Jbj.js";import{f as N}from"./index-DBs9Ljax.js";import{v as yt}from"./index-Ba9-ArMT.js";import{g as jt,p as Le}from"./util-D8_x37fq.js";import{C as bt}from"./click-to-copy-CO6UIqva.js";const vt=Ve({});vt.interceptors.request.use(n=>{const i=window.blocklet?window.blocklet.prefix:"/";return n.baseURL=i||"",n.url=ee("/api",String(n.url)),n.timeout=2e5,n.params=n.params||{},new URLSearchParams(n.url.split("?")[1]).has("locale")||(n.params.locale=bn()),n},n=>Promise.reject(n));const Ke=(...n)=>Ve(...n),Ct=(n,i)=>i?n?[n,...Array.isArray(i)?i:[i]]:i:n,wt=(n,{width:i=600,height:o=700,name:a="did-domain:popup"}={})=>{const s=window.screenX+(window.innerWidth-i)/2,r=window.screenY+(window.innerHeight-o)/2,u=[`left=${s}`,`top=${r}`,`width=${i}`,`height=${o}`,"resizable=no","scrollbars=yes","status=yes","popup=yes"],l=window.open("",a,u.join(","));if(l===null)throw new Error("Failed to open popup");return l.location.href=Xn(n,{opener:window.location.origin}),l},St="z2qaGosS3rZ7m5ttP3Nd4V4qczR9TryTcRV4p",Ye=async n=>{if(!n||!n?.trim())return null;const i=Ke(),o=new URL(n);o.pathname="__blocklet__.js",o.searchParams.set("type","json");const{data:a}=await i.get(o.toString()),s=a?.componentMountPoints?.find(m=>m.did===St),r=new URL(n);r.pathname=s?.mountPoint;const u=r.toString(),l=ee(u,"/api");return{base:u,api:l}},Rt=Ge({embed:{iconTip:"Click to view subscription details"},buy:{button:{title:"Buy DID Domain"},status:{inProgress:"Please wait while we are processing your request, the domain will be automatically resolved to the current app after the purchase...",success:"Purchase completed!"},error:{failedToCreateSession:"Failed to create session"}}}),At=Ge({embed:{iconTip:"点击查看订阅详情"},buy:{button:{title:"购买 DID 域名"},status:{inProgress:"请稍等,我们正在处理您的请求,购买域名后会自动解析到当前的应用...",success:"购买完成!"},error:{failedToCreateSession:"创建会话失败"}}}),kt={zh:At,en:Rt},Tt=async({didDomainURL:n,delegatee:i,delegateePk:o})=>{const a=await Ye(n);if(!a)return null;const s=Ke({baseURL:a.api}),{data:r}=await s.post("/payment/session",{delegatee:i,delegateePk:o});return{sessionId:r.sessionId,baseURL:a.base}};function It({delegatee:n,delegateePk:i,didDomainURL:o,locale:a,title:s="",onSuccess:r=()=>{},...u}){const{t:l}=A(),[m,p]=et({currentState:1}),f=j.useRef(null),c=nt(async()=>{const d=await Tt({didDomainURL:o,delegatee:n,delegateePk:i});return d},{debounceWait:500,debounceLeading:!0,debounceTrailing:!1,debounceMaxWait:3e3,refreshDeps:[],onError(d){console.error(d)}}),g=Z(d=>{d.data.type==="didDomain.success"&&(r?.({nftDid:d.data?.nftDid,domain:d.data?.domain,chainHost:d.data?.chainHost}),f.current?.close(),f.current=null,p({currentState:4}),setTimeout(()=>{p({currentState:8})},2e3))});tt(()=>{try{window.removeEventListener("message",g),f.current?.close(),f.current=null}catch(d){console.warn("Failed to close popup",d)}});const y=Z(()=>{p({currentState:1})}),x=Z(()=>{if(p({currentState:2}),!c.data){console.error("Failed to create session");return}b({sessionId:c.data.sessionId,baseURL:c.data.baseURL})}),b=Z(({sessionId:d,baseURL:w})=>{window.addEventListener("message",g);const C=new URL(w);C.searchParams.set("sessionId",d),C.searchParams.set("locale",a),C.searchParams.set("embed","1"),f.current=wt(C.toString());const q=setInterval(()=>{f.current?.closed&&(clearInterval(q),y())},1e3);return()=>clearInterval(q)});return e.jsxs(e.Fragment,{children:[e.jsx(Ne,{loading:c.loading,onClick:x,variant:"contained",startIcon:e.jsx(Sn,{}),...u,children:s||l("buy.button.title")}),e.jsxs(Cn,{fullWidth:!0,maxWidth:"xs",open:m.currentState>1&&m.currentState<8,onClose:y,children:[!c.error&&e.jsxs(h,{sx:{display:"flex",alignItems:"center",flexDirection:"column",gap:2},children:[m.currentState===2&&e.jsx(z,{size:50}),m.currentState===4&&e.jsx(Rn,{sx:{color:"primary.main",fontSize:"5rem"}}),m.currentState===2&&e.jsx(R,{children:l("buy.status.inProgress")}),m.currentState===4&&e.jsx(R,{children:l("buy.status.success")})]}),c.error&&e.jsx(ye,{severity:"error",children:l("buy.error.failedToCreateSession")})]})]})}function Pt(n){return e.jsx(vn,{locale:n.locale,translations:kt,children:e.jsx(It,{...n})})}function qt({nftDid:n,didDomainURL:i,locale:o,sx:a={}}){const{t:s}=A(),[r,u]=se({safeIframeRef:null,popoverAnchorEl:null}),l=j.useRef(null),m=H(),p=ie(m.breakpoints.down("md")),f=x=>{u({popoverAnchorEl:x.currentTarget})},c=()=>{u({popoverAnchorEl:null})},g=it(async()=>{const x=await Ye(i);return x?x.base:null});if(!g.value)return null;if(g.loading)return e.jsx(z,{});const y=ee(g.value,`/embed/domain?nft-did=${n}&locale=${o}`);return e.jsxs(e.Fragment,{children:[e.jsx(L,{title:s("embed.iconTip"),children:e.jsx(h,{component:"img",src:ee(i,"/.well-known/service/blocklet/logo"),alt:"logo",onClick:f,sx:[{width:16,height:16},Ct({cursor:"pointer"},a)]})}),e.jsx($e,{id:"popover-info",open:!!r.popoverAnchorEl,anchorEl:r.popoverAnchorEl,onClose:c,anchorOrigin:{vertical:"bottom",horizontal:"right"},children:e.jsx("iframe",{ref:l,title:s("common.subscription"),width:p?"320px":"400px",height:"350px",style:{border:0,display:"block"},src:y})})]})}const Et=n=>["waiting","creating","renewaling"].includes(n);function en({siteId:n,domain:i,onAdd:o=()=>{},children:a=null,did:s,issuing:r=!1,setIssuing:u=()=>{}}){const{t:l}=A(),[m,p]=j.useState(!1),{inService:f}=F(),[c,g]=j.useState(null),{api:y,ws:{useSubscription:x}}=F(),{mode:b,actions:{refreshDomainStatus:d}}=oe(),w=xt(async()=>{const{cert:T}=await y.findCertificateByDomain({input:{domain:i,did:s}});return T}),C=(T,S)=>{T.domain===i&&(u(!1),p(!1),f&&b!=="setup"&&(S==="success"?E.success(l("setup.domain.genCertSuccess",{domain:T.domain})):S==="error"&&E.error(l("setup.domain.genCertFailed",{domain:T.domain,message:T.message}))))};if(j.useEffect(()=>{w.loading||u(Et(w.value?.status))},[w.loading,w.value?.status,u]),x(Ie.BlockletEvents.certError,T=>C(T,"error")),x(Ie.BlockletEvents.certIssued,T=>{w.retry(),d(T.domain),C(T,"success")}),w.loading||w.value?.status==="normal")return"";const q=()=>{p(!1),g(null)},B=async()=>{p(!0);try{await y.issueLetsEncryptCert({input:{siteId:n,domain:i,did:s,inBlockletSetup:b==="setup"}}),o(),u(!0)}catch(T){console.error(T),u(!1)}finally{p(!1),g(null)}},M={title:l("router.cert.genLetsEncryptCert.title"),description:e.jsxs("div",{children:[e.jsx(ye,{severity:"success",children:l("router.cert.genLetsEncryptCert.dnsTip")}),l("router.cert.genLetsEncryptCert.description")]}),confirm:l("common.confirm"),onConfirm:B,onCancel:q},U=T=>{T.stopPropagation(),g(M)};return e.jsxs(e.Fragment,{children:[r?e.jsx(L,{title:l("router.cert.issuing"),children:e.jsx(z,{size:13,style:{fontSize:"13px"}})}):a({loading:m,open:U}),c&&e.jsx(re,{color:"primary",title:c.title,description:c.description,confirm:c.confirm,params:c.params,onConfirm:c.onConfirm,onCancel:c.onCancel})]})}en.propTypes={domain:t.string.isRequired,did:t.string.isRequired,siteId:t.string.isRequired,onAdd:t.func,children:t.any,issuing:t.bool,setIssuing:t.func};function nn({domain:n,domainStatus:i,did:o,onAdd:a=()=>{},children:s=null,issuing:r=!1,setIssuing:u=()=>{},...l}){return st(n)||!Xe(n)||Qn(i)||i?.isHttps?"":e.jsx(en,{...l,domain:n,did:o,onAdd:a,issuing:r,setIssuing:u,children:s})}nn.propTypes={domain:t.string.isRequired,domainStatus:t.shape({isHttps:t.bool}).isRequired,did:t.string.isRequired,onAdd:t.func,children:t.any,issuing:t.bool,setIssuing:t.func};function tn({id:n,domain:i,children:o=null,teamDid:a="",onDelete:s=null}){const{t:r}=A(),[u,l]=j.useState(!1),[m,p]=j.useState(null),{api:f}=F(),c=()=>{l(!1),p(null)},g=async()=>{l(!0);try{await f.deleteDomainAlias({input:{id:n,domainAlias:i,teamDid:a}}),s?.(),await ot(2e3)}catch(b){E.error(b.message)}finally{p(null),l(!1)}},y={keyName:i,title:r("router.domainAlias.delete.title"),description:r("router.domainAlias.delete.description",{domain:i}),confirmPlaceholder:r("router.domainAlias.delete.confirmPlaceholder",{domain:i}),confirm:r("common.delete"),onConfirm:g,onCancel:c},x=b=>{b.stopPropagation(),p(y)};return e.jsxs(e.Fragment,{children:[typeof o=="function"?o({loading:u,open:x}):e.jsxs(te,{edge:"end",onClick:x,size:"small",className:"rule-action",color:"error","data-cy":"action-delete-domain-alias",children:[u?e.jsx(z,{size:16}):e.jsx(_e,{style:{fontSize:16}}),r("common.delete")]}),m&&e.jsx(gt,{keyName:m.keyName,title:m.title,description:m.description,confirmPlaceholder:m.confirmPlaceholder,confirm:m.confirm,params:m.params,onConfirm:m.onConfirm,onCancel:m.onCancel})]})}tn.propTypes={id:t.string.isRequired,domain:t.string.isRequired,children:t.any,teamDid:t.string,onDelete:t.func};function sn({site:n,domain:i,blocklet:o,onDelete:a=()=>{}}){const{t:s}=A(),r=i.value===window.location.hostname;return e.jsx(ht,{"data-cy":"domain-actions",size:"large",actions:[({close:u})=>e.jsx(tn,{id:n.id,domain:i.value,teamDid:o?.meta?.did,onDelete:a,children:({open:l})=>e.jsx(L,{title:r?s("blocklet.router.currentDomainTip"):"",children:e.jsx("span",{children:e.jsxs(Oe,{disabled:i.isProtected||r,dense:!0,onClick:m=>{u(),l(m)},"data-cy":"action-toggle-block",children:[e.jsx(An,{style:{minWidth:24,marginRight:8},children:e.jsx(_e,{})}),e.jsx(kn,{primary:s("common.delete")})]},"remove")})})})]})}sn.propTypes={site:t.object.isRequired,domain:t.object.isRequired,blocklet:t.object.isRequired,onDelete:t.func};const ae=t.shape({href:t.string,accessibility:t.shape({loading:t.bool,accessible:t.bool}),domainStatus:t.shape({isHttps:t.bool,matchedCert:t.object}),dns:t.shape({resolved:t.bool,ip:t.string})});function on({certificate:n={}}){const[i,o]=j.useState(null),a=F(),{t:s,locale:r}=A(),u=p=>{o(p.currentTarget)},l=()=>{o(null)},m=!!i;return e.jsxs(e.Fragment,{children:[e.jsx(Tn,{"aria-owns":m?"mouse-over-popover":void 0,onMouseEnter:u,onMouseLeave:l,style:{color:"#44cdc6",fontSize:"1em",cursor:"pointer"}}),e.jsx($e,{id:"mouse-over-popover",style:{pointerEvents:"none"},open:m,anchorEl:i,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},onClose:l,disableRestoreFocus:!0,children:e.jsx(In,{children:e.jsxs(Pn,{style:{display:"flex"},children:[e.jsx("div",{children:e.jsx("img",{src:`${a.imgPrefix}/https-certificate-icon.png`,alt:"certificate icon",style:{maxHeight:"100%",maxWidth:"100%"}})}),e.jsxs(R,{component:"div",style:{marginLeft:"16px"},children:[e.jsx(R,{component:"div",style:{fontWeight:"bold"},children:n.domain}),e.jsx(R,{component:"div",children:`${s("common.issuer")}: ${Zn(n,"issuer.commonName","")}`}),e.jsx(R,{component:"div",children:`${s("router.cert.issuedOn")}: ${Pe(n.validFrom,r)}`}),e.jsx(R,{component:"div",children:`${s("router.cert.expiryOn")}: ${Pe(n.validTo,r)}`})]})]})})})]})}on.propTypes={certificate:t.object};function ne({domain:n,filters:i=["domain","http"]}){const{t:o}=A(),{value:a,domainStatus:s}=n;if(!Xe(a))return null;let r=null,u=null;const{isHttps:l,matchedCert:m}=s,{dns:{ip:p,isDnsResolved:f,isCnameMatch:c}={}}=s,g=f&&c;rt(a)||(g||p==="127.0.0.1"?r=e.jsx(L,{title:o("router.domain.verify.ok"),children:e.jsx(qe,{color:"success"})}):r=e.jsx(L,{title:o("router.domain.verify.notResolved"),children:e.jsx(qe,{color:"error"})})),g?l?u=e.jsx(on,{certificate:m}):u=e.jsx(L,{title:o("router.domain.https.bad"),children:e.jsx(qn,{style:{color:"#D0021B",fontSize:"1em",cursor:"pointer"}})}):u=e.jsx(L,{title:o("router.domain.verify.notResolved"),children:e.jsx(En,{style:{color:"#D0021B",fontSize:"1em",cursor:"pointer"}})});const y=i.map(x=>x==="domain"?r:x==="http"?u:null);return j.createElement(j.Fragment,null,...y)}ne.propTypes={domain:ae.isRequired,filters:t.array};const Lt=Je(be,"mutate_blocklets"),Ft=Je(be,"",at);function pi(n){const{inService:i}=F(),{blocklet:o,loadingRuntimeInfo:a}=oe();let s=Lt;return i&&(s=Ft),e.jsx(s,{...n,blocklet:o,inService:i,loadingRuntimeInfo:a})}const Fe="nft-domain";function be({hasPermission:n=!1,blocklet:i,loadingRuntimeInfo:o=!1,inService:a=!1,showAllDomains:s=!1,updateBlockletDomainAliases:r=()=>{},systemTips:u=null}){const{t:l}=A(),m=ie(d=>d.breakpoints.down("md")),p=j.useMemo(()=>{let d=n;return lt(i)&&(d=d&&a),d},[n,a,i]),{site:f}=i,c=j.useMemo(()=>Qe(i.site?.domainAliases),[i.site?.domainAliases]),g=j.useMemo(()=>c.filter(d=>!fe.isCustomDomain(d.value)),[c]),y=j.useMemo(()=>c.filter(d=>fe.isCustomDomain(d.value)),[c]),x=j.useMemo(()=>y.filter(d=>d.type!==Fe),[y]),b=j.useMemo(()=>y.filter(d=>d.type===Fe),[y]);return e.jsxs(e.Fragment,{children:[e.jsxs(W,{sx:{gap:3},children:[!!b.length&&e.jsx(Y,{title:l("common.didDomains"),description:l("common.didDomainsDescription"),domains:b,hasMutatePermission:p,blocklet:i,site:f,mobile:m,showAllDomains:s,updateBlockletDomainAliases:r}),!!x.length&&e.jsx(Y,{title:l("common.manualDomains"),description:l("common.manualDomainsDescription"),domains:x,hasMutatePermission:p,blocklet:i,site:f,mobile:m,showAllDomains:s,updateBlockletDomainAliases:r}),!!g.length&&e.jsxs(h,{children:[u,e.jsx(Y,{title:l("common.systemDomains"),description:l("common.systemDomainsDescription"),domains:g,hasMutatePermission:p,blocklet:i,site:f,mobile:m,updateBlockletDomainAliases:r})]})]}),!c.length&&(o?e.jsx(z,{size:16}):e.jsx(wn,{children:l("common.empty")}))]})}be.propTypes={hasPermission:t.bool,blocklet:t.object.isRequired,loadingRuntimeInfo:t.bool,inService:t.bool.isRequired,showAllDomains:t.bool,updateBlockletDomainAliases:t.func,systemTips:t.node};function J({children:n=null}){return e.jsx(h,{component:"span",sx:{verticalAlign:"bottom"},children:n})}J.propTypes={children:t.node};function he({domain:n,children:i,suffix:o=null,...a}){const{t:s,locale:r}=A(),u=H(),{href:l,accessibility:m,value:p}=n,f=j.useCallback(()=>e.jsx(ze,{content:je(p),locale:r,style:{marginLeft:"4px",color:u.palette.text.secondary,fontSize:"0.8em"}}),[p,r,u]);return!m||m.loading?e.jsxs(me,{component:"span",...a,children:[e.jsx(L,{title:void 0,placement:"top-end",children:e.jsx(h,{component:"span",children:i})}),f(),e.jsx(J,{children:o}),e.jsx(L,{title:s("blocklet.router.checkUrlAccessible"),placement:"top-end",children:e.jsx(h,{component:"span",className:"status",children:e.jsx(z,{size:13,style:{fontSize:"13px"}})})})]}):m.accessible?e.jsxs(me,{component:"span",...a,children:[e.jsx(h,{component:"a",href:l,target:"_blank",rel:"noopener noreferrer",sx:{color:n.loading?"text.disabled":void 0},children:e.jsx(L,{title:void 0,placement:"top-end",children:e.jsx(h,{component:"span",children:i})})}),f(),e.jsx(J,{children:o})]}):e.jsxs(me,{component:"span",...a,children:[e.jsx(L,{title:s("blocklet.router.urlInaccessible"),placement:"top-end",children:e.jsx(h,{component:"span",children:i})}),!n.loading&&f(),e.jsx(J,{children:o})]})}he.propTypes={domain:ae.isRequired,children:t.any.isRequired,suffix:t.node};const me=Mn(h)`
|
|
1
|
+
import{at as bn,Q as vn,T as A,b as Cn,H as E,n as te,k as wn,S as ze}from"./vendor-ux-B9VfuZTg.js";import{j as e,cR as Ne,cS as Sn,ak as h,a6 as z,b0 as Rn,T as R,aX as ye,D as H,J as ie,am as L,aN as $e,W as t,bb as _e,M as Oe,aO as An,aP as kn,cT as Tn,b7 as In,b9 as Pn,cU as qn,cV as En,b1 as W,P as We,ci as Ln,bh as Fn,at as Mn,a$ as Bn,cW as Un,cX as zn,cY as Nn,cZ as $n,c_ as Te,c$ as _,d0 as _n,z as On,n as Wn,bf as Hn,d1 as Vn,cb as Gn}from"./vendor-mui-core-DRxbhqaK.js";import{C as ee,J as Xn,a as Qn,e as Zn,H as je,a4 as Jn,a5 as Kn,n as Q}from"./vendor-utils-CUDP56Ff.js";import{r as j,e as He,g as Yn}from"./vendor-react-Dvs43sk9.js";import{u as se}from"./useSetState-DFuQZPPV.js";import{l as et,k as nt,b as Z,m as tt,w as it}from"./vendor-hooks-BlA8TRnZ.js";import{bg as Ve,ai as Ge,bh as st,bi as Xe,X as F,a9 as oe,V as Ie,$ as ot,aL as Pe,bj as rt,B as at,ab as lt,bk as Qe,aa as fe,bl as Ze,bm as ct,bn as dt,bo as mt,aV as ut,e as xe,bp as pt,bq as ft}from"./index-C5weIh5R.js";import{w as Je}from"./permission-BeGf253a.js";import{u as xt,D as qe}from"./useAsyncRetry-EEjDgDMR.js";import{C as re}from"./confirm-CRSsToIg.js";import{A as ht}from"./actions-B4VXcSRp.js";import{D as gt}from"./delete-confirm-BOL7KX0x.js";import{o as Ee}from"./vendor-arcblock-DeeG8u0h.js";import{u as Dt}from"./useAsync-fWwm3Jbj.js";import{f as N}from"./index-DBs9Ljax.js";import{v as yt}from"./index-Ba9-ArMT.js";import{g as jt,p as Le}from"./util-DY1uHmM4.js";import{C as bt}from"./click-to-copy-CO6UIqva.js";const vt=Ve({});vt.interceptors.request.use(n=>{const i=window.blocklet?window.blocklet.prefix:"/";return n.baseURL=i||"",n.url=ee("/api",String(n.url)),n.timeout=2e5,n.params=n.params||{},new URLSearchParams(n.url.split("?")[1]).has("locale")||(n.params.locale=bn()),n},n=>Promise.reject(n));const Ke=(...n)=>Ve(...n),Ct=(n,i)=>i?n?[n,...Array.isArray(i)?i:[i]]:i:n,wt=(n,{width:i=600,height:o=700,name:a="did-domain:popup"}={})=>{const s=window.screenX+(window.innerWidth-i)/2,r=window.screenY+(window.innerHeight-o)/2,u=[`left=${s}`,`top=${r}`,`width=${i}`,`height=${o}`,"resizable=no","scrollbars=yes","status=yes","popup=yes"],l=window.open("",a,u.join(","));if(l===null)throw new Error("Failed to open popup");return l.location.href=Xn(n,{opener:window.location.origin}),l},St="z2qaGosS3rZ7m5ttP3Nd4V4qczR9TryTcRV4p",Ye=async n=>{if(!n||!n?.trim())return null;const i=Ke(),o=new URL(n);o.pathname="__blocklet__.js",o.searchParams.set("type","json");const{data:a}=await i.get(o.toString()),s=a?.componentMountPoints?.find(m=>m.did===St),r=new URL(n);r.pathname=s?.mountPoint;const u=r.toString(),l=ee(u,"/api");return{base:u,api:l}},Rt=Ge({embed:{iconTip:"Click to view subscription details"},buy:{button:{title:"Buy DID Domain"},status:{inProgress:"Please wait while we are processing your request, the domain will be automatically resolved to the current app after the purchase...",success:"Purchase completed!"},error:{failedToCreateSession:"Failed to create session"}}}),At=Ge({embed:{iconTip:"点击查看订阅详情"},buy:{button:{title:"购买 DID 域名"},status:{inProgress:"请稍等,我们正在处理您的请求,购买域名后会自动解析到当前的应用...",success:"购买完成!"},error:{failedToCreateSession:"创建会话失败"}}}),kt={zh:At,en:Rt},Tt=async({didDomainURL:n,delegatee:i,delegateePk:o})=>{const a=await Ye(n);if(!a)return null;const s=Ke({baseURL:a.api}),{data:r}=await s.post("/payment/session",{delegatee:i,delegateePk:o});return{sessionId:r.sessionId,baseURL:a.base}};function It({delegatee:n,delegateePk:i,didDomainURL:o,locale:a,title:s="",onSuccess:r=()=>{},...u}){const{t:l}=A(),[m,p]=et({currentState:1}),f=j.useRef(null),c=nt(async()=>{const d=await Tt({didDomainURL:o,delegatee:n,delegateePk:i});return d},{debounceWait:500,debounceLeading:!0,debounceTrailing:!1,debounceMaxWait:3e3,refreshDeps:[],onError(d){console.error(d)}}),g=Z(d=>{d.data.type==="didDomain.success"&&(r?.({nftDid:d.data?.nftDid,domain:d.data?.domain,chainHost:d.data?.chainHost}),f.current?.close(),f.current=null,p({currentState:4}),setTimeout(()=>{p({currentState:8})},2e3))});tt(()=>{try{window.removeEventListener("message",g),f.current?.close(),f.current=null}catch(d){console.warn("Failed to close popup",d)}});const y=Z(()=>{p({currentState:1})}),x=Z(()=>{if(p({currentState:2}),!c.data){console.error("Failed to create session");return}b({sessionId:c.data.sessionId,baseURL:c.data.baseURL})}),b=Z(({sessionId:d,baseURL:w})=>{window.addEventListener("message",g);const C=new URL(w);C.searchParams.set("sessionId",d),C.searchParams.set("locale",a),C.searchParams.set("embed","1"),f.current=wt(C.toString());const q=setInterval(()=>{f.current?.closed&&(clearInterval(q),y())},1e3);return()=>clearInterval(q)});return e.jsxs(e.Fragment,{children:[e.jsx(Ne,{loading:c.loading,onClick:x,variant:"contained",startIcon:e.jsx(Sn,{}),...u,children:s||l("buy.button.title")}),e.jsxs(Cn,{fullWidth:!0,maxWidth:"xs",open:m.currentState>1&&m.currentState<8,onClose:y,children:[!c.error&&e.jsxs(h,{sx:{display:"flex",alignItems:"center",flexDirection:"column",gap:2},children:[m.currentState===2&&e.jsx(z,{size:50}),m.currentState===4&&e.jsx(Rn,{sx:{color:"primary.main",fontSize:"5rem"}}),m.currentState===2&&e.jsx(R,{children:l("buy.status.inProgress")}),m.currentState===4&&e.jsx(R,{children:l("buy.status.success")})]}),c.error&&e.jsx(ye,{severity:"error",children:l("buy.error.failedToCreateSession")})]})]})}function Pt(n){return e.jsx(vn,{locale:n.locale,translations:kt,children:e.jsx(It,{...n})})}function qt({nftDid:n,didDomainURL:i,locale:o,sx:a={}}){const{t:s}=A(),[r,u]=se({safeIframeRef:null,popoverAnchorEl:null}),l=j.useRef(null),m=H(),p=ie(m.breakpoints.down("md")),f=x=>{u({popoverAnchorEl:x.currentTarget})},c=()=>{u({popoverAnchorEl:null})},g=it(async()=>{const x=await Ye(i);return x?x.base:null});if(!g.value)return null;if(g.loading)return e.jsx(z,{});const y=ee(g.value,`/embed/domain?nft-did=${n}&locale=${o}`);return e.jsxs(e.Fragment,{children:[e.jsx(L,{title:s("embed.iconTip"),children:e.jsx(h,{component:"img",src:ee(i,"/.well-known/service/blocklet/logo"),alt:"logo",onClick:f,sx:[{width:16,height:16},Ct({cursor:"pointer"},a)]})}),e.jsx($e,{id:"popover-info",open:!!r.popoverAnchorEl,anchorEl:r.popoverAnchorEl,onClose:c,anchorOrigin:{vertical:"bottom",horizontal:"right"},children:e.jsx("iframe",{ref:l,title:s("common.subscription"),width:p?"320px":"400px",height:"350px",style:{border:0,display:"block"},src:y})})]})}const Et=n=>["waiting","creating","renewaling"].includes(n);function en({siteId:n,domain:i,onAdd:o=()=>{},children:a=null,did:s,issuing:r=!1,setIssuing:u=()=>{}}){const{t:l}=A(),[m,p]=j.useState(!1),{inService:f}=F(),[c,g]=j.useState(null),{api:y,ws:{useSubscription:x}}=F(),{mode:b,actions:{refreshDomainStatus:d}}=oe(),w=xt(async()=>{const{cert:T}=await y.findCertificateByDomain({input:{domain:i,did:s}});return T}),C=(T,S)=>{T.domain===i&&(u(!1),p(!1),f&&b!=="setup"&&(S==="success"?E.success(l("setup.domain.genCertSuccess",{domain:T.domain})):S==="error"&&E.error(l("setup.domain.genCertFailed",{domain:T.domain,message:T.message}))))};if(j.useEffect(()=>{w.loading||u(Et(w.value?.status))},[w.loading,w.value?.status,u]),x(Ie.BlockletEvents.certError,T=>C(T,"error")),x(Ie.BlockletEvents.certIssued,T=>{w.retry(),d(T.domain),C(T,"success")}),w.loading||w.value?.status==="normal")return"";const q=()=>{p(!1),g(null)},B=async()=>{p(!0);try{await y.issueLetsEncryptCert({input:{siteId:n,domain:i,did:s,inBlockletSetup:b==="setup"}}),o(),u(!0)}catch(T){console.error(T),u(!1)}finally{p(!1),g(null)}},M={title:l("router.cert.genLetsEncryptCert.title"),description:e.jsxs("div",{children:[e.jsx(ye,{severity:"success",children:l("router.cert.genLetsEncryptCert.dnsTip")}),l("router.cert.genLetsEncryptCert.description")]}),confirm:l("common.confirm"),onConfirm:B,onCancel:q},U=T=>{T.stopPropagation(),g(M)};return e.jsxs(e.Fragment,{children:[r?e.jsx(L,{title:l("router.cert.issuing"),children:e.jsx(z,{size:13,style:{fontSize:"13px"}})}):a({loading:m,open:U}),c&&e.jsx(re,{color:"primary",title:c.title,description:c.description,confirm:c.confirm,params:c.params,onConfirm:c.onConfirm,onCancel:c.onCancel})]})}en.propTypes={domain:t.string.isRequired,did:t.string.isRequired,siteId:t.string.isRequired,onAdd:t.func,children:t.any,issuing:t.bool,setIssuing:t.func};function nn({domain:n,domainStatus:i,did:o,onAdd:a=()=>{},children:s=null,issuing:r=!1,setIssuing:u=()=>{},...l}){return st(n)||!Xe(n)||Qn(i)||i?.isHttps?"":e.jsx(en,{...l,domain:n,did:o,onAdd:a,issuing:r,setIssuing:u,children:s})}nn.propTypes={domain:t.string.isRequired,domainStatus:t.shape({isHttps:t.bool}).isRequired,did:t.string.isRequired,onAdd:t.func,children:t.any,issuing:t.bool,setIssuing:t.func};function tn({id:n,domain:i,children:o=null,teamDid:a="",onDelete:s=null}){const{t:r}=A(),[u,l]=j.useState(!1),[m,p]=j.useState(null),{api:f}=F(),c=()=>{l(!1),p(null)},g=async()=>{l(!0);try{await f.deleteDomainAlias({input:{id:n,domainAlias:i,teamDid:a}}),s?.(),await ot(2e3)}catch(b){E.error(b.message)}finally{p(null),l(!1)}},y={keyName:i,title:r("router.domainAlias.delete.title"),description:r("router.domainAlias.delete.description",{domain:i}),confirmPlaceholder:r("router.domainAlias.delete.confirmPlaceholder",{domain:i}),confirm:r("common.delete"),onConfirm:g,onCancel:c},x=b=>{b.stopPropagation(),p(y)};return e.jsxs(e.Fragment,{children:[typeof o=="function"?o({loading:u,open:x}):e.jsxs(te,{edge:"end",onClick:x,size:"small",className:"rule-action",color:"error","data-cy":"action-delete-domain-alias",children:[u?e.jsx(z,{size:16}):e.jsx(_e,{style:{fontSize:16}}),r("common.delete")]}),m&&e.jsx(gt,{keyName:m.keyName,title:m.title,description:m.description,confirmPlaceholder:m.confirmPlaceholder,confirm:m.confirm,params:m.params,onConfirm:m.onConfirm,onCancel:m.onCancel})]})}tn.propTypes={id:t.string.isRequired,domain:t.string.isRequired,children:t.any,teamDid:t.string,onDelete:t.func};function sn({site:n,domain:i,blocklet:o,onDelete:a=()=>{}}){const{t:s}=A(),r=i.value===window.location.hostname;return e.jsx(ht,{"data-cy":"domain-actions",size:"large",actions:[({close:u})=>e.jsx(tn,{id:n.id,domain:i.value,teamDid:o?.meta?.did,onDelete:a,children:({open:l})=>e.jsx(L,{title:r?s("blocklet.router.currentDomainTip"):"",children:e.jsx("span",{children:e.jsxs(Oe,{disabled:i.isProtected||r,dense:!0,onClick:m=>{u(),l(m)},"data-cy":"action-toggle-block",children:[e.jsx(An,{style:{minWidth:24,marginRight:8},children:e.jsx(_e,{})}),e.jsx(kn,{primary:s("common.delete")})]},"remove")})})})]})}sn.propTypes={site:t.object.isRequired,domain:t.object.isRequired,blocklet:t.object.isRequired,onDelete:t.func};const ae=t.shape({href:t.string,accessibility:t.shape({loading:t.bool,accessible:t.bool}),domainStatus:t.shape({isHttps:t.bool,matchedCert:t.object}),dns:t.shape({resolved:t.bool,ip:t.string})});function on({certificate:n={}}){const[i,o]=j.useState(null),a=F(),{t:s,locale:r}=A(),u=p=>{o(p.currentTarget)},l=()=>{o(null)},m=!!i;return e.jsxs(e.Fragment,{children:[e.jsx(Tn,{"aria-owns":m?"mouse-over-popover":void 0,onMouseEnter:u,onMouseLeave:l,style:{color:"#44cdc6",fontSize:"1em",cursor:"pointer"}}),e.jsx($e,{id:"mouse-over-popover",style:{pointerEvents:"none"},open:m,anchorEl:i,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},onClose:l,disableRestoreFocus:!0,children:e.jsx(In,{children:e.jsxs(Pn,{style:{display:"flex"},children:[e.jsx("div",{children:e.jsx("img",{src:`${a.imgPrefix}/https-certificate-icon.png`,alt:"certificate icon",style:{maxHeight:"100%",maxWidth:"100%"}})}),e.jsxs(R,{component:"div",style:{marginLeft:"16px"},children:[e.jsx(R,{component:"div",style:{fontWeight:"bold"},children:n.domain}),e.jsx(R,{component:"div",children:`${s("common.issuer")}: ${Zn(n,"issuer.commonName","")}`}),e.jsx(R,{component:"div",children:`${s("router.cert.issuedOn")}: ${Pe(n.validFrom,r)}`}),e.jsx(R,{component:"div",children:`${s("router.cert.expiryOn")}: ${Pe(n.validTo,r)}`})]})]})})})]})}on.propTypes={certificate:t.object};function ne({domain:n,filters:i=["domain","http"]}){const{t:o}=A(),{value:a,domainStatus:s}=n;if(!Xe(a))return null;let r=null,u=null;const{isHttps:l,matchedCert:m}=s,{dns:{ip:p,isDnsResolved:f,isCnameMatch:c}={}}=s,g=f&&c;rt(a)||(g||p==="127.0.0.1"?r=e.jsx(L,{title:o("router.domain.verify.ok"),children:e.jsx(qe,{color:"success"})}):r=e.jsx(L,{title:o("router.domain.verify.notResolved"),children:e.jsx(qe,{color:"error"})})),g?l?u=e.jsx(on,{certificate:m}):u=e.jsx(L,{title:o("router.domain.https.bad"),children:e.jsx(qn,{style:{color:"#D0021B",fontSize:"1em",cursor:"pointer"}})}):u=e.jsx(L,{title:o("router.domain.verify.notResolved"),children:e.jsx(En,{style:{color:"#D0021B",fontSize:"1em",cursor:"pointer"}})});const y=i.map(x=>x==="domain"?r:x==="http"?u:null);return j.createElement(j.Fragment,null,...y)}ne.propTypes={domain:ae.isRequired,filters:t.array};const Lt=Je(be,"mutate_blocklets"),Ft=Je(be,"",at);function pi(n){const{inService:i}=F(),{blocklet:o,loadingRuntimeInfo:a}=oe();let s=Lt;return i&&(s=Ft),e.jsx(s,{...n,blocklet:o,inService:i,loadingRuntimeInfo:a})}const Fe="nft-domain";function be({hasPermission:n=!1,blocklet:i,loadingRuntimeInfo:o=!1,inService:a=!1,showAllDomains:s=!1,updateBlockletDomainAliases:r=()=>{},systemTips:u=null}){const{t:l}=A(),m=ie(d=>d.breakpoints.down("md")),p=j.useMemo(()=>{let d=n;return lt(i)&&(d=d&&a),d},[n,a,i]),{site:f}=i,c=j.useMemo(()=>Qe(i.site?.domainAliases),[i.site?.domainAliases]),g=j.useMemo(()=>c.filter(d=>!fe.isCustomDomain(d.value)),[c]),y=j.useMemo(()=>c.filter(d=>fe.isCustomDomain(d.value)),[c]),x=j.useMemo(()=>y.filter(d=>d.type!==Fe),[y]),b=j.useMemo(()=>y.filter(d=>d.type===Fe),[y]);return e.jsxs(e.Fragment,{children:[e.jsxs(W,{sx:{gap:3},children:[!!b.length&&e.jsx(Y,{title:l("common.didDomains"),description:l("common.didDomainsDescription"),domains:b,hasMutatePermission:p,blocklet:i,site:f,mobile:m,showAllDomains:s,updateBlockletDomainAliases:r}),!!x.length&&e.jsx(Y,{title:l("common.manualDomains"),description:l("common.manualDomainsDescription"),domains:x,hasMutatePermission:p,blocklet:i,site:f,mobile:m,showAllDomains:s,updateBlockletDomainAliases:r}),!!g.length&&e.jsxs(h,{children:[u,e.jsx(Y,{title:l("common.systemDomains"),description:l("common.systemDomainsDescription"),domains:g,hasMutatePermission:p,blocklet:i,site:f,mobile:m,updateBlockletDomainAliases:r})]})]}),!c.length&&(o?e.jsx(z,{size:16}):e.jsx(wn,{children:l("common.empty")}))]})}be.propTypes={hasPermission:t.bool,blocklet:t.object.isRequired,loadingRuntimeInfo:t.bool,inService:t.bool.isRequired,showAllDomains:t.bool,updateBlockletDomainAliases:t.func,systemTips:t.node};function J({children:n=null}){return e.jsx(h,{component:"span",sx:{verticalAlign:"bottom"},children:n})}J.propTypes={children:t.node};function he({domain:n,children:i,suffix:o=null,...a}){const{t:s,locale:r}=A(),u=H(),{href:l,accessibility:m,value:p}=n,f=j.useCallback(()=>e.jsx(ze,{content:je(p),locale:r,style:{marginLeft:"4px",color:u.palette.text.secondary,fontSize:"0.8em"}}),[p,r,u]);return!m||m.loading?e.jsxs(me,{component:"span",...a,children:[e.jsx(L,{title:void 0,placement:"top-end",children:e.jsx(h,{component:"span",children:i})}),f(),e.jsx(J,{children:o}),e.jsx(L,{title:s("blocklet.router.checkUrlAccessible"),placement:"top-end",children:e.jsx(h,{component:"span",className:"status",children:e.jsx(z,{size:13,style:{fontSize:"13px"}})})})]}):m.accessible?e.jsxs(me,{component:"span",...a,children:[e.jsx(h,{component:"a",href:l,target:"_blank",rel:"noopener noreferrer",sx:{color:n.loading?"text.disabled":void 0},children:e.jsx(L,{title:void 0,placement:"top-end",children:e.jsx(h,{component:"span",children:i})})}),f(),e.jsx(J,{children:o})]}):e.jsxs(me,{component:"span",...a,children:[e.jsx(L,{title:s("blocklet.router.urlInaccessible"),placement:"top-end",children:e.jsx(h,{component:"span",children:i})}),!n.loading&&f(),e.jsx(J,{children:o})]})}he.propTypes={domain:ae.isRequired,children:t.any.isRequired,suffix:t.node};const me=Mn(h)`
|
|
2
2
|
display: inline-block;
|
|
3
3
|
vertical-align: middle;
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as m}from"./vendor-react-Dvs43sk9.js";import{T as n}from"./vendor-ux-B9VfuZTg.js";import{a9 as p,X as l,ab as c,e as u}from"./index-
|
|
1
|
+
import{r as m}from"./vendor-react-Dvs43sk9.js";import{T as n}from"./vendor-ux-B9VfuZTg.js";import{a9 as p,X as l,ab as c,e as u}from"./index-C5weIh5R.js";import{a as x,b as d}from"./domain-action-card-BYDa5XpT.js";import{j as t,ak as k,b1 as f,aX as h}from"./vendor-mui-core-DRxbhqaK.js";import"./vendor-utils-CUDP56Ff.js";import"./vendor-hooks-BlA8TRnZ.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DeeG8u0h.js";import"./useSetState-DFuQZPPV.js";import"./permission-BeGf253a.js";import"./session-DEBZccHT.js";import"./useAsyncRetry-EEjDgDMR.js";import"./useAsync-DVtDVEv6.js";import"./confirm-CRSsToIg.js";import"./index-DBs9Ljax.js";import"./actions-B4VXcSRp.js";import"./delete-confirm-BOL7KX0x.js";import"./click-to-copy-CO6UIqva.js";import"./useAsync-fWwm3Jbj.js";import"./index-Ba9-ArMT.js";import"./util-DY1uHmM4.js";import"./engine-Dde2jLpF.js";function G(){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:{gap:3,maxWidth:820},children:[t.jsxs(t.Fragment,{children:[u.isAccessible(o.status)===!1&&t.jsx(h,{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})]})}export{G as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{T as M,e as q,_ as w,H as C,f as Q,h as J}from"./vendor-ux-B9VfuZTg.js";import{j as t,b1 as f,b0 as X,b2 as Z,T as b,Q as T,a$ as ee,ak as B,z as $,a6 as te,at as se}from"./vendor-mui-core-DRxbhqaK.js";import{r as n,u as ie}from"./vendor-react-Dvs43sk9.js";import{H as g}from"./vendor-utils-CUDP56Ff.js";import{a as ne,I as h,d as O,c as j,H as oe,J as re}from"./index-
|
|
1
|
+
import{T as M,e as q,_ as w,H as C,f as Q,h as J}from"./vendor-ux-B9VfuZTg.js";import{j as t,b1 as f,b0 as X,b2 as Z,T as b,Q as T,a$ as ee,ak as B,z as $,a6 as te,at as se}from"./vendor-mui-core-DRxbhqaK.js";import{r as n,u as ie}from"./vendor-react-Dvs43sk9.js";import{H as g}from"./vendor-utils-CUDP56Ff.js";import{a as ne,I as h,d as O,c as j,H as oe,J as re}from"./index-C5weIh5R.js";import{l as ae}from"./vendor-arcblock-DeeG8u0h.js";import{K as ce}from"./landing-page-BTu1Wo51.js";import{f as _}from"./index-DBs9Ljax.js";import{g as D}from"./get-safe-url-BVWVLDco.js";import"./vendor-hooks-BlA8TRnZ.js";import"./lottie-web-4koyQiv_.js";const le=se.form`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
align-items: center;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a2 as e}from"./index-C5weIh5R.js";var a=e();export{a as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,a6 as P,ak as E}from"./vendor-mui-core-DRxbhqaK.js";import{r as T,i as k}from"./vendor-react-Dvs43sk9.js";import{o as j}from"./vendor-arcblock-DeeG8u0h.js";import{T as C,H as d,u as S}from"./vendor-ux-B9VfuZTg.js";import{t as W,c as I,S as R,s as v,b as U}from"./index-
|
|
1
|
+
import{j as e,a6 as P,ak as E}from"./vendor-mui-core-DRxbhqaK.js";import{r as T,i as k}from"./vendor-react-Dvs43sk9.js";import{o as j}from"./vendor-arcblock-DeeG8u0h.js";import{T as C,H as d,u as S}from"./vendor-ux-B9VfuZTg.js";import{t as W,c as I,S as R,s as v,b as U}from"./index-C5weIh5R.js";import{K as b}from"./landing-page-BTu1Wo51.js";import{w as L}from"./wrap-locale-DtJXVWeM.js";import{g as N}from"./get-safe-url-BVWVLDco.js";import"./vendor-utils-CUDP56Ff.js";import"./vendor-hooks-BlA8TRnZ.js";import"./lottie-web-4koyQiv_.js";function _({SessionContext:n,webWalletUrl:a,onSuccess:o}){const{api:t,session:i}=T.useContext(n),{t:s,locale:h}=C(),f=k(),{searchParams:p}=new URL(window.location.href),l=p.get("redirect"),g=async(r,w)=>{o(r,w),await i.refresh(),d.success(s("exchangePassport.success")),setTimeout(()=>{if(l){const c=decodeURIComponent(l);c.startsWith(I.WELLKNOWN_SERVICE_PATH_PREFIX)?f(c,{replace:!0}):window.location.href=N(c)}else window.location.href=window.env.pathPrefix||window.env.apiPrefix||"/"},3e3)},u=r=>{d.error(r.message)},m={},x=p.get("componentId");return x&&(m.componentId=x),i.loading?e.jsx(j,{children:e.jsx(P,{})}):e.jsx(b,{did:window?.blocklet?.appPid||window?.env?.appPid,children:e.jsx(E,{sx:{maxWidth:"100%",height:"100%"},children:e.jsx(W,{popup:!0,open:!0,className:"connect",action:"exchange-passport",checkFn:t.get,checkTimeout:10*60*1e3,webWalletUrl:a,onSuccess:g,onError:u,locale:h,messages:{title:s("exchangePassport.dialog.title"),scan:s("exchangePassport.dialog.scan"),confirm:s("exchangePassport.dialog.confirm"),success:s("exchangePassport.dialog.success")},extraParams:m,extraContent:null,hideCloseButton:!0})})})}const B=L(_);function z(){const n=S(),a=(o,t)=>{o.sessionToken&&(v(t(o.sessionToken)),U(t(o.refreshToken)))};return e.jsx(B,{SessionContext:R,webWalletUrl:n,onSuccess:a})}export{z as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{D as w,j as o,a6 as v,T as B,bp as S}from"./vendor-mui-core-DRxbhqaK.js";import{o as T}from"./vendor-arcblock-DeeG8u0h.js";import{T as k,b as M}from"./vendor-ux-B9VfuZTg.js";import{r as _}from"./vendor-react-Dvs43sk9.js";import{l as P}from"./vendor-hooks-BlA8TRnZ.js";import{a4 as F,L as D}from"./index-
|
|
1
|
+
import{D as w,j as o,a6 as v,T as B,bp as S}from"./vendor-mui-core-DRxbhqaK.js";import{o as T}from"./vendor-arcblock-DeeG8u0h.js";import{T as k,b as M}from"./vendor-ux-B9VfuZTg.js";import{r as _}from"./vendor-react-Dvs43sk9.js";import{l as P}from"./vendor-hooks-BlA8TRnZ.js";import{a4 as F,L as D}from"./index-C5weIh5R.js";import"./vendor-utils-CUDP56Ff.js";import"./lottie-web-4koyQiv_.js";const{Elements:I,PaymentElement:R,useElements:z,useStripe:N,loadStripe:L,LinkAuthenticationElement:O}=globalThis.__STRIPE_COMPONENTS__,W=S("div")`
|
|
2
2
|
width: 100%;
|
|
3
3
|
opacity: 0;
|
|
4
4
|
transition: opacity 300ms ease;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e,ak as s,a6 as w,a$ as B,bd as N,at as I,W as d}from"./vendor-mui-core-DRxbhqaK.js";import{r as l}from"./vendor-react-Dvs43sk9.js";import{C as $}from"./vendor-utils-CUDP56Ff.js";import{c as v}from"./vendor-ux-B9VfuZTg.js";import{l as L,a as E,t as z}from"./index-
|
|
1
|
+
import{j as e,ak as s,a6 as w,a$ as B,bd as N,at as I,W as d}from"./vendor-mui-core-DRxbhqaK.js";import{r as l}from"./vendor-react-Dvs43sk9.js";import{C as $}from"./vendor-utils-CUDP56Ff.js";import{c as v}from"./vendor-ux-B9VfuZTg.js";import{l as L,a as E,t as z}from"./index-C5weIh5R.js";import{W as A}from"./did-address-DnFNwELW.js";import{a as D}from"./page-header-DvSb4Cmz.js";import{S as F}from"./layout-_Ka_GN5x.js";import{S as P}from"./step-actions-z2PSGmvy.js";import{S as m}from"./button-BmGMF4AE.js";import"./vendor-hooks-BlA8TRnZ.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DeeG8u0h.js";import"./content-layout-B9tc9LCL.js";import"./use-mobile-D6YQgajG.js";function R({onNext:n=()=>{},onPrevious:x=()=>{}}){const{locale:u,t}=l.useContext(v),{blocklet:a,gas:c,tokenInfo:f,actions:h}=L(),{api:j}=E(),[y,o]=l.useState(!1),{need:p="",current:g="",owe:r=99999,deficiency:k,symbol:b="",endpoint:i}=c||{},{origin:C="/"}=i?new URL(i):{};l.useEffect(()=>{const W=setInterval(()=>{h.refreshFuel()},2e3);return()=>{clearInterval(W)}},[]);const S=()=>{o(!1)};return c?e.jsxs(T,{children:[e.jsx("div",{className:"header",children:e.jsx(D,{title:t("setup.fuel.title"),onClickBack:x})}),e.jsxs(s,{className:"qr-body",children:[e.jsxs(s,{className:"tip",sx:{mb:6},children:[t("setup.fuel.tipStart").replace("slot",""),e.jsx("span",{className:"amount",children:`${p} ${b}`}),t("setup.fuel.tipEnd")]}),e.jsx(s,{sx:{fontSize:16,fontWeight:"fontWeightBold",mb:.5},children:t("setup.fuel.addressTitle")}),e.jsxs(s,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(A,{className:"address",did:a.appDid}),e.jsx(B,{style:{lineHeight:1},target:"_blank",href:$(C,"/explorer/accounts/",a.appDid),underline:"hover",children:e.jsx(N,{className:"icon-launch"})})]}),e.jsx(s,{sx:{my:2},children:e.jsx(m,{color:"primary",onClick:()=>o(!0),disabled:!r,children:t("setup.fuel.fuelApp")})}),e.jsx(z,{popup:!0,open:y,action:"fuel",checkFn:j.get,checkTimeout:10*60*1e3,onSuccess:S,onClose:()=>o(!1),locale:u,messages:{title:t("setup.connect.title"),scan:t("setup.connect.scan"),confirm:t("setup.connect.confirm"),success:t("setup.connect.success")},extraParams:{amount:k,...f,endpoint:i}}),e.jsxs(s,{sx:{display:"flex",color:"text.secondary"},children:[e.jsxs(s,{sx:{display:"flex"},children:[e.jsxs(s,{children:[t("setup.fuel.need"),":"]}),e.jsx(s,{sx:{ml:.5,color:"primary.main",fontWeight:"fontWeightBold"},children:p})]}),e.jsxs(s,{sx:{display:"flex",ml:3},children:[e.jsxs(s,{children:[t("setup.fuel.current"),":"]}),e.jsx(s,{sx:{ml:.5,color:r>0?"error.main":"primary.main",fontWeight:"fontWeightBold"},children:g})]})]})]}),e.jsx(P,{mt:8,children:e.jsx(m,{disabled:r>0,onClick:()=>n(),children:t("setup.next")})})]}):e.jsx(s,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%"},children:e.jsx(w,{})})}R.propTypes={onNext:d.func,onPrevious:d.func};const T=I(F)`
|
|
2
2
|
.qr-body {
|
|
3
3
|
width: 580px;
|
|
4
4
|
${n=>n.theme.breakpoints.down("md")} {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{D as E,j as e,Q as S,b3 as P,b0 as R,ak as r,T as c,a6 as _}from"./vendor-mui-core-DRxbhqaK.js";import{a as I,Q as L,c as N,r as p,R as T,T as W}from"./index-
|
|
1
|
+
import{D as E,j as e,Q as S,b3 as P,b0 as R,ak as r,T as c,a6 as _}from"./vendor-mui-core-DRxbhqaK.js";import{a as I,Q as L,c as N,r as p,R as T,T as W}from"./index-C5weIh5R.js";import{o as A}from"./vendor-arcblock-DeeG8u0h.js";import{c as D}from"./vendor-ux-B9VfuZTg.js";import{g as U,b as w}from"./vendor-hooks-BlA8TRnZ.js";import{i as z,r as i,u as F}from"./vendor-react-Dvs43sk9.js";import{K as a}from"./landing-page-BTu1Wo51.js";import{C as K}from"./vendor-utils-CUDP56Ff.js";import{u as M}from"./use-window-close-CAdGHigF.js";import"./lottie-web-4koyQiv_.js";function Z(){const m=z(),l=i.useRef(null),{t:s,locale:d}=i.useContext(D),{api:x,connectApi:f}=I(),[h]=F(),j=E(),k=M(),n=U({ready:!1,success:!1,error:null,invalidSession:!1}),b=()=>{try{const o=new URL(window.location.href);if(o.hash.includes("invalid")){n.invalidSession=!0;return}const u=o.searchParams.get("__connect_url__"),v=T(u);if(!W(v))throw new Error("No token");n.ready=!0}catch{n.invalidSession=!0,m("#invalid",{replace:!0})}};i.useLayoutEffect(()=>b(),[]);const C=w(o=>{n.error=o.message,window.opener?.postMessage({type:"connect-endpoint-message",error:n.error},"*"),m("#invalid",{replace:!0})}),g=w(()=>{window.opener?.postMessage({type:"connect-endpoint-message",success:!0},"*"),n.success=!0}),t=h.get("source")||"Generate Access Key";i.useEffect(()=>{l.current&&n.ready&&f.open({locale:d,containerEl:l.current,action:"gen-access-key",extraParams:{remark:t},checkFn:x.get,saveConnect:!1,forceConnected:!1,className:"connect",popup:!1,baseUrl:window.location.origin,prefix:K(window.location.origin,N.WELLKNOWN_SERVICE_PATH_PREFIX,L),messages:{title:s("connectCli.title"),scan:s("connectCli.scan"),confirm:s("auth.confirm"),success:s("connectCli.success")},onSuccess:g,onError:C},{locale:d})},[f,n.ready,x,C,g,d,s,t]);const y=e.jsx(S,{variant:"outlined",color:"primary",size:"small",startIcon:e.jsx(P,{}),href:"/",style:{borderRadius:4},children:s("connectCli.home")});if(n.invalidSession)return e.jsx(a,{did:window.blocklet?.appPid,standalone:!0,children:e.jsx(p,{style:{backgroundColor:"transparent"},status:"error",title:s("connectCli.invalidSession"),description:s("connectCli.invalidSessionDesc"),extra:y})},"invalid");if(n.error){const o=n.error,u=y;return e.jsx(a,{did:window.blocklet?.appPid,standalone:!0,children:e.jsx(p,{style:{backgroundColor:"transparent"},status:"error",title:s("connectCli.connectionError"),description:o,extra:u})},"error")}return n.success?(h.has("closeOnSuccess")&&k(),e.jsx(a,{did:window.blocklet?.appPid,standalone:!0,children:e.jsx(p,{style:{backgroundColor:"transparent"},status:"info",icon:e.jsx(R,{style:{color:j.palette.success.main,fontSize:72}}),title:s("connectCli.success",{source:t}),description:`${s("connectCli.successDesc",{source:t})} ${s("connectCli.upload")}`})},"success")):n.ready?e.jsx(a,{did:window.blocklet?.appPid,standalone:!0,children:e.jsxs(r,{sx:{maxWidth:"100%",height:"100%"},children:[e.jsxs(r,{sx:{mb:5},children:[e.jsx(c,{variant:"h4",component:"h1",sx:{mb:1,fontWeight:"bold",textAlign:"center"},children:s("connectCli.tips.title")}),e.jsxs(r,{sx:{display:"flex",flexDirection:"column",gap:1,alignItems:"center"},children:[e.jsx(c,{sx:{color:"text.secondary"},children:s("connectCli.tips.item1")}),e.jsx(c,{sx:{color:"text.secondary"},children:s("connectCli.tips.item2")}),e.jsx(c,{sx:{color:"text.secondary"},children:s("connectCli.tips.item3")})]})]}),e.jsx(r,{sx:{display:"inline-block"},ref:l})]})},"ready"):e.jsx(A,{children:e.jsx(_,{})})}export{Z as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,ak as a,T as y,a6 as M,b1 as X,Q as K,a$ as Y,D as Z,aX as W,bN as F,b0 as ee}from"./vendor-mui-core-DRxbhqaK.js";import{r as d,i as se,u as ne}from"./vendor-react-Dvs43sk9.js";import{K as te,at as oe,a as re,d as ie,R as $,r as ae,au as ce,c as le}from"./index-
|
|
1
|
+
import{j as e,ak as a,T as y,a6 as M,b1 as X,Q as K,a$ as Y,D as Z,aX as W,bN as F,b0 as ee}from"./vendor-mui-core-DRxbhqaK.js";import{r as d,i as se,u as ne}from"./vendor-react-Dvs43sk9.js";import{K as te,at as oe,a as re,d as ie,R as $,r as ae,au as ce,c as le}from"./index-C5weIh5R.js";import{n as v,U as ue,C as O}from"./vendor-utils-CUDP56Ff.js";import{g as Q,b as p,p as de,q as pe}from"./vendor-hooks-BlA8TRnZ.js";import{M as H,T as V,G as he,o as G,C as fe}from"./vendor-ux-B9VfuZTg.js";import{o as xe}from"./vendor-arcblock-DeeG8u0h.js";import{K as ge}from"./landing-page-BTu1Wo51.js";import{B as me,o as je,l as ye}from"./index-ChG9_ZZV.js";import{u as we}from"./use-window-close-CAdGHigF.js";import"./lottie-web-4koyQiv_.js";function Ce({requestAppInfo:l,currentAppInfo:w}){return e.jsxs(a,{sx:{textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",gap:2},children:[e.jsxs(a,{sx:{display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx(H,{src:w.appLogo,alt:"Server",width:48,height:48,useProxyFallback:!0}),e.jsxs(a,{sx:{mx:2,display:"flex",alignItems:"center","& .dot":{width:8,height:8,borderRadius:"50%",bgcolor:"grey.500",mx:.5}},children:[e.jsx(a,{className:"dot"}),e.jsx(a,{className:"dot"}),e.jsx(a,{className:"dot"})]}),e.jsx(H,{src:l.appLogo,alt:l.appName,width:48,height:48,useProxyFallback:!0})]}),e.jsxs(y,{sx:{mb:1,fontSize:"1.2rem"},children:["Authorize"," ",e.jsx(a,{component:"span",sx:{color:"primary.main"},children:l.appName})]})]})}const Ae={en:{notThis:"Not you?",useAnother:"Use another account",authorize:"Authorize",connect:"Connect",cancel:"Cancel"},zh:{notThis:"不是这个?",useAnother:"使用其他账户",authorize:"授权",connect:"Connect",cancel:"取消"}};function Se({session:l,requestAppInfo:w,currentAppInfo:z,children:k=null,userInfo:s=void 0,hideSwitchConnect:N=!1,hideAuthorize:t=!1,hideCancel:L=!1,hideButton:T=!1,notThisText:I=void 0,authorizeText:o=void 0,connectText:c=void 0,cancelText:P=void 0,useAnotherText:C=void 0,slotProps:h=void 0,onConnect:R=v,onAuthorize:x=v,onSwitchConnect:_=v,onSwitchPassport:A=v,onCancel:U=v,ref:D,disableAuthorizeButton:b=!1}){const r=Q({loading:!1}),{locale:S="en"}=V()||{},g=p((B,j={})=>he(Ae,B,S,"en",j)),f=p(()=>{r.loading=!1}),E=p(()=>{r.loading=!0,R?.(f)}),q=p(()=>{r.loading=!0,_?.(f)}),n=p(()=>{r.loading=!0,x?.(f)}),i=p(()=>{r.loading=!0,A?.(f)}),u=p(()=>{U?.()});if(d.useImperativeHandle(D,()=>({closeLoading:f})),l.loading||!l.initialized)return e.jsx(xe,{children:e.jsx(M,{})});const m=s??l?.user;return e.jsx(ge,{did:window.blocklet?.appPid,standalone:!0,children:e.jsx(a,{...h?.root,sx:G({width:420,maxWidth:"100%"},h?.root?.sx),children:e.jsx(te,{hideCloseButton:!0,...h?.didConnectContainer,children:e.jsxs(a,{...h?.contentContainer,sx:G({display:"flex",flexDirection:"column",gap:1.5,p:{xs:2,lg:3,xl:4},pt:{xs:3,xl:4},bgcolor:"background.paper"},h?.contentContainer?.sx),children:[e.jsx(Ce,{requestAppInfo:w,currentAppInfo:z}),m?e.jsxs(e.Fragment,{children:[e.jsx(me,{user:m,showDid:!0,cardType:ye.Detailed,infoType:je.Minimal,renderTopRightContent:()=>e.jsx(oe,{user:m,switchPassport:i})}),e.jsx(a,{})]}):null,k,T?null:e.jsxs(e.Fragment,{children:[e.jsx(a,{sx:{border:"1px solid",borderColor:"divider",borderRadius:2,overflow:"hidden",my:1}}),e.jsxs(X,{direction:"row",spacing:2,children:[L?null:e.jsx(K,{color:"inherit",variant:"outlined",size:"large",fullWidth:!0,onClick:u,sx:{color:"grey.500"},children:P||g("cancel")}),m&&!t?e.jsxs(K,{variant:"contained",size:"large",fullWidth:!0,onClick:n,disabled:r.loading||b,children:[r.loading?e.jsx(M,{size:20,sx:{mr:1}}):null,o||g("authorize")]}):e.jsxs(K,{variant:"contained",size:"large",fullWidth:!0,disabled:r.loading||b,onClick:E,children:[r.loading?e.jsx(M,{size:20,sx:{mr:1}}):null,c||g("connect")]})]})]}),N||!m?null:e.jsx(a,{sx:{textAlign:"center"},children:e.jsxs(y,{variant:"body2",sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:1},children:[I||g("notThis")," ",e.jsx(Y,{underline:"hover",onClick:q,sx:{cursor:"pointer"},children:C||g("useAnother")})]})})]})})})})}const ve=O(window.location.origin,le.WELLKNOWN_BLOCKLET_USER_PATH,"settings#user-center-access-key-setting"),J=3e3;function De(){const l=d.useRef(null),[w,z]=d.useState(),[k]=de({targetDate:w}),{session:s}=re(),N=Z(),t=Q({ready:!1,success:!1,error:null,invalidSession:!1,token:null}),[L,T]=pe("currentUserInfo",{defaultValue:null}),I=se(),{t:o}=V(),[c]=ne(),P=we(),[,C]=d.useState(!0),[h,R]=d.useState({appName:c.get("cli")?c.get("appName")??o("aigne.cli"):"",appLogo:c.get("cli")?c.get("appLogo"):""}),x=c.get("required_roles")||"",_=d.useMemo(()=>{const n=x.split(",")||[];if(n.length===0)return n;const i=ue([s.user?.role,(s.user?.passports||[]).map(u=>u.role)].flat().filter(Boolean));return i.length===0?i:n.filter(u=>i.includes(u.toLocaleLowerCase().trim()))},[s.user,x]),A=_.join(","),U=s.user&&x?_.length>0:!0,D=async()=>{C(!0);try{const n=c.get("__url__"),i=n?$(n):null;if(!i){C(!1);return}const u="__blocklet__.js?type=json",B=new URL(i).origin,{data:j}=await ce.get(O(B,u));R({appName:j?.appName,appUrl:j?.appUrl,appLogo:O(j?.appUrl,j?.appLogo)})}catch(n){console.error(n)}finally{C(!1)}};d.useEffect(()=>{s.user&&T(s.user)},[s.user]);const b=()=>{D(),s.user&&T(s.user);try{const n=new URL(window.location.href);if(n.hash.includes("invalid")){t.invalidSession=!0;return}const i=n.searchParams.get("__token__"),u=i?$(i):null;if(!u)throw new Error("No token");t.token=u,t.ready=!0}catch(n){t.invalidSession=!0,t.error=n.message,window.opener?.postMessage({type:"connect-aigne-message",error:n.message},"*"),I("#invalid",{replace:!0})}};d.useLayoutEffect(()=>b(),[]);const r=window.blocklet,S=c.get("source")||"Generate Access Key",g=p(async n=>{try{await ie.post("/access-key/authorize",{source:S,sid:t.token,requiredRoles:A}),t.success=!0,window.opener?.postMessage({type:"connect-aigne-message",success:!0},"*"),c.has("closeOnSuccess")&&(z(Date.now()+J),setTimeout(()=>P(),J))}catch(i){console.error(i)}finally{n()}}),f=p(()=>{s.login()}),E=p(()=>{window.close()});d.useEffect(()=>{s.initialized&&!s.user&&(fe()||f())},[s?.user,s?.initialized,f]),d.useEffect(()=>{s.open||l.current?.closeLoading?.()},[s.open]);const q=()=>t.error?e.jsxs(W,{severity:"error",children:[e.jsx(F,{children:o("aigne.notAuthorized")}),t.error]}):t.success?e.jsx(ae,{style:{backgroundColor:"transparent"},status:"info",icon:e.jsx(ee,{style:{color:N.palette.success.main,fontSize:72}}),title:o("connectCli.success",{source:S}),description:`${o("connectCli.successDesc",{source:S})} ${c.has("closeOnSuccess")?o("connectCli.closeDelay",{seconds:Math.ceil(k/1e3)}):""}`}):e.jsxs(W,{severity:"info",children:[e.jsx(F,{children:o("aigne.connectTo",{appName:r.appName})}),x&&e.jsx(y,{component:"li",variant:"body2",children:A?o("aigne.accessTips.switchPassport",{required_roles:A}):o("aigne.accessTips.switchPassportRequired",{required_roles:x})}),e.jsx(y,{component:"li",variant:"body2",children:o("aigne.accessTips.tips1",{appName:h.appName,accessAppName:r.appName})}),e.jsx(y,{component:"li",variant:"body2",children:o("aigne.accessTips.tips2",{appName:h.appName})}),e.jsx(y,{component:"li",variant:"body2",sx:{"& a":{color:"inherit",textDecoration:"underline"}},dangerouslySetInnerHTML:{__html:o("aigne.accessTips.tips3",{url:ve,accessAppName:r.appName})}})]});return e.jsx(Se,{ref:l,session:s,requestAppInfo:h,currentAppInfo:r,userInfo:L,onAuthorize:g,onConnect:f,onSwitchConnect:s.switchDid,onCancel:E,hideAuthorize:!!t.error,hideSwitchConnect:t.success,hideButton:t.success,authorizeText:o("common.approve"),onSwitchPassport:s.switchDid,slotProps:{root:{sx:{width:500}}},disableAuthorizeButton:!U,children:q()})}export{De as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{O as t}from"./index-
|
|
1
|
+
import{O as t}from"./index-C5weIh5R.js";import{H as e}from"./vendor-ux-B9VfuZTg.js";function c(...o){try{return t(...o)}catch(r){throw e.error("Invalid redirect url"),console.error("Invalid redirect url",r),r}}export{c as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as o,b1 as n}from"./vendor-mui-core-DRxbhqaK.js";import{L as r}from"./vendor-react-Dvs43sk9.js";import{n as i}from"./vendor-ux-B9VfuZTg.js";import{c as t}from"./index-
|
|
1
|
+
import{j as o,b1 as n}from"./vendor-mui-core-DRxbhqaK.js";import{L as r}from"./vendor-react-Dvs43sk9.js";import{n as i}from"./vendor-ux-B9VfuZTg.js";import{c as t}from"./index-C5weIh5R.js";import{S as e}from"./studio-C8Cis2HF.js";import"./vendor-utils-CUDP56Ff.js";import"./vendor-hooks-BlA8TRnZ.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DeeG8u0h.js";import"./index-KhL4--33.js";function L(){return o.jsx(e,{children:o.jsxs(n,{direction:"row",spacing:2,sx:{m:4},children:[o.jsx(i,{component:r,to:`${t.WELLKNOWN_SERVICE_PATH_PREFIX}/studio/preferences`,size:"large",color:"primary",variant:"outlined",children:"Preference Builder"}),o.jsx(i,{component:r,to:`${t.WELLKNOWN_SERVICE_PATH_PREFIX}/studio/branding`,size:"large",color:"primary",variant:"outlined",children:"Branding Images"}),o.jsx(i,{component:r,to:`${t.WELLKNOWN_SERVICE_PATH_PREFIX}/studio/localization`,size:"large",color:"primary",variant:"outlined",children:"Localization"})]})})}export{L as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as E}from"./vendor-react-Dvs43sk9.js";import{a1 as L}from"./index-
|
|
1
|
+
import{a as E}from"./vendor-react-Dvs43sk9.js";import{a1 as L}from"./index-C5weIh5R.js";const $=({url:r,allowFullScreen:o,position:a,display:i,height:u,width:y,overflow:c,styles:f,onLoad:p,onMouseOver:m,onMouseOut:w,scrolling:b,id:d,frameBorder:n,ariaHidden:O,sandbox:s,allow:j,className:g,title:h,ariaLabel:k,ariaLabelledby:P,name:v,target:A,loading:F,importance:I,referrerpolicy:M,allowpaymentrequest:S,src:q,key:x})=>{const t=L({src:q||r,target:A||null,style:{position:a||null,display:i||"initial",overflow:c||null},scrolling:b||null,allowpaymentrequest:S||null,importance:I||null,sandbox:s&&[...s].join(" ")||null,loading:F||null,styles:f||null,name:v||null,className:g||null,allowFullScreen:"allowFullScreen",referrerpolicy:M||null,title:h||null,allow:j||null,id:d||null,"aria-labelledby":P||null,"aria-hidden":O||null,"aria-label":k||null,width:y||null,height:u||null,onLoad:p||null,onMouseOver:m||null,onMouseOut:w||null,key:x||"iframe"});let l=Object.create(null);for(let e of Object.keys(t))t[e]!=null&&(l[e]=t[e]);for(let e of Object.keys(l.style))l.style[e]==null&&delete l.style[e];if(l.styles)for(let e of Object.keys(l.styles))l.styles.hasOwnProperty(e)&&(l.style[e]=l.styles[e]),Object.keys(l.styles).pop()==e&&delete l.styles;if(o)if("allow"in l){const e=l.allow.replace("fullscreen","");l.allow=`fullscreen ${e.trim()}`.trim()}else l.allow="fullscreen";return n>=0&&(l.style.hasOwnProperty("border")||(l.style.border=n)),E.createElement("iframe",Object.assign({},l))};export{$ as I};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{T as ee,H as O,P as X,a7 as Ee,a8 as Ue,a9 as We,aa as Ve,c as K,a1 as je,b as ke,q as Me,n as z,ab as _e,j as Ne,k as $e,p as Ie}from"./vendor-ux-B9VfuZTg.js";import{b as u,a as H,g as ie,c as He}from"./vendor-hooks-BlA8TRnZ.js";import{r as D}from"./vendor-react-Dvs43sk9.js";import{j as e,ak as a,b6 as R,am as ce,y as B,z as F,Q as V,T as Q,I as le,a3 as oe,W as E,b1 as W,bb as qe,cb as Le,cE as Je,at as Fe,D as ye,ah as Be,cF as Oe,a6 as be,cG as Ze,a$ as Ke}from"./vendor-mui-core-DRxbhqaK.js";import{X as N,a9 as M,V as G,bd as se,c as ve,b8 as Ge,aW as Qe,W as Ye}from"./index-0863PXVJ.js";import{A as Z,Q as Xe,b as de,Z as et,n as Y,$ as tt,C as nt,a as st}from"./vendor-utils-CUDP56Ff.js";import{u as te,C as k,a as De}from"./index.esm-JPZAjt0x.js";import{S as ae}from"./switch-control-DEpBEl7-.js";import{S as y}from"./section-ZPKr6_ii.js";import{d as ot}from"./keyboard-arrow-down-rounded-8U0_i9QO.js";import{u as it}from"./index-DlrQ2HQP.js";import{v as at}from"./index-Ba9-ArMT.js";import{r as rt}from"./base32-BK7MXAD4.js";import{u as lt}from"./use-mobile-BQQpAf3i.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DeeG8u0h.js";import"./required-BT8zXV8U.js";const we={width:24,height:24,body:'<path fill="currentColor" d="M5 4v16V4v5v-5Zm3 10h2.675q.275-.575.638-1.075t.812-.925H8q-.425 0-.713.288T7 13q0 .425.288.713T8 14Zm0 4h2.075Q10 17.5 10 17t.075-1H8q-.425 0-.713.288T7 17q0 .425.288.713T8 18Zm-3 4q-.825 0-1.413-.588T3 20V4q0-.825.588-1.413T5 2h7.175q.4 0 .763.15t.637.425l4.85 4.85q.275.275.425.638t.15.762V10.3q-.475-.15-.975-.225T17 10V9h-4q-.425 0-.713-.288T12 8V4H5v16h5.675q.275.575.638 1.075t.812.925H5Zm12-10q2.075 0 3.538 1.463T22 17q0 2.075-1.463 3.538T17 22q-2.075 0-3.538-1.463T12 17q0-2.075 1.463-3.538T17 12Zm0 8q.275 0 .463-.188t.187-.462q0-.275-.187-.463T17 18.7q-.275 0-.463.188t-.187.462q0 .275.188.463T17 20Zm0-6q-.475 0-.875.238t-.65.637q-.1.15-.025.313t.25.237q.15.075.3 0t.275-.2q.125-.175.313-.275t.412-.1q.325 0 .563.213t.237.537q0 .275-.15.463t-.35.387q-.15.15-.313.3t-.287.35q-.075.15-.113.313t-.037.337q0 .225.125.413t.325.187q.2 0 .325-.15t.125-.35q0-.275.15-.488t.35-.412q.3-.275.525-.613t.225-.737q0-.675-.5-1.138T17 14Z"/>'},ue={enabled:!1,domain:"",clientId:"",clientSecret:""};function ct(){const{api:b}=N(),{blocklet:c}=M(),{t,locale:n}=ee(),o=c?.meta?.did,r=Object.assign({...ue},c?.settings?.oauth?.auth0||{}),{handleSubmit:x,control:i,formState:p,watch:d,reset:f}=te({defaultValues:Z(r,Object.keys(ue))}),l=d("enabled"),j=u(async s=>{try{const{blocklet:I}=await b.configOAuth({input:{did:o,oauth:JSON.stringify({auth0:s})}}),L=Object.assign({...ue},I?.settings?.oauth?.auth0||{});f(L),O.success(t("oauth.saveSuccess"))}catch(I){O.error(I.message||t("oauth.saveFailed"))}}),v=u(s=>s?.trim()?!0:t("oauth.auth0.domainDescription")),S=u(s=>s?.trim()?!0:t("oauth.auth0.clientIdDescription")),g=u(s=>s?.trim()?!0:t("oauth.auth0.clientSecretDescription")),w=u(()=>!0),h=H(()=>n==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-auth0":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-auth0",[n]);return e.jsx(a,{children:e.jsxs("form",{onSubmit:x(j),disabled:!0,children:[e.jsx(y,{title:e.jsxs(a,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx("span",{children:t("oauth.auth0.enable")}),e.jsx(ce,{title:t("oauth.viewDocument"),children:e.jsx(a,{component:"a",sx:{display:"inline-block",color:"inherit",fontSize:0,lineHeight:1},href:h,target:"_blank",rel:"noreferrer",children:e.jsx(X,{icon:we,fontSize:20})})})]}),mb:2.5,children:e.jsx(k,{name:"enabled",control:i,render:({field:s})=>e.jsx(R,{control:e.jsx(ae,{sx:{ml:1},checked:s.value,...s})})})}),e.jsx(y,{title:t("oauth.auth0.domain"),children:e.jsx(k,{name:"domain",control:i,rules:{validate:l?v:w},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.auth0.domain"),error:!!p.errors[s.name],helperText:p.errors[s.name]?.message||" ",disabled:!l})})})}),e.jsx(y,{title:t("oauth.auth0.clientId"),children:e.jsx(k,{name:"clientId",control:i,rules:{validate:l?S:w},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.auth0.clientId"),error:!!p.errors[s.name],helperText:p.errors[s.name]?.message||" ",disabled:!l})})})}),e.jsx(y,{title:t("oauth.auth0.clientSecret"),children:e.jsx(k,{name:"clientSecret",control:i,rules:{validate:l?g:w},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",type:"password",label:t("oauth.auth0.clientSecret"),error:!!p.errors[s.name],helperText:p.errors[s.name]?.message||" ",disabled:!l})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:x(j),disabled:!p.isDirty,children:t("oauth.save")})]})})}const he={enabled:!1,clientId:"",clientSecret:""};function dt(){const{api:b}=N(),{blocklet:c}=M(),{t,locale:n}=ee(),o=c?.meta?.did,r=Object.assign({...he},c?.settings?.oauth?.github||{}),{handleSubmit:x,control:i,formState:p,watch:d,reset:f}=te({defaultValues:Z(r,Object.keys(he))}),l=d("enabled"),j=u(async h=>{try{const{blocklet:s}=await b.configOAuth({input:{did:o,oauth:JSON.stringify({github:h})}}),I=Object.assign({...he},s?.settings?.oauth?.github||{});f(I),O.success(t("oauth.saveSuccess"))}catch(s){O.error(s.message||t("oauth.saveFailed"))}}),v=u(h=>h?.trim()?!0:t("oauth.github.clientIdDescription")),S=u(h=>h?.trim()?!0:t("oauth.github.clientSecretDescription")),g=u(()=>!0),w=H(()=>n==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-github":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-github",[n]);return e.jsx(a,{children:e.jsxs("form",{onSubmit:x(j),disabled:!0,children:[e.jsx(y,{title:e.jsxs(a,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx("span",{children:t("oauth.github.enable")}),e.jsx(ce,{title:t("oauth.viewDocument"),children:e.jsx(a,{component:"a",sx:{display:"inline-block",color:"inherit",fontSize:0,lineHeight:1},href:w,target:"_blank",rel:"noreferrer",children:e.jsx(X,{icon:we,fontSize:20})})})]}),mb:2.5,sx:{"& .section-content":{alignItems:"center"}},children:e.jsx(k,{name:"enabled",control:i,sx:{alignItems:"center"},render:({field:h})=>e.jsx(R,{control:e.jsx(ae,{sx:{ml:1},size:"small",checked:h.value,...h})})})}),e.jsx(y,{title:t("oauth.github.clientId"),children:e.jsx(k,{name:"clientId",control:i,rules:{validate:l?v:g},render:({field:h})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...h,size:"small",label:t("oauth.github.clientId"),error:!!p.errors[h.name],helperText:p.errors[h.name]?.message||" ",disabled:!l})})})}),e.jsx(y,{title:t("oauth.github.clientSecret"),children:e.jsx(k,{name:"clientSecret",control:i,rules:{validate:l?S:g},render:({field:h})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...h,size:"small",type:"password",label:t("oauth.github.clientSecret"),error:!!p.errors[h.name],helperText:p.errors[h.name]?.message||" ",disabled:!l})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:x(j),disabled:!p.isDirty,children:t("oauth.save")})]})})}const me={enabled:!1,clientId:"",clientSecret:""};function ut(){const{api:b}=N(),{blocklet:c}=M(),{t,locale:n}=ee(),o=c?.meta?.did,r=Object.assign({...me},c?.settings?.oauth?.google||{}),{handleSubmit:x,control:i,formState:p,watch:d,reset:f}=te({defaultValues:Z(r,Object.keys(me))}),l=d("enabled"),j=u(async h=>{try{const{blocklet:s}=await b.configOAuth({input:{did:o,oauth:JSON.stringify({google:h})}}),I=Object.assign({...me},s?.settings?.oauth?.google||{});f(I),O.success(t("oauth.saveSuccess"))}catch(s){O.error(s.message||t("oauth.saveFailed"))}}),v=u(h=>h?.trim()?!0:t("oauth.google.clientIdDescription")),S=u(h=>h?.trim()?!0:t("oauth.google.clientSecretDescription")),g=u(()=>!0),w=H(()=>n==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-google":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-google",[n]);return e.jsx(a,{children:e.jsxs("form",{onSubmit:x(j),disabled:!0,children:[e.jsx(y,{title:e.jsxs(a,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx("span",{children:t("oauth.google.enable")}),e.jsx(ce,{title:t("oauth.viewDocument"),children:e.jsx(a,{component:"a",sx:{display:"inline-block",color:"inherit",fontSize:0,lineHeight:1},href:w,target:"_blank",rel:"noreferrer",children:e.jsx(X,{icon:we,fontSize:20})})})]}),mb:2.5,children:e.jsx(k,{name:"enabled",control:i,render:({field:h})=>e.jsx(R,{control:e.jsx(ae,{sx:{ml:1},checked:h.value,...h})})})}),e.jsx(y,{title:t("oauth.google.clientId"),children:e.jsx(k,{name:"clientId",control:i,rules:{validate:l?v:g},render:({field:h})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...h,size:"small",label:t("oauth.google.clientId"),error:!!p.errors[h.name],helperText:p.errors[h.name]?.message||" ",disabled:!l})})})}),e.jsx(y,{title:t("oauth.google.clientSecret"),children:e.jsx(k,{name:"clientSecret",control:i,rules:{validate:l?S:g},render:({field:h})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...h,size:"small",type:"password",label:t("oauth.google.clientSecret"),error:!!p.errors[h.name],helperText:p.errors[h.name]?.message||" ",disabled:!l})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:x(j),disabled:!p.isDirty,children:t("oauth.save")})]})})}const pe={enabled:!1,teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function ht(){const{api:b}=N(),{blocklet:c}=M(),{t}=ee(),n=c?.meta?.did,o=Object.assign({...pe},c?.settings?.oauth?.apple||{}),{handleSubmit:r,control:x,formState:i,watch:p,reset:d}=te({defaultValues:Z(o,Object.keys(pe))}),f=p("enabled"),l=u(async s=>{try{const{blocklet:I}=await b.configOAuth({input:{did:n,oauth:JSON.stringify({apple:s})}}),L=Object.assign({...pe},I?.settings?.oauth?.apple||{});d(L),O.success(t("oauth.saveSuccess"))}catch(I){O.error(I.message||t("oauth.saveFailed"))}}),j=u(s=>s?.trim()?!0:t("oauth.apple.teamIdDescription")),v=u(s=>s?.trim()?!0:t("oauth.apple.serviceIdDescription")),S=u(s=>s?.trim()?!0:t("oauth.apple.keyIdDescription")),g=u(s=>s?.trim()?!0:t("oauth.apple.authKeyDescription")),w=u(s=>s?.trim()?!0:t("oauth.apple.bundleIdDescription")),h=u(()=>!0);return e.jsx(a,{children:e.jsxs("form",{onSubmit:r(l),disabled:!0,children:[e.jsx(y,{title:t("oauth.apple.enable"),mb:2.5,children:e.jsx(k,{name:"enabled",control:x,render:({field:s})=>e.jsx(R,{control:e.jsx(ae,{sx:{ml:1},checked:s.value,...s})})})}),e.jsx(y,{title:t("oauth.apple.teamId"),children:e.jsx(k,{name:"teamId",control:x,rules:{validate:f?j:h},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.apple.teamId"),error:!!i.errors[s.name],helperText:i.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.apple.bundleId"),children:e.jsx(k,{name:"bundleId",control:x,rules:{validate:f?w:h},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.apple.bundleId"),error:!!i.errors[s.name],helperText:i.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.apple.serviceId"),children:e.jsx(k,{name:"serviceId",control:x,rules:{validate:f?v:h},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.apple.serviceId"),error:!!i.errors[s.name],helperText:i.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.apple.keyId"),children:e.jsx(k,{name:"keyId",control:x,rules:{validate:f?S:h},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.apple.keyId"),error:!!i.errors[s.name],helperText:i.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.apple.authKey"),children:e.jsx(k,{name:"authKey",control:x,rules:{validate:f?g:h},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",type:"password",label:t("oauth.apple.authKey"),multiline:!0,rows:4,error:!!i.errors[s.name],helperText:i.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:r(l),disabled:!i.isDirty,children:t("oauth.save")})]})})}const xe={enabled:!1,clientId:"",clientSecret:""};function mt(){const{api:b}=N(),{blocklet:c}=M(),{t}=ee(),n=c?.meta?.did,o=Object.assign({...xe},c?.settings?.oauth?.twitter||{}),{handleSubmit:r,control:x,formState:i,watch:p,reset:d}=te({defaultValues:Z(o,Object.keys(xe))}),f=p("enabled"),l=u(async g=>{try{const{blocklet:w}=await b.configOAuth({input:{did:n,oauth:JSON.stringify({twitter:g})}}),h=Object.assign({...xe},w?.settings?.oauth?.twitter||{});d(h),O.success(t("oauth.saveSuccess"))}catch(w){O.error(w.message||t("oauth.saveFailed"))}}),j=u(g=>g?.trim()?!0:t("oauth.twitter.clientIdDescription")),v=u(g=>g?.trim()?!0:t("oauth.twitter.clientSecretDescription")),S=u(()=>!0);return e.jsx(a,{children:e.jsxs("form",{onSubmit:r(l),disabled:!0,children:[e.jsx(y,{title:e.jsx(a,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsx("span",{children:t("oauth.twitter.enable")})}),mb:2.5,sx:{"& .section-content":{alignItems:"center"}},children:e.jsx(k,{name:"enabled",control:x,sx:{alignItems:"center"},render:({field:g})=>e.jsx(R,{control:e.jsx(ae,{sx:{ml:1},size:"small",checked:g.value,...g})})})}),e.jsx(y,{title:t("oauth.twitter.clientId"),children:e.jsx(k,{name:"clientId",control:x,rules:{validate:f?j:S},render:({field:g})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...g,size:"small",label:t("oauth.twitter.clientId"),error:!!i.errors[g.name],helperText:i.errors[g.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.twitter.clientSecret"),children:e.jsx(k,{name:"clientSecret",control:x,rules:{validate:f?v:S},render:({field:g})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...g,size:"small",type:"password",label:t("oauth.twitter.clientSecret"),error:!!i.errors[g.name],helperText:i.errors[g.name]?.message||" ",disabled:!f})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:r(l),disabled:!i.isDirty,children:t("oauth.save")})]})})}const pt={width:24,height:24,body:'<path fill="currentColor" d="M9 20q-.825 0-1.413-.588T7 18q0-.825.588-1.413T9 16q.825 0 1.413.588T11 18q0 .825-.588 1.413T9 20Zm6 0q-.825 0-1.413-.588T13 18q0-.825.588-1.413T15 16q.825 0 1.413.588T17 18q0 .825-.588 1.413T15 20Zm-6-6q-.825 0-1.413-.588T7 12q0-.825.588-1.413T9 10q.825 0 1.413.588T11 12q0 .825-.588 1.413T9 14Zm6 0q-.825 0-1.413-.588T13 12q0-.825.588-1.413T15 10q.825 0 1.413.588T17 12q0 .825-.588 1.413T15 14ZM9 8q-.825 0-1.413-.588T7 6q0-.825.588-1.413T9 4q.825 0 1.413.588T11 6q0 .825-.588 1.413T9 8Zm6 0q-.825 0-1.413-.588T13 6q0-.825.588-1.413T15 4q.825 0 1.413.588T17 6q0 .825-.588 1.413T15 8Z"/>'};function Re({id:b,title:c,children:t,index:n,onMove:o,defaultExpand:r=!1,onEnd:x,icon:i=null}){const[p,d]=D.useState(r),f=D.useRef(null),l=D.useRef(null),[{handlerId:j},v]=Ee({accept:"dragItem",collect(s){return{handlerId:s.getHandlerId()}},hover(s,I){if(!f.current)return;const L=s.index,m=n;if(L===m)return;const A=f.current?.getBoundingClientRect(),_=l.current?.getBoundingClientRect(),re=(_.bottom-_.top)/2,$=I.getClientOffset().y-A.top;L<m&&$<re||L>m&&$>re||(o(L,m),s.index=m)}}),[{isDragging:S},g]=Ue({item:{index:n,type:"dragItem"},collect:s=>({isDragging:s.isDragging()}),end:x});g(l),v(f);const w=S?.5:1,h=u(s=>{s.preventDefault(),s.stopPropagation(),d(!p)});return e.jsxs(a,{ref:f,children:[e.jsxs(a,{sx:{cursor:"pointer","&:hover":{backgroundColor:"grey.100"}},ref:l,"data-handler-id":j,children:[e.jsxs(a,{sx:{py:2,px:1,opacity:w,display:"flex",alignItems:"center",gap:.5},draggable:!1,onClick:h,children:[e.jsx(a,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:"text.hint","&:hover":{color:"text.secondary"}},children:e.jsx(X,{fontSize:20,icon:pt})}),e.jsx(a,{sx:{display:"flex",alignItems:"center",flexShrink:0,mr:.5,transform:"translateY(-1px)"},children:i}),e.jsx(Q,{sx:{flex:1},children:c}),e.jsx(le,{size:"small",sx:{pointerEvents:"auto",transform:p?"":"rotate(180deg)",transition:"transform 0.3s ease"},children:e.jsx(X,{icon:ot,style:{transform:"scale(1.5)"}})})]}),e.jsx(oe,{})]}),e.jsx(a,{sx:{pl:4,py:2.5,display:p?"block":"none"},children:t})]})}Re.propTypes={title:E.string.isRequired,id:E.string.isRequired,children:E.node.isRequired,index:E.number.isRequired,onMove:E.func.isRequired,onEnd:E.func.isRequired,defaultExpand:E.bool,icon:E.any};const xt=[{name:"github",title:G.PROVIDER_NAME.github,icon:e.jsx(se,{provider:"github",sx:{width:20,height:20}}),component:e.jsx(dt,{})},{name:"google",title:G.PROVIDER_NAME.google,icon:e.jsx(se,{provider:"google",sx:{width:20,height:20}}),component:e.jsx(ut,{})},{name:"apple",title:G.PROVIDER_NAME.apple,icon:e.jsx(se,{provider:"apple",sx:{width:20,height:20}}),component:e.jsx(ht,{})},{name:"twitter",title:G.PROVIDER_NAME.twitter,icon:e.jsx(se,{provider:"twitter",sx:{width:20,height:20}}),component:e.jsx(mt,{})},{name:"auth0",title:G.PROVIDER_NAME.auth0,icon:e.jsx(se,{provider:"auth0",sx:{width:20,height:20}}),component:e.jsx(ct,{})}],ft=["github","google","apple","twitter","auth0"];function gt(){const{api:b}=N(),{blocklet:c}=M(),t=c?.meta?.did,n=c?.settings?.oauth||{},o=Object.keys(n).sort((l,j)=>n[l]?.order!==void 0&&n[j]?.order!==void 0?n[l].order-n[j].order:n[l]?.order!==void 0?-1:1);for(const l of ft)o.includes(l)||o.push(l);const r=ie(o.reduce((l,j,v)=>Object.assign(l,{[j]:v}),{})),x=H(()=>{const l=[...xt];return l.sort((j,v)=>r[j.name]-r[v.name]),l.map(j=>({...j,enabled:n[j.name]?.enabled??!1}))},[r.auth0,r.github,r.google]),i={};typeof window<"u"&&(i.context=window);const p=u(async l=>{const j={};Object.keys(l).forEach(v=>{j[v]={order:l[v]}}),await b.configOAuth({input:{did:t,oauth:JSON.stringify(j)}})}),d=u((l,j)=>{const v=x[l],S=x[j];r[v.name]=j,r[S.name]=l}),f=u(async()=>{await p(r)});return e.jsx(a,{sx:{".section-left":{width:"180px"}},children:e.jsx(We,{backend:Ve,...i,children:x.map((l,j)=>e.jsx(Re,{index:j,id:l.name,title:l.title,icon:l.icon,onMove:d,onEnd:f,defaultExpand:l.enabled,children:l.component},l.name))})})}const J={ttl:ve.SESSION_TTL,cacheTtl:ve.SESSION_CACHE_TTL,email:{enabled:!1,requireVerified:!1,requireUnique:!1,trustOauthProviders:!1,trustedIssuers:[],enableDomainBlackList:!1,domainBlackList:[],enableDomainWhiteList:!1,domainWhiteList:[]},phone:{enabled:!1,requireVerified:!1,requireUnique:!1,regionBlackList:[],trustedIssuers:[]},enableBlacklist:!1};function U(b){return e.jsx(it,{...b,sx:{transform:"scale(0.75)"}})}function fe(b,c=!1){const t=c?b.ttl*86400:b.ttl/86400;return{...b,ttl:t}}function jt(){const{api:b}=N(),{blocklet:c}=M(),t=c?.meta?.did,n=Xe({},J,c?.settings?.session||{});de(n.ttl)&&(n.ttl=J.ttl),de(n.cacheTtl)&&(n.cacheTtl=J.cacheTtl),n.phone||(n.phone=J.phone),n.email||(n.email=J.email),de(n.enableBlacklist)&&(n.enableBlacklist=J.enableBlacklist);const{handleSubmit:o,control:r,formState:x,reset:i,watch:p}=te({defaultValues:Z(fe(n),["ttl","cacheTtl","email","phone","enableBlacklist"])}),{t:d}=ee(),f=p("email.enabled"),l=p("phone.enabled"),j=p("email.enableDomainBlackList"),v=p("email.enableDomainWhiteList"),{fields:S,append:g,remove:w}=De({control:r,name:"email.domainBlackList"}),{fields:h,append:s,remove:I}=De({control:r,name:"email.domainWhiteList"}),L=u(async m=>{try{const{blocklet:A}=await b.updateAppSessionConfig({input:{did:t,config:et(fe(m,!0),["phone"])}}),_=Object.assign({},J,Z(A?.settings?.session||{},["ttl","cacheTtl","email","phone","enableBlacklist"]));i(fe(_)),O.success(d("common.configSuccess"))}catch(A){O.error(A.message)}});return e.jsx(bt,{onSubmit:o(L),children:e.jsxs(W,{direction:"column",sx:{gap:6},children:[e.jsxs(a,{children:[e.jsxs(a,{children:[e.jsx(Q,{variant:"h6",sx:{fontWeight:600},children:d("blocklet.config.session.profile")}),e.jsx(a,{component:oe,sx:{my:3}})]}),e.jsxs(W,{sx:{gap:2},children:[e.jsx(y,{title:d("blocklet.config.session.fullNameEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(a,{sx:{alignSelf:"flex-start"},children:e.jsx(U,{disabled:!0,checked:!0})})}),e.jsx(y,{title:d("blocklet.config.session.avatarEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(a,{sx:{alignSelf:"flex-start"},children:e.jsx(U,{disabled:!0,checked:!0})})}),e.jsx(y,{title:d("blocklet.config.session.emailEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(a,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.enabled",control:r,render:({field:m})=>e.jsx(U,{...m,checked:m.value})})})}),f&&e.jsxs(W,{direction:"column",sx:{ml:2,gap:.5},children:[e.jsx(y,{title:d("blocklet.config.session.emailRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(a,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.requireVerified",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),e.jsx(y,{title:d("blocklet.config.session.emailRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(a,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.requireUnique",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),e.jsx(y,{title:d("blocklet.config.session.emailTrustOauthProviders"),sectionLeftSx:{width:"600px"},children:e.jsx(a,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.trustOauthProviders",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),e.jsx(y,{title:d("blocklet.config.session.enableDomainBlackList"),sectionLeftSx:{width:"600px"},children:e.jsx(a,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.enableDomainBlackList",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),j&&e.jsxs(a,{children:[S.map((m,A)=>e.jsxs(W,{direction:"row",sx:{alignItems:"center",my:1,maxWidth:"720px"},children:[e.jsx(k,{name:`email.domainBlackList.${A}`,control:r,render:_=>e.jsx(F,{..._.field,size:"small",fullWidth:!0})}),e.jsx(le,{onClick:()=>w(A),children:e.jsx(qe,{})})]},m.id)),e.jsx(V,{startIcon:e.jsx(Le,{}),onClick:()=>g(""),children:d("blocklet.config.session.addDomain")})]}),e.jsx(y,{title:d("blocklet.config.session.enableDomainWhiteList"),sectionLeftSx:{width:"600px"},children:e.jsx(a,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.enableDomainWhiteList",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),v&&e.jsxs(a,{children:[h.map((m,A)=>e.jsxs(W,{direction:"row",sx:{alignItems:"center",my:1,maxWidth:"720px"},children:[e.jsx(k,{name:`email.domainWhiteList.${A}`,control:r,render:_=>e.jsx(F,{..._.field,size:"small",fullWidth:!0})}),e.jsx(le,{onClick:()=>I(A),children:e.jsx(qe,{})})]},m.id)),e.jsx(V,{startIcon:e.jsx(Le,{}),onClick:()=>s(""),children:d("blocklet.config.session.addDomain")})]})]}),e.jsxs(a,{sx:{display:"none"},children:[e.jsx(y,{title:d("blocklet.config.session.phoneEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(a,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"phone.enabled",control:r,disabled:!0,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),l&&e.jsxs(W,{direction:"column",sx:{ml:2,mt:1},children:[e.jsx(y,{title:d("blocklet.config.session.phoneRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(a,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"phone.requireVerified",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),e.jsx(y,{title:d("blocklet.config.session.phoneRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(a,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"phone.requireUnique",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})})]})]})]})]}),e.jsxs(a,{children:[e.jsx(Q,{variant:"h6",sx:{fontWeight:600},children:d("blocklet.config.session.period")}),e.jsx(a,{component:oe,sx:{my:3}}),e.jsx(W,{direction:"column",spacing:2,children:e.jsx(k,{name:"ttl",control:r,rules:{min:1,max:30},render:({field:m})=>e.jsx(B,{fullWidth:!0,sx:{mb:2},children:e.jsx(y,{title:d("blocklet.config.session.ttl",{day:m.value}),sectionLeftSx:{width:"600px"},children:e.jsx(a,{sx:{width:"100%",maxWidth:500,px:2},children:e.jsx(Je,{...m,defaultValue:7,step:1,marks:[{value:1,label:d("blocklet.config.session.day",{day:1})},{value:7,label:d("blocklet.config.session.days",{day:7})},{value:14,label:d("blocklet.config.session.days",{day:14})},{value:21,label:d("blocklet.config.session.days",{day:21})},{value:30,label:d("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto"})})})})})})]}),e.jsxs(a,{children:[e.jsx(Q,{variant:"h6",sx:{fontWeight:600},children:d("blocklet.config.session.experimentalSettings")}),e.jsx(a,{component:oe,sx:{my:3}}),e.jsx(W,{direction:"column",spacing:2,children:e.jsx(y,{title:d("blocklet.config.session.enableBlacklist"),sectionLeftSx:{width:"600px"},children:e.jsx(a,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"enableBlacklist",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})})})]}),e.jsx(a,{children:e.jsx(V,{type:"submit",variant:"contained",disabled:!x.isDirty,children:d("oauth.save")})})]})})}const bt=Fe.form`
|
|
1
|
+
import{T as ee,H as O,P as X,a7 as Ee,a8 as Ue,a9 as We,aa as Ve,c as K,a1 as je,b as ke,q as Me,n as z,ab as _e,j as Ne,k as $e,p as Ie}from"./vendor-ux-B9VfuZTg.js";import{b as u,a as H,g as ie,c as He}from"./vendor-hooks-BlA8TRnZ.js";import{r as D}from"./vendor-react-Dvs43sk9.js";import{j as e,ak as a,b6 as R,am as ce,y as B,z as F,Q as V,T as Q,I as le,a3 as oe,W as E,b1 as W,bb as qe,cb as Le,cE as Je,at as Fe,D as ye,ah as Be,cF as Oe,a6 as be,cG as Ze,a$ as Ke}from"./vendor-mui-core-DRxbhqaK.js";import{X as N,a9 as M,V as G,bd as se,c as ve,b8 as Ge,aW as Qe,W as Ye}from"./index-C5weIh5R.js";import{A as Z,Q as Xe,b as de,Z as et,n as Y,$ as tt,C as nt,a as st}from"./vendor-utils-CUDP56Ff.js";import{u as te,C as k,a as De}from"./index.esm-JPZAjt0x.js";import{S as ae}from"./switch-control-DEpBEl7-.js";import{S as y}from"./section-ZPKr6_ii.js";import{d as ot}from"./keyboard-arrow-down-rounded-8U0_i9QO.js";import{u as it}from"./index-DlrQ2HQP.js";import{v as at}from"./index-Ba9-ArMT.js";import{r as rt}from"./base32-BK7MXAD4.js";import{u as lt}from"./use-mobile-BQQpAf3i.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DeeG8u0h.js";import"./required-BT8zXV8U.js";const we={width:24,height:24,body:'<path fill="currentColor" d="M5 4v16V4v5v-5Zm3 10h2.675q.275-.575.638-1.075t.812-.925H8q-.425 0-.713.288T7 13q0 .425.288.713T8 14Zm0 4h2.075Q10 17.5 10 17t.075-1H8q-.425 0-.713.288T7 17q0 .425.288.713T8 18Zm-3 4q-.825 0-1.413-.588T3 20V4q0-.825.588-1.413T5 2h7.175q.4 0 .763.15t.637.425l4.85 4.85q.275.275.425.638t.15.762V10.3q-.475-.15-.975-.225T17 10V9h-4q-.425 0-.713-.288T12 8V4H5v16h5.675q.275.575.638 1.075t.812.925H5Zm12-10q2.075 0 3.538 1.463T22 17q0 2.075-1.463 3.538T17 22q-2.075 0-3.538-1.463T12 17q0-2.075 1.463-3.538T17 12Zm0 8q.275 0 .463-.188t.187-.462q0-.275-.187-.463T17 18.7q-.275 0-.463.188t-.187.462q0 .275.188.463T17 20Zm0-6q-.475 0-.875.238t-.65.637q-.1.15-.025.313t.25.237q.15.075.3 0t.275-.2q.125-.175.313-.275t.412-.1q.325 0 .563.213t.237.537q0 .275-.15.463t-.35.387q-.15.15-.313.3t-.287.35q-.075.15-.113.313t-.037.337q0 .225.125.413t.325.187q.2 0 .325-.15t.125-.35q0-.275.15-.488t.35-.412q.3-.275.525-.613t.225-.737q0-.675-.5-1.138T17 14Z"/>'},ue={enabled:!1,domain:"",clientId:"",clientSecret:""};function ct(){const{api:b}=N(),{blocklet:c}=M(),{t,locale:n}=ee(),o=c?.meta?.did,r=Object.assign({...ue},c?.settings?.oauth?.auth0||{}),{handleSubmit:x,control:i,formState:p,watch:d,reset:f}=te({defaultValues:Z(r,Object.keys(ue))}),l=d("enabled"),j=u(async s=>{try{const{blocklet:I}=await b.configOAuth({input:{did:o,oauth:JSON.stringify({auth0:s})}}),L=Object.assign({...ue},I?.settings?.oauth?.auth0||{});f(L),O.success(t("oauth.saveSuccess"))}catch(I){O.error(I.message||t("oauth.saveFailed"))}}),v=u(s=>s?.trim()?!0:t("oauth.auth0.domainDescription")),S=u(s=>s?.trim()?!0:t("oauth.auth0.clientIdDescription")),g=u(s=>s?.trim()?!0:t("oauth.auth0.clientSecretDescription")),w=u(()=>!0),h=H(()=>n==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-auth0":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-auth0",[n]);return e.jsx(a,{children:e.jsxs("form",{onSubmit:x(j),disabled:!0,children:[e.jsx(y,{title:e.jsxs(a,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx("span",{children:t("oauth.auth0.enable")}),e.jsx(ce,{title:t("oauth.viewDocument"),children:e.jsx(a,{component:"a",sx:{display:"inline-block",color:"inherit",fontSize:0,lineHeight:1},href:h,target:"_blank",rel:"noreferrer",children:e.jsx(X,{icon:we,fontSize:20})})})]}),mb:2.5,children:e.jsx(k,{name:"enabled",control:i,render:({field:s})=>e.jsx(R,{control:e.jsx(ae,{sx:{ml:1},checked:s.value,...s})})})}),e.jsx(y,{title:t("oauth.auth0.domain"),children:e.jsx(k,{name:"domain",control:i,rules:{validate:l?v:w},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.auth0.domain"),error:!!p.errors[s.name],helperText:p.errors[s.name]?.message||" ",disabled:!l})})})}),e.jsx(y,{title:t("oauth.auth0.clientId"),children:e.jsx(k,{name:"clientId",control:i,rules:{validate:l?S:w},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.auth0.clientId"),error:!!p.errors[s.name],helperText:p.errors[s.name]?.message||" ",disabled:!l})})})}),e.jsx(y,{title:t("oauth.auth0.clientSecret"),children:e.jsx(k,{name:"clientSecret",control:i,rules:{validate:l?g:w},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",type:"password",label:t("oauth.auth0.clientSecret"),error:!!p.errors[s.name],helperText:p.errors[s.name]?.message||" ",disabled:!l})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:x(j),disabled:!p.isDirty,children:t("oauth.save")})]})})}const he={enabled:!1,clientId:"",clientSecret:""};function dt(){const{api:b}=N(),{blocklet:c}=M(),{t,locale:n}=ee(),o=c?.meta?.did,r=Object.assign({...he},c?.settings?.oauth?.github||{}),{handleSubmit:x,control:i,formState:p,watch:d,reset:f}=te({defaultValues:Z(r,Object.keys(he))}),l=d("enabled"),j=u(async h=>{try{const{blocklet:s}=await b.configOAuth({input:{did:o,oauth:JSON.stringify({github:h})}}),I=Object.assign({...he},s?.settings?.oauth?.github||{});f(I),O.success(t("oauth.saveSuccess"))}catch(s){O.error(s.message||t("oauth.saveFailed"))}}),v=u(h=>h?.trim()?!0:t("oauth.github.clientIdDescription")),S=u(h=>h?.trim()?!0:t("oauth.github.clientSecretDescription")),g=u(()=>!0),w=H(()=>n==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-github":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-github",[n]);return e.jsx(a,{children:e.jsxs("form",{onSubmit:x(j),disabled:!0,children:[e.jsx(y,{title:e.jsxs(a,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx("span",{children:t("oauth.github.enable")}),e.jsx(ce,{title:t("oauth.viewDocument"),children:e.jsx(a,{component:"a",sx:{display:"inline-block",color:"inherit",fontSize:0,lineHeight:1},href:w,target:"_blank",rel:"noreferrer",children:e.jsx(X,{icon:we,fontSize:20})})})]}),mb:2.5,sx:{"& .section-content":{alignItems:"center"}},children:e.jsx(k,{name:"enabled",control:i,sx:{alignItems:"center"},render:({field:h})=>e.jsx(R,{control:e.jsx(ae,{sx:{ml:1},size:"small",checked:h.value,...h})})})}),e.jsx(y,{title:t("oauth.github.clientId"),children:e.jsx(k,{name:"clientId",control:i,rules:{validate:l?v:g},render:({field:h})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...h,size:"small",label:t("oauth.github.clientId"),error:!!p.errors[h.name],helperText:p.errors[h.name]?.message||" ",disabled:!l})})})}),e.jsx(y,{title:t("oauth.github.clientSecret"),children:e.jsx(k,{name:"clientSecret",control:i,rules:{validate:l?S:g},render:({field:h})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...h,size:"small",type:"password",label:t("oauth.github.clientSecret"),error:!!p.errors[h.name],helperText:p.errors[h.name]?.message||" ",disabled:!l})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:x(j),disabled:!p.isDirty,children:t("oauth.save")})]})})}const me={enabled:!1,clientId:"",clientSecret:""};function ut(){const{api:b}=N(),{blocklet:c}=M(),{t,locale:n}=ee(),o=c?.meta?.did,r=Object.assign({...me},c?.settings?.oauth?.google||{}),{handleSubmit:x,control:i,formState:p,watch:d,reset:f}=te({defaultValues:Z(r,Object.keys(me))}),l=d("enabled"),j=u(async h=>{try{const{blocklet:s}=await b.configOAuth({input:{did:o,oauth:JSON.stringify({google:h})}}),I=Object.assign({...me},s?.settings?.oauth?.google||{});f(I),O.success(t("oauth.saveSuccess"))}catch(s){O.error(s.message||t("oauth.saveFailed"))}}),v=u(h=>h?.trim()?!0:t("oauth.google.clientIdDescription")),S=u(h=>h?.trim()?!0:t("oauth.google.clientSecretDescription")),g=u(()=>!0),w=H(()=>n==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-google":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-google",[n]);return e.jsx(a,{children:e.jsxs("form",{onSubmit:x(j),disabled:!0,children:[e.jsx(y,{title:e.jsxs(a,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx("span",{children:t("oauth.google.enable")}),e.jsx(ce,{title:t("oauth.viewDocument"),children:e.jsx(a,{component:"a",sx:{display:"inline-block",color:"inherit",fontSize:0,lineHeight:1},href:w,target:"_blank",rel:"noreferrer",children:e.jsx(X,{icon:we,fontSize:20})})})]}),mb:2.5,children:e.jsx(k,{name:"enabled",control:i,render:({field:h})=>e.jsx(R,{control:e.jsx(ae,{sx:{ml:1},checked:h.value,...h})})})}),e.jsx(y,{title:t("oauth.google.clientId"),children:e.jsx(k,{name:"clientId",control:i,rules:{validate:l?v:g},render:({field:h})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...h,size:"small",label:t("oauth.google.clientId"),error:!!p.errors[h.name],helperText:p.errors[h.name]?.message||" ",disabled:!l})})})}),e.jsx(y,{title:t("oauth.google.clientSecret"),children:e.jsx(k,{name:"clientSecret",control:i,rules:{validate:l?S:g},render:({field:h})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...h,size:"small",type:"password",label:t("oauth.google.clientSecret"),error:!!p.errors[h.name],helperText:p.errors[h.name]?.message||" ",disabled:!l})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:x(j),disabled:!p.isDirty,children:t("oauth.save")})]})})}const pe={enabled:!1,teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function ht(){const{api:b}=N(),{blocklet:c}=M(),{t}=ee(),n=c?.meta?.did,o=Object.assign({...pe},c?.settings?.oauth?.apple||{}),{handleSubmit:r,control:x,formState:i,watch:p,reset:d}=te({defaultValues:Z(o,Object.keys(pe))}),f=p("enabled"),l=u(async s=>{try{const{blocklet:I}=await b.configOAuth({input:{did:n,oauth:JSON.stringify({apple:s})}}),L=Object.assign({...pe},I?.settings?.oauth?.apple||{});d(L),O.success(t("oauth.saveSuccess"))}catch(I){O.error(I.message||t("oauth.saveFailed"))}}),j=u(s=>s?.trim()?!0:t("oauth.apple.teamIdDescription")),v=u(s=>s?.trim()?!0:t("oauth.apple.serviceIdDescription")),S=u(s=>s?.trim()?!0:t("oauth.apple.keyIdDescription")),g=u(s=>s?.trim()?!0:t("oauth.apple.authKeyDescription")),w=u(s=>s?.trim()?!0:t("oauth.apple.bundleIdDescription")),h=u(()=>!0);return e.jsx(a,{children:e.jsxs("form",{onSubmit:r(l),disabled:!0,children:[e.jsx(y,{title:t("oauth.apple.enable"),mb:2.5,children:e.jsx(k,{name:"enabled",control:x,render:({field:s})=>e.jsx(R,{control:e.jsx(ae,{sx:{ml:1},checked:s.value,...s})})})}),e.jsx(y,{title:t("oauth.apple.teamId"),children:e.jsx(k,{name:"teamId",control:x,rules:{validate:f?j:h},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.apple.teamId"),error:!!i.errors[s.name],helperText:i.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.apple.bundleId"),children:e.jsx(k,{name:"bundleId",control:x,rules:{validate:f?w:h},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.apple.bundleId"),error:!!i.errors[s.name],helperText:i.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.apple.serviceId"),children:e.jsx(k,{name:"serviceId",control:x,rules:{validate:f?v:h},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.apple.serviceId"),error:!!i.errors[s.name],helperText:i.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.apple.keyId"),children:e.jsx(k,{name:"keyId",control:x,rules:{validate:f?S:h},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.apple.keyId"),error:!!i.errors[s.name],helperText:i.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.apple.authKey"),children:e.jsx(k,{name:"authKey",control:x,rules:{validate:f?g:h},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",type:"password",label:t("oauth.apple.authKey"),multiline:!0,rows:4,error:!!i.errors[s.name],helperText:i.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:r(l),disabled:!i.isDirty,children:t("oauth.save")})]})})}const xe={enabled:!1,clientId:"",clientSecret:""};function mt(){const{api:b}=N(),{blocklet:c}=M(),{t}=ee(),n=c?.meta?.did,o=Object.assign({...xe},c?.settings?.oauth?.twitter||{}),{handleSubmit:r,control:x,formState:i,watch:p,reset:d}=te({defaultValues:Z(o,Object.keys(xe))}),f=p("enabled"),l=u(async g=>{try{const{blocklet:w}=await b.configOAuth({input:{did:n,oauth:JSON.stringify({twitter:g})}}),h=Object.assign({...xe},w?.settings?.oauth?.twitter||{});d(h),O.success(t("oauth.saveSuccess"))}catch(w){O.error(w.message||t("oauth.saveFailed"))}}),j=u(g=>g?.trim()?!0:t("oauth.twitter.clientIdDescription")),v=u(g=>g?.trim()?!0:t("oauth.twitter.clientSecretDescription")),S=u(()=>!0);return e.jsx(a,{children:e.jsxs("form",{onSubmit:r(l),disabled:!0,children:[e.jsx(y,{title:e.jsx(a,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsx("span",{children:t("oauth.twitter.enable")})}),mb:2.5,sx:{"& .section-content":{alignItems:"center"}},children:e.jsx(k,{name:"enabled",control:x,sx:{alignItems:"center"},render:({field:g})=>e.jsx(R,{control:e.jsx(ae,{sx:{ml:1},size:"small",checked:g.value,...g})})})}),e.jsx(y,{title:t("oauth.twitter.clientId"),children:e.jsx(k,{name:"clientId",control:x,rules:{validate:f?j:S},render:({field:g})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...g,size:"small",label:t("oauth.twitter.clientId"),error:!!i.errors[g.name],helperText:i.errors[g.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.twitter.clientSecret"),children:e.jsx(k,{name:"clientSecret",control:x,rules:{validate:f?v:S},render:({field:g})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...g,size:"small",type:"password",label:t("oauth.twitter.clientSecret"),error:!!i.errors[g.name],helperText:i.errors[g.name]?.message||" ",disabled:!f})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:r(l),disabled:!i.isDirty,children:t("oauth.save")})]})})}const pt={width:24,height:24,body:'<path fill="currentColor" d="M9 20q-.825 0-1.413-.588T7 18q0-.825.588-1.413T9 16q.825 0 1.413.588T11 18q0 .825-.588 1.413T9 20Zm6 0q-.825 0-1.413-.588T13 18q0-.825.588-1.413T15 16q.825 0 1.413.588T17 18q0 .825-.588 1.413T15 20Zm-6-6q-.825 0-1.413-.588T7 12q0-.825.588-1.413T9 10q.825 0 1.413.588T11 12q0 .825-.588 1.413T9 14Zm6 0q-.825 0-1.413-.588T13 12q0-.825.588-1.413T15 10q.825 0 1.413.588T17 12q0 .825-.588 1.413T15 14ZM9 8q-.825 0-1.413-.588T7 6q0-.825.588-1.413T9 4q.825 0 1.413.588T11 6q0 .825-.588 1.413T9 8Zm6 0q-.825 0-1.413-.588T13 6q0-.825.588-1.413T15 4q.825 0 1.413.588T17 6q0 .825-.588 1.413T15 8Z"/>'};function Re({id:b,title:c,children:t,index:n,onMove:o,defaultExpand:r=!1,onEnd:x,icon:i=null}){const[p,d]=D.useState(r),f=D.useRef(null),l=D.useRef(null),[{handlerId:j},v]=Ee({accept:"dragItem",collect(s){return{handlerId:s.getHandlerId()}},hover(s,I){if(!f.current)return;const L=s.index,m=n;if(L===m)return;const A=f.current?.getBoundingClientRect(),_=l.current?.getBoundingClientRect(),re=(_.bottom-_.top)/2,$=I.getClientOffset().y-A.top;L<m&&$<re||L>m&&$>re||(o(L,m),s.index=m)}}),[{isDragging:S},g]=Ue({item:{index:n,type:"dragItem"},collect:s=>({isDragging:s.isDragging()}),end:x});g(l),v(f);const w=S?.5:1,h=u(s=>{s.preventDefault(),s.stopPropagation(),d(!p)});return e.jsxs(a,{ref:f,children:[e.jsxs(a,{sx:{cursor:"pointer","&:hover":{backgroundColor:"grey.100"}},ref:l,"data-handler-id":j,children:[e.jsxs(a,{sx:{py:2,px:1,opacity:w,display:"flex",alignItems:"center",gap:.5},draggable:!1,onClick:h,children:[e.jsx(a,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:"text.hint","&:hover":{color:"text.secondary"}},children:e.jsx(X,{fontSize:20,icon:pt})}),e.jsx(a,{sx:{display:"flex",alignItems:"center",flexShrink:0,mr:.5,transform:"translateY(-1px)"},children:i}),e.jsx(Q,{sx:{flex:1},children:c}),e.jsx(le,{size:"small",sx:{pointerEvents:"auto",transform:p?"":"rotate(180deg)",transition:"transform 0.3s ease"},children:e.jsx(X,{icon:ot,style:{transform:"scale(1.5)"}})})]}),e.jsx(oe,{})]}),e.jsx(a,{sx:{pl:4,py:2.5,display:p?"block":"none"},children:t})]})}Re.propTypes={title:E.string.isRequired,id:E.string.isRequired,children:E.node.isRequired,index:E.number.isRequired,onMove:E.func.isRequired,onEnd:E.func.isRequired,defaultExpand:E.bool,icon:E.any};const xt=[{name:"github",title:G.PROVIDER_NAME.github,icon:e.jsx(se,{provider:"github",sx:{width:20,height:20}}),component:e.jsx(dt,{})},{name:"google",title:G.PROVIDER_NAME.google,icon:e.jsx(se,{provider:"google",sx:{width:20,height:20}}),component:e.jsx(ut,{})},{name:"apple",title:G.PROVIDER_NAME.apple,icon:e.jsx(se,{provider:"apple",sx:{width:20,height:20}}),component:e.jsx(ht,{})},{name:"twitter",title:G.PROVIDER_NAME.twitter,icon:e.jsx(se,{provider:"twitter",sx:{width:20,height:20}}),component:e.jsx(mt,{})},{name:"auth0",title:G.PROVIDER_NAME.auth0,icon:e.jsx(se,{provider:"auth0",sx:{width:20,height:20}}),component:e.jsx(ct,{})}],ft=["github","google","apple","twitter","auth0"];function gt(){const{api:b}=N(),{blocklet:c}=M(),t=c?.meta?.did,n=c?.settings?.oauth||{},o=Object.keys(n).sort((l,j)=>n[l]?.order!==void 0&&n[j]?.order!==void 0?n[l].order-n[j].order:n[l]?.order!==void 0?-1:1);for(const l of ft)o.includes(l)||o.push(l);const r=ie(o.reduce((l,j,v)=>Object.assign(l,{[j]:v}),{})),x=H(()=>{const l=[...xt];return l.sort((j,v)=>r[j.name]-r[v.name]),l.map(j=>({...j,enabled:n[j.name]?.enabled??!1}))},[r.auth0,r.github,r.google]),i={};typeof window<"u"&&(i.context=window);const p=u(async l=>{const j={};Object.keys(l).forEach(v=>{j[v]={order:l[v]}}),await b.configOAuth({input:{did:t,oauth:JSON.stringify(j)}})}),d=u((l,j)=>{const v=x[l],S=x[j];r[v.name]=j,r[S.name]=l}),f=u(async()=>{await p(r)});return e.jsx(a,{sx:{".section-left":{width:"180px"}},children:e.jsx(We,{backend:Ve,...i,children:x.map((l,j)=>e.jsx(Re,{index:j,id:l.name,title:l.title,icon:l.icon,onMove:d,onEnd:f,defaultExpand:l.enabled,children:l.component},l.name))})})}const J={ttl:ve.SESSION_TTL,cacheTtl:ve.SESSION_CACHE_TTL,email:{enabled:!1,requireVerified:!1,requireUnique:!1,trustOauthProviders:!1,trustedIssuers:[],enableDomainBlackList:!1,domainBlackList:[],enableDomainWhiteList:!1,domainWhiteList:[]},phone:{enabled:!1,requireVerified:!1,requireUnique:!1,regionBlackList:[],trustedIssuers:[]},enableBlacklist:!1};function U(b){return e.jsx(it,{...b,sx:{transform:"scale(0.75)"}})}function fe(b,c=!1){const t=c?b.ttl*86400:b.ttl/86400;return{...b,ttl:t}}function jt(){const{api:b}=N(),{blocklet:c}=M(),t=c?.meta?.did,n=Xe({},J,c?.settings?.session||{});de(n.ttl)&&(n.ttl=J.ttl),de(n.cacheTtl)&&(n.cacheTtl=J.cacheTtl),n.phone||(n.phone=J.phone),n.email||(n.email=J.email),de(n.enableBlacklist)&&(n.enableBlacklist=J.enableBlacklist);const{handleSubmit:o,control:r,formState:x,reset:i,watch:p}=te({defaultValues:Z(fe(n),["ttl","cacheTtl","email","phone","enableBlacklist"])}),{t:d}=ee(),f=p("email.enabled"),l=p("phone.enabled"),j=p("email.enableDomainBlackList"),v=p("email.enableDomainWhiteList"),{fields:S,append:g,remove:w}=De({control:r,name:"email.domainBlackList"}),{fields:h,append:s,remove:I}=De({control:r,name:"email.domainWhiteList"}),L=u(async m=>{try{const{blocklet:A}=await b.updateAppSessionConfig({input:{did:t,config:et(fe(m,!0),["phone"])}}),_=Object.assign({},J,Z(A?.settings?.session||{},["ttl","cacheTtl","email","phone","enableBlacklist"]));i(fe(_)),O.success(d("common.configSuccess"))}catch(A){O.error(A.message)}});return e.jsx(bt,{onSubmit:o(L),children:e.jsxs(W,{direction:"column",sx:{gap:6},children:[e.jsxs(a,{children:[e.jsxs(a,{children:[e.jsx(Q,{variant:"h6",sx:{fontWeight:600},children:d("blocklet.config.session.profile")}),e.jsx(a,{component:oe,sx:{my:3}})]}),e.jsxs(W,{sx:{gap:2},children:[e.jsx(y,{title:d("blocklet.config.session.fullNameEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(a,{sx:{alignSelf:"flex-start"},children:e.jsx(U,{disabled:!0,checked:!0})})}),e.jsx(y,{title:d("blocklet.config.session.avatarEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(a,{sx:{alignSelf:"flex-start"},children:e.jsx(U,{disabled:!0,checked:!0})})}),e.jsx(y,{title:d("blocklet.config.session.emailEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(a,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.enabled",control:r,render:({field:m})=>e.jsx(U,{...m,checked:m.value})})})}),f&&e.jsxs(W,{direction:"column",sx:{ml:2,gap:.5},children:[e.jsx(y,{title:d("blocklet.config.session.emailRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(a,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.requireVerified",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),e.jsx(y,{title:d("blocklet.config.session.emailRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(a,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.requireUnique",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),e.jsx(y,{title:d("blocklet.config.session.emailTrustOauthProviders"),sectionLeftSx:{width:"600px"},children:e.jsx(a,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.trustOauthProviders",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),e.jsx(y,{title:d("blocklet.config.session.enableDomainBlackList"),sectionLeftSx:{width:"600px"},children:e.jsx(a,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.enableDomainBlackList",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),j&&e.jsxs(a,{children:[S.map((m,A)=>e.jsxs(W,{direction:"row",sx:{alignItems:"center",my:1,maxWidth:"720px"},children:[e.jsx(k,{name:`email.domainBlackList.${A}`,control:r,render:_=>e.jsx(F,{..._.field,size:"small",fullWidth:!0})}),e.jsx(le,{onClick:()=>w(A),children:e.jsx(qe,{})})]},m.id)),e.jsx(V,{startIcon:e.jsx(Le,{}),onClick:()=>g(""),children:d("blocklet.config.session.addDomain")})]}),e.jsx(y,{title:d("blocklet.config.session.enableDomainWhiteList"),sectionLeftSx:{width:"600px"},children:e.jsx(a,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.enableDomainWhiteList",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),v&&e.jsxs(a,{children:[h.map((m,A)=>e.jsxs(W,{direction:"row",sx:{alignItems:"center",my:1,maxWidth:"720px"},children:[e.jsx(k,{name:`email.domainWhiteList.${A}`,control:r,render:_=>e.jsx(F,{..._.field,size:"small",fullWidth:!0})}),e.jsx(le,{onClick:()=>I(A),children:e.jsx(qe,{})})]},m.id)),e.jsx(V,{startIcon:e.jsx(Le,{}),onClick:()=>s(""),children:d("blocklet.config.session.addDomain")})]})]}),e.jsxs(a,{sx:{display:"none"},children:[e.jsx(y,{title:d("blocklet.config.session.phoneEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(a,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"phone.enabled",control:r,disabled:!0,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),l&&e.jsxs(W,{direction:"column",sx:{ml:2,mt:1},children:[e.jsx(y,{title:d("blocklet.config.session.phoneRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(a,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"phone.requireVerified",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),e.jsx(y,{title:d("blocklet.config.session.phoneRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(a,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"phone.requireUnique",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})})]})]})]})]}),e.jsxs(a,{children:[e.jsx(Q,{variant:"h6",sx:{fontWeight:600},children:d("blocklet.config.session.period")}),e.jsx(a,{component:oe,sx:{my:3}}),e.jsx(W,{direction:"column",spacing:2,children:e.jsx(k,{name:"ttl",control:r,rules:{min:1,max:30},render:({field:m})=>e.jsx(B,{fullWidth:!0,sx:{mb:2},children:e.jsx(y,{title:d("blocklet.config.session.ttl",{day:m.value}),sectionLeftSx:{width:"600px"},children:e.jsx(a,{sx:{width:"100%",maxWidth:500,px:2},children:e.jsx(Je,{...m,defaultValue:7,step:1,marks:[{value:1,label:d("blocklet.config.session.day",{day:1})},{value:7,label:d("blocklet.config.session.days",{day:7})},{value:14,label:d("blocklet.config.session.days",{day:14})},{value:21,label:d("blocklet.config.session.days",{day:21})},{value:30,label:d("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto"})})})})})})]}),e.jsxs(a,{children:[e.jsx(Q,{variant:"h6",sx:{fontWeight:600},children:d("blocklet.config.session.experimentalSettings")}),e.jsx(a,{component:oe,sx:{my:3}}),e.jsx(W,{direction:"column",spacing:2,children:e.jsx(y,{title:d("blocklet.config.session.enableBlacklist"),sectionLeftSx:{width:"600px"},children:e.jsx(a,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"enableBlacklist",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})})})]}),e.jsx(a,{children:e.jsx(V,{type:"submit",variant:"contained",disabled:!x.isDirty,children:d("oauth.save")})})]})})}const bt=Fe.form`
|
|
2
2
|
max-width: 1536px;
|
|
3
3
|
|
|
4
4
|
.advanced-config {
|