@abtnode/blocklet-services 1.16.47-beta-20250729-045152-0bde0f98 → 1.16.47-beta-20250730-070104-87a128a5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/libs/auth/adapters/twitter.js +52 -10
- package/api/libs/auth/index.js +23 -8
- package/api/routes/oauth/client.js +13 -2
- package/dist/assets/{AdapterDayjs-DqHaPgQe.js → AdapterDayjs-BEkLDdDJ.js} +1 -1
- package/dist/assets/{Google-rBKDD2qv.js → Google-kE2qbn1K.js} +1 -1
- package/dist/assets/{access-control-H5gJSNdb.js → access-control-FYs8JoGO.js} +1 -1
- package/dist/assets/{add-component-core-DVFKopDK.js → add-component-core-BB6rCC8n.js} +1 -1
- package/dist/assets/{add-resource-COFvO15J.js → add-resource-BlKrIrw0.js} +1 -1
- package/dist/assets/{addon-BYMjiX5k.js → addon-g3Lz4kfk.js} +1 -1
- package/dist/assets/{advanced-Hq6AYyrx.js → advanced-DyVpf_DB.js} +1 -1
- package/dist/assets/{aigne-BnCUXX1g.js → aigne-B2kmHT_s.js} +1 -1
- package/dist/assets/{appearance-DtM7u0dZ.js → appearance-D0WJqn3Y.js} +1 -1
- package/dist/assets/{ar-C6feXgCU.js → ar-7eC8LKj2.js} +2 -2
- package/dist/assets/{arrow-down.svg-B7DowRKZ.js → arrow-down.svg-CH8Xzna_.js} +1 -1
- package/dist/assets/{audit-logs-O4jNFdmW.js → audit-logs-BLZ_FXya.js} +1 -1
- package/dist/assets/{authorize-D5WwVWfv.js → authorize-DqbV7Yj5.js} +1 -1
- package/dist/assets/{base32-C4LxA2tB.js → base32-B9yl211y.js} +1 -1
- package/dist/assets/{branding-D98KgaHM.js → branding-B_9Ik1Ul.js} +1 -1
- package/dist/assets/{branding-sd39Ynpe.js → branding-CbIhan7S.js} +2 -2
- package/dist/assets/{bundle-avatar-CQ9SkEeN.js → bundle-avatar-DzIGEDbC.js} +1 -1
- package/dist/assets/{button-CYQznU4T.js → button-CPgviFPs.js} +1 -1
- package/dist/assets/{click-to-copy-lzAgjcxY.js → click-to-copy-C43vd7DG.js} +1 -1
- package/dist/assets/{complete-BuT0mMhb.js → complete-Cx5YFdNr.js} +1 -1
- package/dist/assets/{component-B6-qj2oP.js → component-99-uAXc0.js} +3 -3
- package/dist/assets/{config-u2W5FqRC.js → config-B4lheVsX.js} +1 -1
- package/dist/assets/{config-Dx4HUdFU.js → config-Dr0r0k-g.js} +1 -1
- package/dist/assets/{config-navigation-CAHetpcF.js → config-navigation-ToPhdOjg.js} +3 -3
- package/dist/assets/{config-space-Ccsdbr_w.js → config-space-CT21iR_2.js} +1 -1
- package/dist/assets/config-yxcrU66X.js +26 -0
- package/dist/assets/{confirm-r3sqe3V_.js → confirm-5e46DDlz.js} +1 -1
- package/dist/assets/{connect-D_JpZlze.js → connect-BHDDk939.js} +1 -1
- package/dist/assets/{connect-DZOeb89f.js → connect-hooMfIaO.js} +1 -1
- package/dist/assets/{connect-to-CXPG0pc1.js → connect-to-DfxSuVNx.js} +1 -1
- package/dist/assets/{createClass-Bc9MS-p1.js → createClass-BuE_i6UP.js} +1 -1
- package/dist/assets/{dashboard-lwb0kKFC.js → dashboard-DaKd1daE.js} +3 -3
- package/dist/assets/{de-Bac37XGJ.js → de-DgwOa_mf.js} +2 -2
- package/dist/assets/{delete-confirm-CXK3h2Jb.js → delete-confirm-Bim07gVu.js} +1 -1
- package/dist/assets/{did-address-DluwIRGz.js → did-address-DrmEnz9K.js} +1 -1
- package/dist/assets/{domain-BoFriW8S.js → domain-D_RRXHNv.js} +1 -1
- package/dist/assets/{domain-action-card-Boc_d4u-.js → domain-action-card-BTosQrln.js} +1 -1
- package/dist/assets/domains-BV1O_rDN.js +1 -0
- package/dist/assets/{email-FnXhK9LU.js → email-BCDbiSlJ.js} +1 -1
- package/dist/assets/engine-BVHpout7.js +1 -0
- package/dist/assets/{es-yR0ybdzc.js → es-B_gBSKp3.js} +2 -2
- package/dist/assets/{exchange-passport-B96rlC01.js → exchange-passport-DIp9EJVY.js} +1 -1
- package/dist/assets/{form-C9siue_j.js → form-BVnHvgNl.js} +1 -1
- package/dist/assets/{form-text-input-CY28NucT.js → form-text-input-x3g3qd72.js} +1 -1
- package/dist/assets/{fr-Ck_83QEV.js → fr-Bm0AhLrO.js} +2 -2
- package/dist/assets/{fuel-ip-XShkP.js → fuel-Fh-ifxfq.js} +1 -1
- package/dist/assets/{gen-access-key-hQbQGeHL.js → gen-access-key-BZufQ91-.js} +1 -1
- package/dist/assets/{gen-simple-access-key-DhhUeuHA.js → gen-simple-access-key-DlPE_0y2.js} +1 -1
- package/dist/assets/get-safe-url-D9ZX2qFm.js +1 -0
- package/dist/assets/hi-DO31L4at.js +5 -0
- package/dist/assets/{home-DH1HEoFw.js → home-B6em2u64.js} +1 -1
- package/dist/assets/{id-vCjhjvq0.js → id-BYCjnoK8.js} +2 -2
- package/dist/assets/{iframe-DaHU_yfJ.js → iframe-Dl-5xRyx.js} +1 -1
- package/dist/assets/{index-g0GOIUzU.js → index-1-P2gWGZ.js} +1 -1
- package/dist/assets/index-467tNKTx.js +124 -0
- package/dist/assets/{index-DHMsDwjO.js → index-7fdKVdEw.js} +1 -1
- package/dist/assets/{index-BsrKRqOk.js → index-B6RoOcNF.js} +1 -1
- package/dist/assets/{index-O5IErvL8.js → index-B88jr6sm.js} +1 -1
- package/dist/assets/{index-BjWzP42J.js → index-B_JPa3k-.js} +1 -1
- package/dist/assets/{index-O2H5hZUj.js → index-BituGg_i.js} +1 -1
- package/dist/assets/{index-aPdf9wdf.js → index-CC1_0xzr.js} +4 -4
- package/dist/assets/{index-BX0ipkE3.js → index-Ca2q4nT6.js} +1 -1
- package/dist/assets/{index-WoLidiqP.js → index-CiFQnBvO.js} +1 -1
- package/dist/assets/{index-J8izjET5.js → index-CkuzlAat.js} +1 -1
- package/dist/assets/{index-CCHdGYeo.js → index-Cq-4YOTs.js} +1 -1
- package/dist/assets/{index-ChbQ5IZK.js → index-D6YhMyoB.js} +82 -82
- package/dist/assets/{index-DeVFfavE.js → index-D6ZAoKh5.js} +1 -1
- package/dist/assets/{index-BbjQCNW8.js → index-D8gGAVdB.js} +1 -1
- package/dist/assets/{index-D8eFhNEN.js → index-DEDOywis.js} +1 -1
- package/dist/assets/{index-DN1NV7CH.js → index-DIeXMLLs.js} +1 -1
- package/dist/assets/{index-BCf6_SpY.js → index-DTuL5S3g.js} +1 -1
- package/dist/assets/index-DZFL6rrK.js +55 -0
- package/dist/assets/{index-KwEQZgkA.js → index-DiW2Y89J.js} +7 -7
- package/dist/assets/{index-BwByZQ3p.js → index-DmgU5YEy.js} +1 -1
- package/dist/assets/{index-OVp-PQ0p.js → index-DraljbB7.js} +1 -1
- package/dist/assets/{index-CdtRmN56.js → index-DscHS5BG.js} +1 -1
- package/dist/assets/{index-B9LwCsP8.js → index-Eagwj9HU.js} +1 -1
- package/dist/assets/{index-DG2Anvyn.js → index-W7Vsgxmq.js} +3 -3
- package/dist/assets/{index-D4hcb3WK.js → index-YhHgNT9f.js} +1 -1
- package/dist/assets/{index-COXPzb2c.js → index-ckUPtmoF.js} +3 -3
- package/dist/assets/{index-BIlQJkXg.js → index-h4nZrNlX.js} +1 -1
- package/dist/assets/{index-9oETfidp.js → index-pvfQRiIz.js} +1 -1
- package/dist/assets/{invitation-CKxKy2Ay.js → invitation-ygFxiD0p.js} +1 -1
- package/dist/assets/{invite-Bsikga4j.js → invite-DMpU1WKR.js} +1 -1
- package/dist/assets/{isURL-C3AhK8hJ.js → isURL-CTW__dzu.js} +1 -1
- package/dist/assets/{issue-passport-on2nKmHY.js → issue-passport-CH_GIDha.js} +1 -1
- package/dist/assets/{item-na16HNtx.js → item-BpwJ2QYy.js} +1 -1
- package/dist/assets/{ja-BpmpH32u.js → ja-Ck2EVKeO.js} +2 -2
- package/dist/assets/{ko-KPtXpJmI.js → ko-Nk_6p6Jl.js} +2 -2
- package/dist/assets/{landing-page-Dd4XdK0e.js → landing-page-Cd61UT7Z.js} +1 -1
- package/dist/assets/{layout-BUDPCiED.js → layout-Bf7XRYSR.js} +1 -1
- package/dist/assets/{list-DfgVl1Dg.js → list-A-6ZKqgn.js} +1 -1
- package/dist/assets/{list-CYU3D6Ph.js → list-BHhWPWs4.js} +2 -2
- package/dist/assets/localization-D1S2pks-.js +1 -0
- package/dist/assets/{log-pxhcYHbW.js → log-ryKQFCdM.js} +1 -1
- package/dist/assets/logger-MoQC3rmC.js +1 -0
- package/dist/assets/{login-CXwHzGIL.js → login-CYXIFDX8.js} +1 -1
- package/dist/assets/{login-oauth-callback-BkQYS3Et.js → login-oauth-callback-DAKrg2Ne.js} +1 -1
- package/dist/assets/{logo-uploader-C_KHc00u.js → logo-uploader-DDncXmM_.js} +2 -2
- package/dist/assets/{lost-passport-CY1qmE3D.js → lost-passport-DEoDgh2I.js} +1 -1
- package/dist/assets/{open-window-BkmmSBIz.js → open-window-eYnS4Amh.js} +1 -1
- package/dist/assets/{over-due-invoice-payment-BX911iJo.js → over-due-invoice-payment-CnaSUbBp.js} +1 -1
- package/dist/assets/{overview-Dx8e9of8.js → overview-BbhCPjub.js} +1 -1
- package/dist/assets/{passport-item-DumQ8HpS.js → passport-item-CPGYYOeu.js} +1 -1
- package/dist/assets/{permission-CfpkIHAA.js → permission-B0EjzZOA.js} +1 -1
- package/dist/assets/{preferences-B02eNzAe.js → preferences-CoP65AxI.js} +1 -1
- package/dist/assets/profile-embed-CdAkuRfH.js +1 -0
- package/dist/assets/pt-C-JzkWqR.js +5 -0
- package/dist/assets/{publish-resource-3sF0Zqs7.js → publish-resource-O6nixlJ9.js} +1 -1
- package/dist/assets/{react-beautiful-dnd.esm-iaARkqsv.js → react-beautiful-dnd.esm-CdYP6hjZ.js} +1 -1
- package/dist/assets/ru-DR6is0tr.js +5 -0
- package/dist/assets/{runtime-DRnXVAEC.js → runtime-lAc0mbn0.js} +1 -1
- package/dist/assets/sdk-CiRRFKs0.js +1 -0
- package/dist/assets/{security-B4jFsUWb.js → security-DzpCKO8Z.js} +1 -1
- package/dist/assets/{session-BM5XfKcI.js → session-fyUi2EvV.js} +1 -1
- package/dist/assets/{setup-DoUJgHlM.js → setup-BtNJlN-g.js} +3 -3
- package/dist/assets/{spaces-8Gh4JUzp.js → spaces-Ci_JwPPC.js} +1 -1
- package/dist/assets/{start-RNf47lA6.js → start-CvpuRdlI.js} +1 -1
- package/dist/assets/{starting-progress-BTbFxXbY.js → starting-progress-4SearER_.js} +1 -1
- package/dist/assets/{status-Dnv7MYP_.js → status-BYn5dcxB.js} +1 -1
- package/dist/assets/{step-actions-CEpMpZxJ.js → step-actions-vNi6kxQk.js} +1 -1
- package/dist/assets/{studio-Dg0TdHNU.js → studio-CU2xUA6B.js} +1 -1
- package/dist/assets/{switch-control-CVVE4fn-.js → switch-control-Cd3JbWWV.js} +1 -1
- package/dist/assets/{table-tips-BxCWkqEh.js → table-tips-3_n5uR-X.js} +1 -1
- package/dist/assets/{team-CuDtwJsC.js → team-Bxi69lmr.js} +5 -5
- package/dist/assets/th-Cn3755Vi.js +5 -0
- package/dist/assets/{traffic-BjYLWken.js → traffic-5kSM9zFo.js} +1 -1
- package/dist/assets/{transfer-FEA7qU-c.js → transfer-1mPm3DHh.js} +1 -1
- package/dist/assets/{unsubscribe-DVj9D5OD.js → unsubscribe-BHRGSL9f.js} +1 -1
- package/dist/assets/{use-promise-window-open-Bt2QjWzW.js → use-promise-window-open-DzOXAig9.js} +1 -1
- package/dist/assets/{use-window-close-CtToNYiO.js → use-window-close-CleYtwbz.js} +1 -1
- package/dist/assets/{useLocalStorage-BHPHetgk.js → useLocalStorage-Dgwq5dGM.js} +1 -1
- package/dist/assets/user-center-D7U8E_9U.js +126 -0
- package/dist/assets/{user-sessions-Dh05ZZ1r.js → user-sessions-CFuRw6Kk.js} +1 -1
- package/dist/assets/{util-DFICUzKo.js → util-CxrGdmDd.js} +1 -1
- package/dist/assets/{util-BSXtIaUE.js → util-DhFzZqQY.js} +1 -1
- package/dist/assets/{vendor-arcblock-BAR_xVfk.js → vendor-arcblock-BnbwP1kf.js} +1 -1
- package/dist/assets/{vendor-ux-Aiuoyn1t.js → vendor-ux-CUBj5GXM.js} +3 -3
- package/dist/assets/vi-7MIaoDt9.js +5 -0
- package/dist/assets/wrap-locale-CnZSJgmv.js +1 -0
- package/dist/assets/{zh-Dz39CLak.js → zh-DswrR4Lx.js} +1 -1
- package/dist/assets/{zh-_14HResX.js → zh-IccOJN0P.js} +1 -1
- package/dist/assets/{zh-tw-CCltfULq.js → zh-tw-De_IfliP.js} +1 -1
- package/dist/index.html +3 -3
- package/dist/service-worker.js +1 -1
- package/package.json +31 -32
- package/dist/assets/config-C3pgsr2T.js +0 -26
- package/dist/assets/domains-CW8cmy1Q.js +0 -1
- package/dist/assets/engine-DFSKY-Aj.js +0 -1
- package/dist/assets/get-safe-url-DnuYbshg.js +0 -1
- package/dist/assets/github-icon-CH2zo-td.js +0 -1
- package/dist/assets/hi-uFi-fD-h.js +0 -5
- package/dist/assets/index-CZYdBkcN.js +0 -55
- package/dist/assets/index-N8u5-2uj.js +0 -124
- package/dist/assets/localization-DMPVPJWB.js +0 -1
- package/dist/assets/logger-CEADsOQs.js +0 -1
- package/dist/assets/profile-embed-BHYPzXMh.js +0 -1
- package/dist/assets/pt-DMhdW8tM.js +0 -5
- package/dist/assets/ru-iMSChq7P.js +0 -5
- package/dist/assets/sdk-B4upvplU.js +0 -1
- package/dist/assets/th-DbMd7IRR.js +0 -5
- package/dist/assets/user-center-B5kWm-Hv.js +0 -126
- package/dist/assets/vi-CmYRzn_U.js +0 -5
- package/dist/assets/wrap-locale-BYl2eZbw.js +0 -1
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import{T as te,H as z,I as M,a4 as Oe,a5 as Re,a6 as ze,a7 as Ue,b as Z,X as xe,a as je,j as Ee,n as P,a8 as We,J as Ve,G as Me,h as Se}from"./vendor-ux-Aiuoyn1t.js";import{b as h,a as N,g as ne,c as _e}from"./vendor-hooks-DTeIFVkk.js";import{r as C}from"./vendor-react-Dvs43sk9.js";import{j as e,ak as i,b6 as O,am as ie,y as R,z as F,Q as _,T as G,I as ae,a3 as ee,W as E,b1 as W,ca as we,cg as Te,c9 as $e,at as Le,D as be,ah as Ce,cD as De,a6 as fe,cE as He,a$ as Ne}from"./vendor-mui-core-CcrDM-5l.js";import{U as H,a1 as $,b8 as Je,b9 as Ze,ba as Ge,c as ge,b2 as Ke,aN as Qe,R as Xe,T as Ye}from"./index-ChbQ5IZK.js";import{d as et}from"./github-icon-CH2zo-td.js";import{A as Q,Q as tt,b as le,Z as nt,n as K,$ as st,C as ot,a as at}from"./vendor-utils-BOkrEpKO.js";import{u as se,C as v,a as qe}from"./index.esm-JPZAjt0x.js";import{S as re}from"./switch-control-CVVE4fn-.js";import{S as k}from"./section-DLNNkzJC.js";import{d as it}from"./keyboard-arrow-down-rounded-8U0_i9QO.js";import{u as rt}from"./index-J8izjET5.js";import{v as lt}from"./index-D8eFhNEN.js";import{r as ct}from"./base32-C4LxA2tB.js";import"./index-CCHdGYeo.js";import{u as dt}from"./use-mobile-B9FM-UBY.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-BAR_xVfk.js";import"./required-qTx6pgJa.js";const ve={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"/>'},ce={enabled:!1,domain:"",clientId:"",clientSecret:""};function ut(){const{api:f}=H(),{blocklet:u}=$(),{t:s,locale:t}=te(),o=u?.meta?.did,r=Object.assign({...ce},u?.settings?.oauth?.auth0||{}),{handleSubmit:x,control:a,formState:p,watch:l,reset:j}=se({defaultValues:Q(r,Object.keys(ce))}),d=l("enabled"),g=h(async n=>{try{const{blocklet:w}=await f.configOAuth({input:{did:o,oauth:JSON.stringify({auth0:n})}}),L=Object.assign({...ce},w?.settings?.oauth?.auth0||{});j(L),z.success(s("oauth.saveSuccess"))}catch(w){z.error(w.message||s("oauth.saveFailed"))}}),b=h(n=>n?.trim()?!0:s("oauth.auth0.domainDescription")),I=h(n=>n?.trim()?!0:s("oauth.auth0.clientIdDescription")),y=h(n=>n?.trim()?!0:s("oauth.auth0.clientSecretDescription")),S=h(()=>!0),c=N(()=>t==="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",[t]);return e.jsx(i,{children:e.jsxs("form",{onSubmit:x(g),disabled:!0,children:[e.jsx(k,{title:e.jsxs(i,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx("span",{children:s("oauth.auth0.enable")}),e.jsx(ie,{title:s("oauth.viewDocument"),children:e.jsx(i,{component:"a",sx:{display:"inline-block",color:"inherit",fontSize:0,lineHeight:1},href:c,target:"_blank",rel:"noreferrer",children:e.jsx(M,{icon:ve,fontSize:20})})})]}),mb:2.5,children:e.jsx(v,{name:"enabled",control:a,render:({field:n})=>e.jsx(O,{control:e.jsx(re,{sx:{ml:1},checked:n.value,...n})})})}),e.jsx(k,{title:s("oauth.auth0.domain"),children:e.jsx(v,{name:"domain",control:a,rules:{validate:d?b:S},render:({field:n})=>e.jsx(R,{fullWidth:!0,children:e.jsx(F,{...n,size:"small",label:s("oauth.auth0.domain"),error:!!p.errors[n.name],helperText:p.errors[n.name]?.message||" ",disabled:!d})})})}),e.jsx(k,{title:s("oauth.auth0.clientId"),children:e.jsx(v,{name:"clientId",control:a,rules:{validate:d?I:S},render:({field:n})=>e.jsx(R,{fullWidth:!0,children:e.jsx(F,{...n,size:"small",label:s("oauth.auth0.clientId"),error:!!p.errors[n.name],helperText:p.errors[n.name]?.message||" ",disabled:!d})})})}),e.jsx(k,{title:s("oauth.auth0.clientSecret"),children:e.jsx(v,{name:"clientSecret",control:a,rules:{validate:d?y:S},render:({field:n})=>e.jsx(R,{fullWidth:!0,children:e.jsx(F,{...n,size:"small",type:"password",label:s("oauth.auth0.clientSecret"),error:!!p.errors[n.name],helperText:p.errors[n.name]?.message||" ",disabled:!d})})})}),e.jsx(_,{type:"submit",variant:"contained",onSubmit:x(g),disabled:!p.isDirty,children:s("oauth.save")})]})})}const de={enabled:!1,clientId:"",clientSecret:""};function ht(){const{api:f}=H(),{blocklet:u}=$(),{t:s,locale:t}=te(),o=u?.meta?.did,r=Object.assign({...de},u?.settings?.oauth?.github||{}),{handleSubmit:x,control:a,formState:p,watch:l,reset:j}=se({defaultValues:Q(r,Object.keys(de))}),d=l("enabled"),g=h(async c=>{try{const{blocklet:n}=await f.configOAuth({input:{did:o,oauth:JSON.stringify({github:c})}}),w=Object.assign({...de},n?.settings?.oauth?.github||{});j(w),z.success(s("oauth.saveSuccess"))}catch(n){z.error(n.message||s("oauth.saveFailed"))}}),b=h(c=>c?.trim()?!0:s("oauth.github.clientIdDescription")),I=h(c=>c?.trim()?!0:s("oauth.github.clientSecretDescription")),y=h(()=>!0),S=N(()=>t==="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",[t]);return e.jsx(i,{children:e.jsxs("form",{onSubmit:x(g),disabled:!0,children:[e.jsx(k,{title:e.jsxs(i,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx("span",{children:s("oauth.github.enable")}),e.jsx(ie,{title:s("oauth.viewDocument"),children:e.jsx(i,{component:"a",sx:{display:"inline-block",color:"inherit",fontSize:0,lineHeight:1},href:S,target:"_blank",rel:"noreferrer",children:e.jsx(M,{icon:ve,fontSize:20})})})]}),mb:2.5,sx:{"& .section-content":{alignItems:"center"}},children:e.jsx(v,{name:"enabled",control:a,sx:{alignItems:"center"},render:({field:c})=>e.jsx(O,{control:e.jsx(re,{sx:{ml:1},size:"small",checked:c.value,...c})})})}),e.jsx(k,{title:s("oauth.github.clientId"),children:e.jsx(v,{name:"clientId",control:a,rules:{validate:d?b:y},render:({field:c})=>e.jsx(R,{fullWidth:!0,children:e.jsx(F,{...c,size:"small",label:s("oauth.github.clientId"),error:!!p.errors[c.name],helperText:p.errors[c.name]?.message||" ",disabled:!d})})})}),e.jsx(k,{title:s("oauth.github.clientSecret"),children:e.jsx(v,{name:"clientSecret",control:a,rules:{validate:d?I:y},render:({field:c})=>e.jsx(R,{fullWidth:!0,children:e.jsx(F,{...c,size:"small",type:"password",label:s("oauth.github.clientSecret"),error:!!p.errors[c.name],helperText:p.errors[c.name]?.message||" ",disabled:!d})})})}),e.jsx(_,{type:"submit",variant:"contained",onSubmit:x(g),disabled:!p.isDirty,children:s("oauth.save")})]})})}const ue={enabled:!1,clientId:"",clientSecret:""};function mt(){const{api:f}=H(),{blocklet:u}=$(),{t:s,locale:t}=te(),o=u?.meta?.did,r=Object.assign({...ue},u?.settings?.oauth?.google||{}),{handleSubmit:x,control:a,formState:p,watch:l,reset:j}=se({defaultValues:Q(r,Object.keys(ue))}),d=l("enabled"),g=h(async c=>{try{const{blocklet:n}=await f.configOAuth({input:{did:o,oauth:JSON.stringify({google:c})}}),w=Object.assign({...ue},n?.settings?.oauth?.google||{});j(w),z.success(s("oauth.saveSuccess"))}catch(n){z.error(n.message||s("oauth.saveFailed"))}}),b=h(c=>c?.trim()?!0:s("oauth.google.clientIdDescription")),I=h(c=>c?.trim()?!0:s("oauth.google.clientSecretDescription")),y=h(()=>!0),S=N(()=>t==="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",[t]);return e.jsx(i,{children:e.jsxs("form",{onSubmit:x(g),disabled:!0,children:[e.jsx(k,{title:e.jsxs(i,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx("span",{children:s("oauth.google.enable")}),e.jsx(ie,{title:s("oauth.viewDocument"),children:e.jsx(i,{component:"a",sx:{display:"inline-block",color:"inherit",fontSize:0,lineHeight:1},href:S,target:"_blank",rel:"noreferrer",children:e.jsx(M,{icon:ve,fontSize:20})})})]}),mb:2.5,children:e.jsx(v,{name:"enabled",control:a,render:({field:c})=>e.jsx(O,{control:e.jsx(re,{sx:{ml:1},checked:c.value,...c})})})}),e.jsx(k,{title:s("oauth.google.clientId"),children:e.jsx(v,{name:"clientId",control:a,rules:{validate:d?b:y},render:({field:c})=>e.jsx(R,{fullWidth:!0,children:e.jsx(F,{...c,size:"small",label:s("oauth.google.clientId"),error:!!p.errors[c.name],helperText:p.errors[c.name]?.message||" ",disabled:!d})})})}),e.jsx(k,{title:s("oauth.google.clientSecret"),children:e.jsx(v,{name:"clientSecret",control:a,rules:{validate:d?I:y},render:({field:c})=>e.jsx(R,{fullWidth:!0,children:e.jsx(F,{...c,size:"small",type:"password",label:s("oauth.google.clientSecret"),error:!!p.errors[c.name],helperText:p.errors[c.name]?.message||" ",disabled:!d})})})}),e.jsx(_,{type:"submit",variant:"contained",onSubmit:x(g),disabled:!p.isDirty,children:s("oauth.save")})]})})}const he={enabled:!1,teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function pt(){const{api:f}=H(),{blocklet:u}=$(),{t:s}=te(),t=u?.meta?.did,o=Object.assign({...he},u?.settings?.oauth?.apple||{}),{handleSubmit:r,control:x,formState:a,watch:p,reset:l}=se({defaultValues:Q(o,Object.keys(he))}),j=p("enabled"),d=h(async n=>{try{const{blocklet:w}=await f.configOAuth({input:{did:t,oauth:JSON.stringify({apple:n})}}),L=Object.assign({...he},w?.settings?.oauth?.apple||{});l(L),z.success(s("oauth.saveSuccess"))}catch(w){z.error(w.message||s("oauth.saveFailed"))}}),g=h(n=>n?.trim()?!0:s("oauth.apple.teamIdDescription")),b=h(n=>n?.trim()?!0:s("oauth.apple.serviceIdDescription")),I=h(n=>n?.trim()?!0:s("oauth.apple.keyIdDescription")),y=h(n=>n?.trim()?!0:s("oauth.apple.authKeyDescription")),S=h(n=>n?.trim()?!0:s("oauth.apple.bundleIdDescription")),c=h(()=>!0);return e.jsx(i,{children:e.jsxs("form",{onSubmit:r(d),disabled:!0,children:[e.jsx(k,{title:s("oauth.apple.enable"),mb:2.5,children:e.jsx(v,{name:"enabled",control:x,render:({field:n})=>e.jsx(O,{control:e.jsx(re,{sx:{ml:1},checked:n.value,...n})})})}),e.jsx(k,{title:s("oauth.apple.teamId"),children:e.jsx(v,{name:"teamId",control:x,rules:{validate:j?g:c},render:({field:n})=>e.jsx(R,{fullWidth:!0,children:e.jsx(F,{...n,size:"small",label:s("oauth.apple.teamId"),error:!!a.errors[n.name],helperText:a.errors[n.name]?.message||" ",disabled:!j})})})}),e.jsx(k,{title:s("oauth.apple.bundleId"),children:e.jsx(v,{name:"bundleId",control:x,rules:{validate:j?S:c},render:({field:n})=>e.jsx(R,{fullWidth:!0,children:e.jsx(F,{...n,size:"small",label:s("oauth.apple.bundleId"),error:!!a.errors[n.name],helperText:a.errors[n.name]?.message||" ",disabled:!j})})})}),e.jsx(k,{title:s("oauth.apple.serviceId"),children:e.jsx(v,{name:"serviceId",control:x,rules:{validate:j?b:c},render:({field:n})=>e.jsx(R,{fullWidth:!0,children:e.jsx(F,{...n,size:"small",label:s("oauth.apple.serviceId"),error:!!a.errors[n.name],helperText:a.errors[n.name]?.message||" ",disabled:!j})})})}),e.jsx(k,{title:s("oauth.apple.keyId"),children:e.jsx(v,{name:"keyId",control:x,rules:{validate:j?I:c},render:({field:n})=>e.jsx(R,{fullWidth:!0,children:e.jsx(F,{...n,size:"small",label:s("oauth.apple.keyId"),error:!!a.errors[n.name],helperText:a.errors[n.name]?.message||" ",disabled:!j})})})}),e.jsx(k,{title:s("oauth.apple.authKey"),children:e.jsx(v,{name:"authKey",control:x,rules:{validate:j?y:c},render:({field:n})=>e.jsx(R,{fullWidth:!0,children:e.jsx(F,{...n,size:"small",type:"password",label:s("oauth.apple.authKey"),multiline:!0,rows:4,error:!!a.errors[n.name],helperText:a.errors[n.name]?.message||" ",disabled:!j})})})}),e.jsx(_,{type:"submit",variant:"contained",onSubmit:r(d),disabled:!a.isDirty,children:s("oauth.save")})]})})}const xt={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 Fe({title:f,id:u,children:s,index:t,onMove:o,defaultExpand:r=!1,onEnd:x}){const[a,p]=C.useState(r),l=C.useRef(null),j=C.useRef(null),[{handlerId:d},g]=Oe({accept:"dragItem",collect(c){return{handlerId:c.getHandlerId()}},hover(c,n){if(!l.current)return;const w=c.index,L=t;if(w===L)return;const m=l.current?.getBoundingClientRect(),B=j.current?.getBoundingClientRect(),V=(B.bottom-B.top)/2,oe=n.getClientOffset().y-m.top;w<L&&oe<V||w>L&&oe>V||(o(w,L),c.index=L)}}),[{isDragging:b},I]=Re({item:{index:t,type:"dragItem"},collect:c=>({isDragging:c.isDragging()}),end:x});I(j),g(l);const y=b?.5:1,S=h(c=>{c.preventDefault(),c.stopPropagation(),p(!a)});return e.jsxs(i,{ref:l,children:[e.jsxs(i,{sx:{cursor:"pointer","&:hover":{backgroundColor:"grey.100"}},ref:j,"data-handler-id":d,children:[e.jsxs(i,{sx:{py:2,px:1,opacity:y,display:"flex",alignItems:"center",gap:.5},draggable:!1,onClick:S,children:[e.jsx(i,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:"text.hint","&:hover":{color:"text.secondary"}},children:e.jsx(M,{fontSize:20,icon:xt})}),e.jsx(G,{sx:{flex:1},children:f}),e.jsx(ae,{size:"small",sx:{pointerEvents:"auto",transform:a?"":"rotate(180deg)",transition:"transform 0.3s ease"},children:e.jsx(M,{icon:it,style:{transform:"scale(1.5)"}})})]}),e.jsx(ee,{})]}),e.jsx(i,{sx:{pl:4,py:2.5,display:a?"block":"none"},children:s})]})}Fe.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};const ft=[{name:"github",title:"GitHub",icon:e.jsx(M,{icon:et}),component:e.jsx(ht,{})},{name:"google",title:"Google",icon:e.jsx(M,{icon:Je}),component:e.jsx(mt,{})},{name:"apple",title:"Apple",icon:e.jsx(M,{icon:Ze}),component:e.jsx(pt,{})},{name:"auth0",title:"Auth0",icon:e.jsx(M,{icon:Ge}),component:e.jsx(ut,{})}],gt=["github","google","apple","auth0"];function jt(){const{api:f}=H(),{blocklet:u}=$(),s=u?.meta?.did,t=u?.settings?.oauth||{},o=Object.keys(t).sort((d,g)=>t[d]?.order!==void 0&&t[g]?.order!==void 0?t[d].order-t[g].order:t[d]?.order!==void 0?-1:1);for(const d of gt)o.includes(d)||o.push(d);const r=ne(o.reduce((d,g,b)=>Object.assign(d,{[g]:b}),{})),x=N(()=>{const d=[...ft];return d.sort((g,b)=>r[g.name]-r[b.name]),d.map(g=>({...g,enabled:t[g.name]?.enabled??!1}))},[r.auth0,r.github,r.google]),a={};typeof window<"u"&&(a.context=window);const p=h(async d=>{const g={};Object.keys(d).forEach(b=>{g[b]={order:d[b]}}),await f.configOAuth({input:{did:s,oauth:JSON.stringify(g)}})}),l=h((d,g)=>{const b=x[d],I=x[g];r[b.name]=g,r[I.name]=d}),j=h(async()=>{await p(r)});return e.jsx(i,{sx:{".section-left":{width:"180px"}},children:e.jsx(ze,{backend:Ue,...a,children:x.map((d,g)=>e.jsx(Fe,{index:g,id:d.name,title:d.title,icon:d.icon,onMove:l,onEnd:j,defaultExpand:d.enabled,children:d.component},d.name))})})}const J={ttl:ge.SESSION_TTL,cacheTtl:ge.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(f){return e.jsx(rt,{...f,sx:{transform:"scale(0.75)"}})}function me(f,u=!1){const s=u?f.ttl*86400:f.ttl/86400;return{...f,ttl:s}}function bt(){const{api:f}=H(),{blocklet:u}=$(),s=u?.meta?.did,t=tt({},J,u?.settings?.session||{});le(t.ttl)&&(t.ttl=J.ttl),le(t.cacheTtl)&&(t.cacheTtl=J.cacheTtl),t.phone||(t.phone=J.phone),t.email||(t.email=J.email),le(t.enableBlacklist)&&(t.enableBlacklist=J.enableBlacklist);const{handleSubmit:o,control:r,formState:x,reset:a,watch:p}=se({defaultValues:Q(me(t),["ttl","cacheTtl","email","phone","enableBlacklist"])}),{t:l}=te(),j=p("email.enabled"),d=p("phone.enabled"),g=p("email.enableDomainBlackList"),b=p("email.enableDomainWhiteList"),{fields:I,append:y,remove:S}=qe({control:r,name:"email.domainBlackList"}),{fields:c,append:n,remove:w}=qe({control:r,name:"email.domainWhiteList"}),L=h(async m=>{try{const{blocklet:B}=await f.updateAppSessionConfig({input:{did:s,config:nt(me(m,!0),["phone"])}}),V=Object.assign({},J,Q(B?.settings?.session||{},["ttl","cacheTtl","email","phone","enableBlacklist"]));a(me(V)),z.success(l("common.configSuccess"))}catch(B){z.error(B.message)}});return e.jsx(vt,{onSubmit:o(L),children:e.jsxs(W,{direction:"column",sx:{gap:6},children:[e.jsxs(i,{children:[e.jsxs(i,{children:[e.jsx(G,{variant:"h6",sx:{fontWeight:600},children:l("blocklet.config.session.profile")}),e.jsx(i,{component:ee,sx:{my:3}})]}),e.jsxs(W,{sx:{gap:2},children:[e.jsx(k,{title:l("blocklet.config.session.fullNameEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(U,{disabled:!0,checked:!0})})}),e.jsx(k,{title:l("blocklet.config.session.avatarEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(U,{disabled:!0,checked:!0})})}),e.jsx(k,{title:l("blocklet.config.session.emailEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(v,{name:"email.enabled",control:r,render:({field:m})=>e.jsx(U,{...m,checked:m.value})})})}),j&&e.jsxs(W,{direction:"column",sx:{ml:2},children:[e.jsx(k,{title:l("blocklet.config.session.emailRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(v,{name:"email.requireVerified",control:r,render:({field:m})=>e.jsx(O,{sx:{mt:1},control:e.jsx(U,{...m,checked:m.value})})})})}),e.jsx(k,{title:l("blocklet.config.session.emailRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(v,{name:"email.requireUnique",control:r,render:({field:m})=>e.jsx(O,{sx:{mt:1},control:e.jsx(U,{...m,checked:m.value})})})})}),e.jsx(k,{title:l("blocklet.config.session.emailTrustOauthProviders"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(v,{name:"email.trustOauthProviders",control:r,render:({field:m})=>e.jsx(O,{sx:{mt:1},control:e.jsx(U,{...m,checked:m.value})})})})}),e.jsx(k,{title:l("blocklet.config.session.enableDomainBlackList"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(v,{name:"email.enableDomainBlackList",control:r,render:({field:m})=>e.jsx(O,{sx:{mt:1},control:e.jsx(U,{...m,checked:m.value})})})})}),g&&e.jsxs(i,{children:[I.map((m,B)=>e.jsxs(W,{direction:"row",sx:{alignItems:"center",my:1,maxWidth:"720px"},children:[e.jsx(v,{name:`email.domainBlackList.${B}`,control:r,render:V=>e.jsx(F,{...V.field,size:"small",fullWidth:!0})}),e.jsx(ae,{onClick:()=>S(B),children:e.jsx(we,{})})]},m.id)),e.jsx(_,{startIcon:e.jsx(Te,{}),onClick:()=>y(""),children:l("blocklet.config.session.addDomain")})]}),e.jsx(k,{title:l("blocklet.config.session.enableDomainWhiteList"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(v,{name:"email.enableDomainWhiteList",control:r,render:({field:m})=>e.jsx(O,{sx:{mt:1},control:e.jsx(U,{...m,checked:m.value})})})})}),b&&e.jsxs(i,{children:[c.map((m,B)=>e.jsxs(W,{direction:"row",sx:{alignItems:"center",my:1,maxWidth:"720px"},children:[e.jsx(v,{name:`email.domainWhiteList.${B}`,control:r,render:V=>e.jsx(F,{...V.field,size:"small",fullWidth:!0})}),e.jsx(ae,{onClick:()=>w(B),children:e.jsx(we,{})})]},m.id)),e.jsx(_,{startIcon:e.jsx(Te,{}),onClick:()=>n(""),children:l("blocklet.config.session.addDomain")})]})]}),e.jsxs(i,{sx:{display:"none"},children:[e.jsx(k,{title:l("blocklet.config.session.phoneEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(v,{name:"phone.enabled",control:r,disabled:!0,render:({field:m})=>e.jsx(O,{sx:{mt:1},control:e.jsx(U,{...m,checked:m.value})})})})}),d&&e.jsxs(W,{direction:"column",sx:{ml:2,mt:1},children:[e.jsx(k,{title:l("blocklet.config.session.phoneRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(v,{name:"phone.requireVerified",control:r,render:({field:m})=>e.jsx(O,{control:e.jsx(U,{...m,checked:m.value})})})})}),e.jsx(k,{title:l("blocklet.config.session.phoneRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(v,{name:"phone.requireUnique",control:r,render:({field:m})=>e.jsx(O,{control:e.jsx(U,{...m,checked:m.value})})})})})]})]})]})]}),e.jsxs(i,{children:[e.jsx(G,{variant:"h6",sx:{fontWeight:600},children:l("blocklet.config.session.period")}),e.jsx(i,{component:ee,sx:{my:3}}),e.jsx(W,{direction:"column",spacing:2,children:e.jsx(v,{name:"ttl",control:r,rules:{min:1,max:30},render:({field:m})=>e.jsx(R,{fullWidth:!0,sx:{mb:2},children:e.jsx(k,{title:l("blocklet.config.session.ttl",{day:m.value}),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{width:"100%",maxWidth:500,px:1.5},children:e.jsx($e,{...m,defaultValue:7,step:1,marks:[{value:1,label:l("blocklet.config.session.day",{day:1})},{value:7,label:l("blocklet.config.session.days",{day:7})},{value:14,label:l("blocklet.config.session.days",{day:14})},{value:21,label:l("blocklet.config.session.days",{day:21})},{value:30,label:l("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto"})})})})})})]}),e.jsxs(i,{children:[e.jsx(G,{variant:"h6",sx:{fontWeight:600},children:l("blocklet.config.session.experimentalSettings")}),e.jsx(i,{component:ee,sx:{my:3}}),e.jsx(W,{direction:"column",spacing:2,children:e.jsx(k,{title:l("blocklet.config.session.enableBlacklist"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(v,{name:"enableBlacklist",control:r,render:({field:m})=>e.jsx(O,{sx:{mt:1},control:e.jsx(U,{...m,checked:m.value})})})})})})]}),e.jsx(i,{children:e.jsx(_,{type:"submit",variant:"contained",disabled:!x.isDirty,children:l("oauth.save")})})]})})}const vt=Le.form`
|
|
2
|
-
max-width: 1536px;
|
|
3
|
-
|
|
4
|
-
.advanced-config {
|
|
5
|
-
border: 0;
|
|
6
|
-
padding: 0;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.config-form {
|
|
10
|
-
flex-grow: 1;
|
|
11
|
-
overflow-y: auto;
|
|
12
|
-
will-change: transform;
|
|
13
|
-
|
|
14
|
-
&:first-child {
|
|
15
|
-
margin: 0;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
${f=>f.theme.breakpoints.down("md")} {
|
|
19
|
-
width: 100%;
|
|
20
|
-
flex-shrink: 0;
|
|
21
|
-
padding: 0 24px;
|
|
22
|
-
transform: translate(0, 0);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.config-item {
|
|
27
|
-
display: flex;
|
|
28
|
-
align-items: center;
|
|
29
|
-
justify-content: space-between;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.config-desc {
|
|
33
|
-
font-weight: normal;
|
|
34
|
-
font-size: 12px;
|
|
35
|
-
color: #666;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.form-item {
|
|
39
|
-
margin-top: 0;
|
|
40
|
-
}
|
|
41
|
-
`,kt={width:24,height:24,body:'<path fill="currentColor" d="M6 12.05q0 1.125.425 2.188T7.75 16.2l.25.25V15q0-.425.288-.713T9 14q.425 0 .713.288T10 15v4q0 .425-.288.713T9 20H5q-.425 0-.713-.288T4 19q0-.425.288-.713T5 18h1.75l-.4-.35q-1.3-1.15-1.825-2.625T4 12.05Q4 9.7 5.2 7.787T8.425 4.85q.35-.2.738-.025t.512.575q.125.375-.013.75t-.487.575q-1.45.8-2.313 2.213T6 12.05Zm12-.1q0-1.125-.425-2.187T16.25 7.8L16 7.55V9q0 .425-.288.713T15 10q-.425 0-.713-.288T14 9V5q0-.425.288-.713T15 4h4q.425 0 .713.288T20 5q0 .425-.288.713T19 6h-1.75l.4.35q1.225 1.225 1.788 2.663T20 11.95q0 2.35-1.2 4.263t-3.225 2.937q-.35.2-.737.025t-.513-.575q-.125-.375.013-.75t.487-.575q1.45-.8 2.313-2.212T18 11.95Z"/>'};var pe,Ie;function yt(){if(Ie)return pe;Ie=1;const{DEFAULT_IP_DOMAIN_SUFFIX:f,SLOT_FOR_IP_DNS_SITE:u,DEFAULT_DID_DOMAIN:s}=Ke(),{encode:t}=ct();return pe={getIpDnsDomainForBlocklet:x=>`${t(x.meta.did)}-${u}.${f}`,getDidDomainForBlocklet:({did:x,didDomain:a=s})=>`${t(x)}.${a}`},pe}var St=yt();function Be({ref:f=null}){const{t:u}=C.useContext(Z),{blocklet:s}=$(),{api:t}=H(),o=ne({loadingReject:!1,loadingApprove:!1,mode:"view",show:!1,data:{},callback:K}),x=be()?.transitions?.duration?.leavingScreen||300,a=h(()=>{o.mode="view",o.data={},o.callback=K}),p=h(()=>{o.show=!1,setTimeout(()=>{a()},x)}),l=h(y=>{o.mode="view",o.show=!0,o.data=y}),j=h((y,S=K)=>{o.mode="approve",o.show=!0,o.data=y,o.callback=S});C.useImperativeHandle(f,()=>({open:l,close:p,approve:j}),[l,p,j]);const d=N(()=>{if(!o.show)return[];o.data.migratedFrom=[o.data.appId,o.data.appPid];const y=["appName","appLogo","appId","appPid","migratedFrom","appDescription","appUrl","version","appliedAt","status","serverId","serverVersion"];return o.data.isMaster!==!1&&st(y,"appliedAt","status"),y.map(S=>{const c=u(`federated.info.${S}`);let n=o.data[S];if(S==="appName"&&o.data.isMaster&&(n=e.jsxs(i,{children:[e.jsx(Ce,{component:De}),n]})),["appId","appPid","serverId"].includes(S)&&(n=e.jsx(xe,{children:n})),["appUrl"].includes(S)&&(n=e.jsx(i,{component:"a",href:n,target:"_blank",children:n})),["appLogo"].includes(S)){const w=ot(`https://${St.getDidDomainForBlocklet({did:o.data.appPid})}`,ge.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo");try{const L=new URL(w);L.searchParams.set("imageFilter","resize"),L.searchParams.set("w","80"),L.searchParams.set("h","80"),n=e.jsx("img",{src:L.href,width:"60",height:"60",alt:o.data.appName})}catch{n=e.jsx("img",{src:w,width:"60",height:"60",alt:o.data.appName})}}return S==="status"&&(n=n&&u(`federated.status.${n}`)),S==="migratedFrom"&&(n=(o.data.migratedFrom||[]).filter(m=>![o.data.appId,o.data.appPid].includes(m)).map(m=>e.jsx(xe,{children:m}))),at(n)&&(n="-"),{name:c,value:n}})},[o.data]),g=o.mode==="approve",b=h(async()=>{try{o.loadingReject=!0,await t.auditFederatedLogin({input:{memberPid:o.data.appPid,did:s.appPid,status:"rejected"}}),p(),o?.callback(!1)}finally{o.loadingReject=!1}}),I=h(async()=>{try{o.loadingApprove=!0,await t.auditFederatedLogin({input:{memberPid:o.data.appPid,did:s.appPid,status:"approved"}}),p(),o?.callback(!0)}finally{o.loadingApprove=!1}});return e.jsx(je,{open:o.show,title:u(g?"federated.approveToJoinLogin":"federated.siteDetail"),onClose:p,actions:g?e.jsxs(e.Fragment,{children:[e.jsxs(_,{color:"error",variant:"contained",onClick:b,disabled:o.loadingReject,children:[o.loadingReject?e.jsx(fe,{size:16,color:"grey"}):null,u("common.reject")]}),e.jsxs(_,{variant:"contained",onClick:I,disabled:o.loadingApprove,children:[o.loadingApprove?e.jsx(fe,{size:16,color:"grey"}):null,u("common.approve")]})]}):e.jsx(_,{variant:"outlined",onClick:p,children:u("common.close")}),children:d.map(y=>e.jsx(lt,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:180,name:y.name,children:y.value},y.name))})}Be.propTypes={ref:E.any};function ke({ref:f=null}){const s=be()?.transitions?.duration?.leavingScreen||300,{t}=C.useContext(Z),o=ne({show:!1,data:{link:""}}),r=h(()=>{o.data.link=""}),x=h(()=>{o.show=!1,setTimeout(()=>{r()},s)}),a=h(({link:l})=>{o.show=!0,o.data.link=l});C.useImperativeHandle(f,()=>({open:a,close:x}),[a,x]);const p=h(()=>{_e(o.data.link),x()});return e.jsxs(je,{open:o.show,title:t("federated.joinFederatedLogin"),onClose:x,PaperProps:{style:{minHeight:"unset"}},actions:e.jsx(P,{color:"primary",autoFocus:!0,variant:"contained",onClick:p,children:t("common.copyAndClose")}),children:[e.jsx(i,{sx:{mb:1},children:t("federated.inviteJoinFederatedLoginDescription")}),e.jsx(i,{sx:{"& .copy-button":{display:"none !important"}},children:e.jsx(Ee,{language:"shell",style:{marginBottom:0},children:o.data.link})})]})}ke.propTypes={ref:E.any};function Ae({mode:f="member"}){const u=C.useRef(null),s=C.useRef(null),{t,locale:o}=C.useContext(Z),{blocklet:r,actions:{refreshBlocklet:x}}=$(),{confirmApi:a,confirmHolder:p}=Qe(),{api:l}=H(),j=r.settings.federated?.sites||[],d=r.settings.federated?.config||{},g=d.isMaster!==!1,b=j.find(T=>T.appPid===r.appPid),I=ne({loadingSync:!1}),y=h(T=>{s.current?.open(T)}),S=h(T=>{s.current?.approve(T,x)}),c=h(T=>{a.open({title:t("federated.removeFederatedLogin"),content:t("federated.removeFederatedLoginDescription"),confirmButtonText:t("common.confirm"),cancelButtonText:t("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(D){await l.quitFederatedLogin({input:{did:r.appPid,targetDid:T.appPid}}),D()}})}),n=h(T=>{a.open({title:t("federated.disableFederatedLogin"),content:t("federated.disableFederatedLoginDescription"),confirmButtonText:t("common.confirm"),cancelButtonText:t("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(D){await l.auditFederatedLogin({input:{memberPid:T.appPid,did:r.appPid,status:"revoked"}}),D()}})}),w=h(T=>{a.open({title:t("federated.enableFederatedLogin"),content:t("federated.enableFederatedLoginDescription"),confirmButtonText:t("common.confirm"),cancelButtonText:t("common.cancel"),async onConfirm(D){await l.auditFederatedLogin({input:{memberPid:T.appPid,did:r.appPid,status:"approved"}}),D()}})}),L=N(()=>{const T=[{label:t("common.name"),name:"appName",options:{customBodyRenderLite:D=>{const q=j[D],Y=q.isMaster!==!1;return e.jsx(i,{sx:{display:"inline-block"},children:e.jsxs(i,{component:"a",href:q.appUrl,target:"_blank",onClick:A=>{A.stopPropagation()},sx:{display:"flex",alignItems:"center"},children:[Y&&e.jsx(Ce,{component:De,style:{marginRight:"4px"}}),q.appName]})})}}},{label:t("common.did"),name:"appId",options:{customBodyRenderLite:D=>{const q=j[D];return e.jsx(xe,{children:q.appId})}}},{label:t("common.status"),name:"status",options:{customBodyRenderLite:D=>{const q=j[D],Y=q.isMaster!==!1;return e.jsx(i,{children:Y?"-":t(`federated.status.${q.status}`)})}}}];return g&&T.push({label:t("common.actions"),name:"actions",options:{customBodyRenderLite:D=>{const q=j[D],Y=q.isMaster!==!1;return e.jsx(i,{sx:{display:"flex",gap:1},children:Y?e.jsxs(e.Fragment,{children:[q.status==="rejected"&&e.jsx(P,{variant:"contained",color:"error",size:"small",onClick:A=>{A.stopPropagation()},children:t("federated.status.rejected")}),q.status==="revoked"&&e.jsx(P,{variant:"contained",color:"secondary",size:"small",onClick:A=>{A.stopPropagation()},children:t("federated.status.revoked")})]}):e.jsxs(e.Fragment,{children:[e.jsx(P,{variant:"contained",color:"error",size:"small",onClick:A=>{A.stopPropagation(),c(q)},children:t("federated.quitMember")},"quiteSite"),q.status==="pending"&&e.jsx(P,{variant:"contained",color:"primary",size:"small",onClick:A=>{A.stopPropagation(),S(q)},children:t("federated.status.pending")},"auditSite"),q.status==="approved"&&e.jsx(P,{variant:"contained",color:"error",size:"small",onClick:A=>{A.stopPropagation(),n(q)},style:{whiteSpace:"nowrap"},children:t("federated.revoke")},"revokeSite"),q.status==="revoked"&&e.jsx(P,{variant:"contained",color:"warning",size:"small",onClick:A=>{A.stopPropagation(),w(q)},style:{whiteSpace:"nowrap"},children:t("federated.approve")},"approveSite")]})})}}}),T},[d.appId,j,g,t]),m=N(()=>({sort:!0,download:!1,filter:!1,print:!1,expandableRowsOnClick:!0,onRowClick(T,{dataIndex:D}){const q=j[D];y(q)}}),[]),B=h(()=>{const T=r.environments.find(D=>D.key===Xe.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL);T?.value?u.current?.open({link:T.value}):z.error(t("federated.failedToGetFederatedLoginLink"))},[r.site?.domainAliases?.[0]?.href]),V=h(()=>{a.open({title:t("federated.quitFederatedLogin"),content:t("federated.quitFederatedLoginDescription"),confirmButtonText:t("common.confirm"),cancelButtonText:t("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(T){await l.quitFederatedLogin({input:{did:r.appPid}}),T()}})}),ye=h(()=>{a.open({title:t("federated.disbandFederatedLogin"),content:t("federated.disbandFederatedLoginDescription"),confirmButtonText:t("common.confirm"),cancelButtonText:t("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(T){await l.disbandFederatedLogin({input:{did:r.appPid}}),T()}})}),oe=h(async()=>{try{I.loadingSync=!0,await Promise.all([await l.syncFederatedConfig({input:{did:r.appPid}}),We(500)]),z.success(t("common.succeeded"))}finally{I.loadingSync=!1}}),X=[];return b.status!=="pending"&&X.push(e.jsx(ie,{title:t("federated.syncConfig"),children:e.jsx(ae,{size:"small",onClick:oe,disabled:I.loadingSync,sx:[{"@keyframes spin":{from:{transform:"rotate(0deg)"},to:{transform:"rotate(360deg)"}}},I.loadingSync?{animation:"spin 1s linear infinite"}:{}],children:e.jsx(M,{icon:kt,style:{fontSize:24}})},"syncConfig")})),f==="master"?(X.push(e.jsx(P,{size:"small",variant:"contained",onClick:B,sx:{ml:1},children:t("federated.inviteJoinFederatedLogin")},"inviteJoinFederatedLogin")),X.push(e.jsx(P,{color:"error",size:"small",variant:"contained",onClick:ye,sx:{ml:1},children:t("federated.disbandFederatedLogin")},"disbandFederatedLogin"))):X.push(e.jsx(P,{size:"small",variant:"contained",color:"error",onClick:V,sx:{ml:1},children:t("federated.quitFederatedLogin")},"quitFederatedLogin")),e.jsxs(e.Fragment,{children:[e.jsx(Ve,{className:"main-table",locale:o,data:j,columns:L,customButtons:X,title:e.jsx(i,{className:"table-toolbar-left",children:t("oauth.federated")}),options:m}),p,e.jsx(ke,{ref:u}),e.jsx(Be,{ref:s})]})}Ae.propTypes={mode:E.oneOf(["member","master"])};function Pe({ref:f=null}){const{t:u}=C.useContext(Z),{api:s}=H(),{blocklet:t}=$(),o=t?.appPid,x=be()?.transitions?.duration?.leavingScreen||300,a=ne({loading:!1,show:!1,appUrl:"",appUrlError:"",callback:K}),p=h(()=>{a.appUrl="",a.appUrlError="",a.callback=K}),l=h(()=>{a.show=!1,setTimeout(()=>{p()},x)}),j=h((b=K)=>{a.show=!0,a.callback=b});C.useImperativeHandle(f,()=>({open:j,close:l}),[j,l]);const d=h(b=>{if(!b)throw new Error(u("federated.federatedJoinAppUrlRequired"));if(!Ye(b))throw new Error(u("federated.federatedJoinAppUrlInvalid"))}),g=h(async()=>{try{d(a.appUrl),a.loading=!0;const b=await s.joinFederatedLogin({input:{did:o,appUrl:a.appUrl}});a.show=!1,l(),a?.callback(b)}catch(b){a.appUrlError=b.message}finally{a.loading=!1}});return e.jsxs(je,{open:a.show,title:u("federated.joinFederatedLogin"),onClose:l,PaperProps:{style:{minHeight:"unset"}},actions:e.jsxs(P,{color:"primary",autoFocus:!0,variant:"contained",onClick:g,disabled:a.loading,children:[a.loading?e.jsx(fe,{size:16,sx:{mr:1},color:"grey"}):null,u("common.confirm")]}),children:[e.jsx(i,{sx:{mb:1},children:u("federated.joinFederatedLoginDescription")}),e.jsx(F,{fullWidth:!0,variant:"outlined",margin:"dense",placeholder:u("federated.federatedJoinAppUrl"),label:u("federated.federatedJoinAppUrl"),value:a.appUrl,error:!!a.appUrlError,helperText:a.appUrlError||"eg: https://www.arcblock.io",onChange:b=>{a.appUrl=b.target.value}})]})}Pe.propTypes={ref:E.any};function wt(){const{t:f}=C.useContext(Z);return e.jsxs(W,{direction:"row",spacing:2,sx:{alignItems:"flex-start",p:2},children:[e.jsx(He,{fontSize:"large",color:"primary"}),e.jsxs(i,{children:[e.jsx(G,{variant:"h6",gutterBottom:!0,children:f("federated.title")}),e.jsx(G,{variant:"body2",sx:{color:"text.secondary"},children:f("federated.description")}),e.jsx(Ne,{href:"https://www.arcblock.io/blog/zh/did-connect-federated-login-support",underline:"hover",variant:"body2",color:"primary",target:"_blank",sx:{display:"inline-flex",alignItems:"center",mt:1},children:f("federated.link")})]})]})}function Tt(){const f=C.useRef(null),u=C.useRef(null),{t:s}=C.useContext(Z),{blocklet:t,actions:{refreshBlocklet:o}}=$(),r=h(()=>{const a=t.site?.domainAliases?.[0]?.href;if(a)try{const p=new URL(a);f.current?.open({link:p.origin})}catch{z.error(s("federated.failedToGetFederatedLoginLink"))}},[t.site?.domainAliases?.[0]?.href]),x=h(()=>{u.current?.open(()=>{o()})});if(t.settings.federated?.sites.length>0){const a=t.settings.federated?.config.isMaster!==!1;return e.jsx(Ae,{mode:a?"master":"member"})}return e.jsxs(e.Fragment,{children:[e.jsx(i,{sx:{display:"flex",flexDirection:"column",gap:2,justifyContent:"center",alignItems:"center",minHeight:"200px"},children:e.jsxs(i,{sx:{maxWidth:400,borderRadius:2,border:"1px solid",borderColor:"divider"},children:[e.jsx(wt,{}),e.jsx(ee,{sx:{width:1}}),e.jsxs(W,{sx:{width:1,p:2,gap:1.5},children:[e.jsx(P,{variant:"contained",onClick:r,sx:{width:1},children:s("federated.inviteJoinFederatedLogin")}),e.jsx(P,{variant:"outlined",onClick:x,sx:{width:1},children:s("federated.joinFederatedLogin")})]})]})}),e.jsx(ke,{ref:f}),e.jsx(Pe,{ref:u})]})}function qt({orientation:f="horizontal"}){const{t:u}=C.useContext(Z),s=dt({key:"lg"}),t=[{label:e.jsx(i,{sx:{textAlign:"center",width:"100%"},children:u("oauth.commonSettings")}),value:"settings"},{label:e.jsx(i,{sx:{textAlign:"center",width:"100%"},children:u("oauth.federated")}),value:"federated"},{label:e.jsx(i,{sx:{textAlign:"center",width:"100%"},children:u("oauth.oauth")}),value:"oauth"},{label:e.jsx(i,{sx:{textAlign:"center",width:"100%"},children:u("oauth.moreLogin")}),value:"more"}],[o,r]=C.useState(t[0].value),x=N(()=>({oauth:e.jsx(jt,{}),federated:e.jsx(Tt,{}),more:e.jsx(Me,{children:u("oauth.comingSoon")}),settings:e.jsx(bt,{})}),[u]);return f==="vertical"?e.jsx(It,{children:e.jsxs(W,{direction:{md:"column",lg:"row"},sx:{gap:2},children:[e.jsx(i,{sx:{minWidth:"240px",flexShrink:0},children:e.jsx(Se,{tabs:t,current:o,orientation:s?"horizontal":"vertical",onChange:r,sx:{borderRight:s?0:1,height:"100%",borderColor:"divider"}})}),e.jsx(i,{sx:{flexGrow:1,minWidth:0},children:e.jsx(i,{sx:{maxWidth:"1200px"},children:x[o]})})]})}):e.jsxs(i,{children:[e.jsx(Se,{tabs:t,current:o,onChange:r}),e.jsx(i,{sx:{marginTop:"10px"},children:x[o]})]})}qt.propTypes={orientation:E.oneOf(["horizontal","vertical"])};const It=Le.div`
|
|
42
|
-
.MuiTab-root {
|
|
43
|
-
text-align: left;
|
|
44
|
-
align-items: flex-start;
|
|
45
|
-
font-weight: normal;
|
|
46
|
-
|
|
47
|
-
div {
|
|
48
|
-
text-align: left;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.Mui-selected {
|
|
53
|
-
font-weight: bold;
|
|
54
|
-
}
|
|
55
|
-
`;export{qt as default};
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import{j as e,y as St,bb as Se,M as ae,ak as x,Q as G,W as u,J as xe,c0 as kt,I as O,aN as Pt,T as A,aj as Rt,b5 as ze,P as Le,b6 as Z,a5 as Be,z as Ye,A as Qe,cm as It,bf as Tt,U as we,dk as At,dl as Mt,at as ee,dm as Et,a6 as V,n as le,D as zt,dn as Lt,ar as We,b1 as ke,dp as Bt,as as Wt,aX as $t,am as J,bp as Dt,bq as ye,a$ as Nt,d7 as Ot}from"./vendor-mui-core-CcrDM-5l.js";import{r as b,a as Ft,u as Ut,j as _t}from"./vendor-react-Dvs43sk9.js";import{a as qt,D as Ht,bC as Gt,c as Pe,d as Kt,T as Yt,bD as Qt,aN as Re,Q as fe,b8 as Vt,b9 as Zt,bE as Jt,_ as Xt,aP as er,$ as tr,bF as rr,H as nr}from"./index-ChbQ5IZK.js";import{t as Ve,Z as or,a8 as sr,R as $e,D as ir,C as ce,n as Q,A as ar}from"./vendor-utils-BOkrEpKO.js";import{b as Ie,I as N,T as D,aw as lr,G as Ze,ax as cr,H as _,ay as dr,az as ur,aA as De,e as pr,n as Je,c as Te,aB as xr,aC as fr,aD as I,x as hr,v as gr,$ as Xe,aE as mr,aF as br,u as yr,o as de,B as Ne,J as vr}from"./vendor-ux-Aiuoyn1t.js";import{a as M,h as et,k as te,g as K,b as z,j as jr}from"./vendor-hooks-DTeIFVkk.js";import{l as tt}from"./arrow-down.svg-B7DowRKZ.js";import{N as wr}from"./list-DfgVl1Dg.js";import{d as Cr}from"./search-4YYphs0l.js";import{B as Oe}from"./bundle-avatar-CQ9SkEeN.js";import{j as Fe,T as Sr}from"./team-CuDtwJsC.js";import{b as kr,d as Pr,a as Rr,c as Ir,e as Tr,f as Ar,g as Mr,h as Er,W as zr}from"./user-center-B5kWm-Hv.js";import{N as rt,U as nt}from"./index-BCf6_SpY.js";import{u as re}from"./use-mobile-BC9t6zmM.js";import Lr from"./index-BwByZQ3p.js";import{f as X}from"./index-DBs9Ljax.js";import{u as ot}from"./index-J8izjET5.js";import{d as Br}from"./github-icon-CH2zo-td.js";import{U as ve}from"./user-sessions-Dh05ZZ1r.js";import Wr from"./index-DeVFfavE.js";import{o as $r}from"./vendor-arcblock-BAR_xVfk.js";import{c as Dr,b as ue,a as Nr,S as Or}from"./index-COXPzb2c.js";import"./index-BbjQCNW8.js";import"./index-BojVbZw0.js";import"./lottie-web-4koyQiv_.js";import"./server-logo-notext.svg-CKQB0tIp.js";import"./index-BX0ipkE3.js";import"./util-BSXtIaUE.js";import"./base32-C4LxA2tB.js";import"./session-BM5XfKcI.js";import"./isURL-C3AhK8hJ.js";import"./index-g0GOIUzU.js";import"./api-Rnh95Dt4.js";import"./table-tips-BxCWkqEh.js";import"./use-mobile-B9FM-UBY.js";import"./passport-item-DumQ8HpS.js";import"./did-address-DluwIRGz.js";import"./index-DHMsDwjO.js";import"./vendor-mui-x-BVRWKjdg.js";import"./AdapterDayjs-DqHaPgQe.js";import"./confirm-r3sqe3V_.js";import"./click-to-copy-lzAgjcxY.js";import"./delete-confirm-CXK3h2Jb.js";import"./permission-CfpkIHAA.js";import"./actions-DvIZNF27.js";import"./index-DRYJ0xIl.js";function Fr(){let t=new Map;function s({root:n,rootMargin:o,threshold:i}){let a=t.get(n);a||(a=new Map,t.set(n,a));let l=JSON.stringify({rootMargin:o,threshold:i}),p=a.get(l);if(!p){let r=new Map;p={observer:new IntersectionObserver(f=>{f.forEach(m=>{r.get(m.target)?.(m)})},{root:n,rootMargin:o,threshold:i}),entryCallbacks:r},a.set(l,p)}return{observe:(r,f)=>{p.entryCallbacks.set(r,f),p.observer.observe(r)},unobserve:r=>{p.entryCallbacks.delete(r),p.observer.unobserve(r)}}}return{getObserver:s}}var Ur="0px",_r=[0],qr=Fr();function Hr(t){let s=t?.rootMargin??Ur,n=t?.threshold??_r,o=b.useRef(null),i=b.useRef(null),a=b.useRef(null),[l,p]=b.useState(),r=b.useCallback(()=>{let w=o.current;if(!w){p(void 0);return}let y=qr.getObserver({root:i.current,rootMargin:s,threshold:n});y.observe(w,c=>{p(c)}),a.current=y},[s,n]),f=b.useCallback(()=>{let w=a.current,y=o.current;y&&w?.unobserve(y),a.current=null},[]),m=b.useCallback(w=>{f(),o.current=w,r()},[r,f]),h=b.useCallback(w=>{f(),i.current=w,r()},[r,f]);return[m,{entry:l,rootRef:h}]}var Gr=Hr;function Kr(t){let[s,n]=Gr(t),o=!!n.entry?.isIntersecting,[i,a]=b.useState(o);return o&&!i&&a(!0),[s,{...n,isVisible:o,wasEverVisible:i}]}var Yr=Kr,Qr=100;function Vr({loading:t,hasNextPage:s,onLoadMore:n,rootMargin:o,disabled:i,delayInMs:a=Qr}){let l=b.useRef(n),[p,{rootRef:r,isVisible:f}]=Yr({rootMargin:o});b.useEffect(()=>{l.current=n},[n]);let m=!i&&!t&&f&&s;return b.useEffect(()=>{if(m){let h=setTimeout(()=>{l.current()},a);return()=>{clearTimeout(h)}}},[m,a]),[p,{rootRef:r}]}var Zr=Vr;const je={info:"#3B82F6",success:"#10B981",warning:"#F59E0B",error:"#EF4444"};pe.propTypes={severity:u.oneOf(["info","success","warning","error",""]).isRequired,size:u.number};function pe({severity:t,size:s=8}){return je[t]?e.jsx(x,{component:"span",sx:{display:"inline-block",width:s,height:s,borderRadius:"50%",backgroundColor:je[t]||je.info}}):null}st.propTypes={theme:u.string,type:u.oneOf(["button","line","select"]),onSelectType:u.func,extra:u.node,loading:u.bool,currentTab:u.oneOf(["info","success","warning","error",""])};function st({theme:t="dark",type:s="button",onSelectType:n,extra:o=void 0,currentTab:i="",loading:a=!1,...l}){const{t:p}=b.useContext(Ie),r=[{label:p("notification.allSeverity"),value:""},{label:p("notification.severityType.info"),value:"info"},{label:p("notification.severityType.success"),value:"success"},{label:p("notification.severityType.warning"),value:"warning"},{label:p("notification.severityType.error"),value:"error"}],f=g=>{(g!==i||!a)&&n(g)},m=b.useMemo(()=>{const g={width:"100%",bgcolor:t==="dark"?"#F9FAFB":"",overflowY:"auto",paddingTop:s==="select"?"0":"5px",whiteSpace:"nowrap",borderRadius:0,display:"flex",justifyContent:"space-between",alignItems:"flex-end",flexWrap:"wrap",gap:"8px"};return s==="line"?Object.assign(g,{}):g},[s,t]),h=(g,k,T)=>e.jsx(G,{disabled:a,onClick:()=>f(g.value),className:`profile-button ${k?"active":""}`,...l,children:g.label},g.value||T),w=(g,k,T)=>e.jsx(G,{variant:"text",disabled:a,onClick:()=>f(g.value),className:`profile-line-button ${k?"active":""}`,...l,children:g.label},g.value||T),y=()=>r?.map((g,k)=>{const T=i===g?.value;return s==="line"?e.jsx(b.Fragment,{children:w(g,T,k)},g.value||k):e.jsx(b.Fragment,{children:h(g,T,k)},g.value||k)}),c=g=>{const{value:k}=g.target;f(k==="all"?"":k)};return s==="select"?e.jsx(St,{sx:{maxWidth:300},children:e.jsx(Se,{value:i||"all",onChange:c,size:"small",label:"Severity",IconComponent:g=>e.jsx(tt,{...g,width:20,height:20}),MenuProps:{autoFocus:!1,PaperProps:{style:{maxHeight:400,overflowY:"auto",borderRadius:"8px",boxShadow:"0px 6px 24px rgba(0, 0, 0, 0.15)"}}},variant:"outlined",sx:{fieldset:{border:"none"}},children:r.map((g,k)=>e.jsx(ae,{value:g.value||"all",children:e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(pe,{severity:g.value}),g.label]})},g.value||k))})}):e.jsxs(x,{className:"severity-tabs",sx:m,children:[e.jsx(x,{sx:{...s==="line"?{flex:1,borderBottom:"1px solid",borderColor:"grey.200"}:{display:"flex",gap:"24px"}},children:y()}),o]})}it.propTypes={paging:u.objectOf(u.any).isRequired,loading:u.bool.isRequired,onChange:u.func.isRequired};function it({loading:t,paging:s,onChange:n}){const{t:o}=b.useContext(Ie),i=xe(r=>r.breakpoints.down("md"));if(s.pageCount<=0||i)return null;const a=(r,f)=>{n({page:f+1})},l=r=>{const f=Number(r.target.value);n({page:1,pageSize:f})},p=s.page-1<=0?0:s.page-1;return e.jsx(x,{className:"notification-pagination",sx:{mt:2,display:"flex",justifyContent:"flex-end"},children:e.jsx(kt,{component:"div",disabled:t,count:s.total,page:p,rowsPerPageOptions:[10,20,50,100],labelRowsPerPage:o("pagination.rowsPerPage"),labelDisplayedRows:({from:r,to:f,count:m})=>`${r}–${f} / ${m!==-1?m:`${o()}more than ${f}`}`,rowsPerPage:s.pageSize,onPageChange:a,onRowsPerPageChange:l})})}const Jr=b.memo(it),Xr={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4h16v2.172a2 2 0 0 1-.586 1.414L15 12v7l-6 2v-8.5L4.52 7.572A2 2 0 0 1 4 6.227V4z"/>'},Ue=6,_e={"& .MuiCheckbox-root":{padding:"4px"},"& .MuiCheckbox-root .MuiSvgIcon-root":{fontSize:"1.35rem"},"& .MuiCheckbox-root:not(.Mui-checked)":{color:"divider"},"& .MuiCheckbox-root.Mui-checked":{color:"primary.main"},"& .MuiCheckbox-root .css-i4bv87-MuiSvgIcon-root":{width:"1.1em",height:"1.1em"},"& .MuiCheckbox-root svg":{stroke:"divider",strokeWidth:.7}},en={border:"1px solid",borderColor:"divider",borderRadius:1,overflow:"hidden",backgroundColor:"background.paper",backgroundImage:"none",transition:"all 0.2s ease-in-out"},qe=()=>({...en,width:"calc(50% - 8px)"});at.propTypes={loading:u.bool,type:u.oneOf(["server","service"]),onFilterChange:u.func,blockletMap:u.object,filterType:u.oneOf(["component","entity"]),selectedId:u.array,severity:u.array,enableMarkAllAsRead:u.bool,unReadCount:u.number,onReadFilterChange:u.func,currentReadFilter:u.string};function at({onFilterChange:t=()=>{},loading:s=!1,type:n="service",blockletMap:o={},filterType:i="component",selectedId:a=[],severity:l=[],enableMarkAllAsRead:p=!0,unReadCount:r=0,onReadFilterChange:f=()=>{},currentReadFilter:m="all"}){const{t:h}=b.useContext(Ie),[w,y]=b.useState(null),c=!!w,[g,k]=b.useState(a),[T,P]=b.useState(l),[R,$]=b.useState(!1),[C,L]=b.useState(""),[v,S]=b.useState([]);b.useEffect(()=>{k(a),P(l)},[a,l]);const B=[{label:h("notification.filterType.all"),value:"all"},{label:h("notification.filterType.unread"),value:"unread"}],q=d=>{(d!==m||!s)&&f(d)},H=[{label:h("notification.severityType.info"),value:"info"},{label:h("notification.severityType.success"),value:"success"},{label:h("notification.severityType.warning"),value:"warning"},{label:h("notification.severityType.error"),value:"error"}],ne=d=>{y(d.currentTarget),L(""),$(!1)},he=()=>{y(null)},oe=d=>{const j=g.includes(d)?g.filter(E=>E!==d):[...g,d];k(j),t({id:j,severity:T})},se=d=>{const j=T.includes(d)?T.filter(E=>E!==d):[...T,d];P(j),t({severity:j,id:g})},ge=d=>{L(d.target.value)},me=()=>{$(!R)},Y=Ft.useMemo(()=>{if(!o.size)return[];const d=[];return i==="component"&&d.push({label:h("notification.system"),id:"system"}),Array.from(o).forEach(([,j])=>{const E=j.did||j.meta?.did,W=j.title||j.meta?.title||"",U=j.appPid||j.appDid;(i==="component"&&U!==E||i==="entity"&&U===E)&&d.push({label:W,id:E,blocklet:j,ancestors:j.ancestors})}),d},[o,i,h]);b.useEffect(()=>{if(C.trim()==="")S(Y);else{const d=C.toLowerCase(),j=Y.filter(E=>E.label.toLowerCase().includes(d));S(j)}},[C,Y]);const be=C.trim()!==""||R?v:v.slice(0,Ue);return e.jsxs(x,{children:[e.jsxs(x,{sx:{display:"flex",justifyContent:p?"space-between":"flex-end",alignItems:"flex-start",flexWrap:"wrap",gap:1},children:[p&&e.jsx(x,{sx:{display:"flex",gap:1.5},children:B.map(d=>e.jsxs(G,{disabled:s,onClick:()=>q(d.value),className:`profile-button ${m===d.value?"active":""}`,sx:{...n==="service"&&m===d.value?{color:"secondary.main"}:{},color:"red",fontWeight:m===d.value?"bold":"normal"},children:[d.label,d.value==="unread"&&r>0&&` (${r})`]},d.value))}),e.jsxs(x,{sx:{display:"flex",justifyContent:"flex-end",gap:2},children:[e.jsx(O,{size:"small",onClick:ne,disabled:s,sx:{minWidth:"auto",borderRadius:1,border:"1px solid",borderColor:"divider","&:hover":{backgroundColor:"action.hover"}},children:e.jsx(N,{icon:Xr,hFlip:!0})}),e.jsx(Pt,{open:c,anchorEl:w,onClose:he,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{paper:{sx:{p:3,width:450,maxHeight:500,overflowY:"auto",backgroundColor:"background.paper",backgroundImage:"none",borderRadius:1,boxShadow:"0px 6px 24px rgba(0, 0, 0, 0.15)"}}},children:e.jsxs(x,{children:[e.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2,height:"28px"},children:[e.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("notification.severity")}),e.jsx(x,{sx:{minWidth:"60px",display:"flex",justifyContent:"flex-end"},children:(g.length>0||T.length>0)&&e.jsx(G,{size:"small",onClick:()=>{k([]),P([]),t({severity:[],id:[]})},startIcon:e.jsx(Rt,{fontSize:"small"}),sx:{color:"text.secondary",textTransform:"none",minWidth:"auto","&:hover":{backgroundColor:"transparent"},"& .MuiButton-startIcon":{marginRight:"2px"}},children:h("notification.clear")})})]}),e.jsx(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(ze,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:2,flex:1},children:H.map(d=>e.jsx(Le,{elevation:0,sx:qe(T.includes(d.value)),children:e.jsx(Z,{sx:{margin:0,padding:.5,width:"100%","& .MuiFormControlLabel-label":{display:"flex",alignItems:"center",gap:1,fontSize:"0.875rem"},..._e},control:e.jsx(Be,{checked:T.includes(d.value),onChange:()=>se(d.value),disabled:s,size:"small"}),label:e.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:.5},children:[e.jsx(pe,{severity:d.value}),d.label]})})},d.value))})}),e.jsxs(x,{sx:{mb:2},children:[e.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:2,mb:1.5},children:[e.jsx(A,{variant:"subtitle1",sx:{fontWeight:"bold",width:"calc(100% - 36px)"},children:h("notification.from")}),e.jsx(x,{sx:{display:"flex",alignItems:"center",width:"calc(100% - 36px)"},children:e.jsx(Ye,{size:"small",placeholder:"search",value:C,onChange:ge,sx:{width:"100%","& .MuiOutlinedInput-input":{padding:"6px 4px 6px 0"},".MuiOutlinedInput-root":{"&:hover":{fieldset:{borderColor:"divider"}},"&.Mui-focused":{fieldset:{borderColor:"divider"}}},fieldset:{borderColor:"divider"}},slotProps:{input:{size:"small",startAdornment:e.jsx(Qe,{position:"start",sx:{marginRight:"2px"},children:e.jsx(N,{icon:Cr})})}}})})]}),e.jsx(ze,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:2},children:be.map(d=>e.jsx(Le,{elevation:0,sx:qe(g.includes(d.id)),children:e.jsx(Z,{sx:{margin:0,padding:.5,width:"100%","& .MuiFormControlLabel-label":{fontSize:"0.875rem",width:"calc(100% - 36px)"},..._e},control:e.jsx(Be,{checked:g.includes(d.id),onChange:()=>oe(d.id),disabled:s,size:"small"}),label:e.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:.5,minWidth:0,width:"100%"},children:[d.blocklet&&e.jsx(Oe,{size:20,blocklet:d.blocklet,ancestors:d.ancestors,style:{borderRadius:4,flexShrink:0}}),e.jsx(A,{noWrap:!0,variant:"body2",component:"span",title:d.label,sx:{flex:1,overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%"},children:d.label})]})})},d.id))}),v.length>Ue&&C.trim()===""&&e.jsx(G,{fullWidth:!0,size:"small",onClick:me,sx:{mt:1},endIcon:R?e.jsx(It,{}):e.jsx(Tt,{})})]})]})})]})]}),g.length>0||T.length>0?e.jsxs(x,{className:"notification-filter-content",sx:{display:"flex",flexWrap:"wrap",gap:1,mt:2},children:[T.map(d=>{const j=H.find(E=>E.value===d);return e.jsx(we,{label:e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx(pe,{severity:d}),j?j.label:d]}),onDelete:()=>se(d),size:"small",variant:"outlined",sx:{borderRadius:2,color:"text.secondary",borderColor:"divider","& .MuiChip-label":{display:"flex",alignItems:"center"}}},`severity-${d}`)}),g.map(d=>{const j=Y.find(E=>E.id===d);return e.jsx(we,{label:e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:.5},children:[j?.blocklet&&e.jsx(Oe,{size:16,blocklet:j.blocklet,ancestors:j.ancestors,style:{borderRadius:4,flexShrink:0}}),j?j.label:d]}),variant:"outlined",onDelete:()=>oe(d),size:"small",sx:{borderRadius:2,color:"text.secondary",borderColor:"divider","& .MuiChip-label":{display:"flex",alignItems:"center"}}},`component-${d}`)})]}):null]})}const tn=ee(Et)`
|
|
2
|
-
position: fixed;
|
|
3
|
-
bottom: 20px;
|
|
4
|
-
right: 20px;
|
|
5
|
-
z-index: 1000;
|
|
6
|
-
@media (max-width: 600px) {
|
|
7
|
-
bottom: 16px;
|
|
8
|
-
right: 16px;
|
|
9
|
-
transform: scale(0.9);
|
|
10
|
-
}
|
|
11
|
-
`;function rn(){const[t,s]=b.useState(!1);b.useEffect(()=>{const o=Ve(()=>{s(window.pageYOffset>300)},200);return window.addEventListener("scroll",o),o(),()=>window.removeEventListener("scroll",o)},[]);const n=()=>{try{"scrollTo"in window?window.scrollTo({top:0,behavior:"smooth"}):window.scrollTo(0,0)}catch{window.scrollTo(0,0)}};return e.jsx(At,{in:t,children:e.jsx(tn,{color:"primary",size:"small","aria-label":"scroll back to top",onClick:n,children:e.jsx(Mt,{})})})}const nn=ee.div`
|
|
12
|
-
display: flex;
|
|
13
|
-
flex-direction: column;
|
|
14
|
-
gap: ${t=>t.inDialog?0:"24px"};
|
|
15
|
-
.MuiContainer-root {
|
|
16
|
-
padding-right: 0;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.profile-button.MuiButtonBase-root {
|
|
20
|
-
border-radius: 9999px;
|
|
21
|
-
margin-right: 2px;
|
|
22
|
-
padding: 5px 12px;
|
|
23
|
-
line-height: 22px;
|
|
24
|
-
font-size: 13px;
|
|
25
|
-
border: 1px solid transparent;
|
|
26
|
-
background-color: ${({theme:t})=>t.palette.background.default};
|
|
27
|
-
color: ${({theme:t})=>t.palette.text.primary};
|
|
28
|
-
font-weight: 400;
|
|
29
|
-
border: 1px solid ${({theme:t})=>t.palette.divider} !important;
|
|
30
|
-
}
|
|
31
|
-
.profile-button.active.MuiButtonBase-root,
|
|
32
|
-
.profile-button.active.MuiButtonBase-root:hover {
|
|
33
|
-
color: ${({theme:t})=>t.palette.primary.main};
|
|
34
|
-
font-weight: 600;
|
|
35
|
-
background-color: ${({theme:t})=>le(t.palette.primary.main,.1)};
|
|
36
|
-
border: 1px solid ${({theme:t})=>le(t.palette.primary.main,.24)} !important;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.profile-button.MuiButtonBase-root:hover {
|
|
40
|
-
background-color: rgba(0, 0, 0, 0.04);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.profile-line-button.MuiButtonBase-root {
|
|
44
|
-
margin-right: 2px;
|
|
45
|
-
color: ${({theme:t})=>t.palette.text.secondary};
|
|
46
|
-
padding: 5px 12px;
|
|
47
|
-
line-height: 22px;
|
|
48
|
-
font-size: 13px;
|
|
49
|
-
border: none !important;
|
|
50
|
-
border-radius: 0;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.profile-line-button.active.MuiButtonBase-root {
|
|
54
|
-
color: ${({theme:t})=>t.palette.text.primary};
|
|
55
|
-
border-bottom: 1px solid ${({theme:t})=>t.palette.text.primary} !important;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.profile-button.MuiButtonBase-root:last-of-type,
|
|
59
|
-
.profile-line-button.MuiButtonBase-root {
|
|
60
|
-
margin-right: 0;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.profile-line-button.MuiButtonBase-root:hover {
|
|
64
|
-
color: ${({theme:t})=>t.palette.text.primary};
|
|
65
|
-
background-color: unset;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
* {
|
|
69
|
-
scrollbar-width: none; /* Firefox */
|
|
70
|
-
-ms-overflow-style: none; /* IE and Edge */
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
*::-webkit-scrollbar {
|
|
74
|
-
display: none; /* Chrome, Safari and Opera */
|
|
75
|
-
}
|
|
76
|
-
`;lt.propTypes={blocklets:u.array,context:u.object,pagination:u.bool,inDialog:u.bool,filterType:u.oneOf(["component","entity"]),toViewAll:u.func,type:u.oneOf(["server","service"])};function lt({blocklets:t=[],context:s,pagination:n=!0,inDialog:o=!1,filterType:i="component",toViewAll:a=()=>{},type:l="service"}){const{data:p,paging:r,refresh:f,loading:m,params:h,onReadNotification:w,componentDids:y,filterUnReadCount:c,initial:g}=s,k=d=>{f({...h,severity:d&&typeof d=="string"?[d]:d||[],paging:{...h.paging,page:1}})},[T]=Ut(),P=M(()=>T.get("id"),[T]),R=xe(d=>d.breakpoints.down("md")),[$,C]=b.useState(0),[L,v]=b.useState(!1),S=b.useMemo(()=>h.read===!1?"unread":"all",[h.read]),B=M(()=>Ve(d=>{if(m)return;const j=p.length,E=p.filter(U=>!Fe(U)).length;let W={...h,append:!0,paging:{...h.paging,...d,currentPage:(r.currentPage||0)+1}};S==="unread"&&E<j&&d.page>h.paging.page&&(W={...h,append:!0,paging:{...h.paging,...d,page:h.paging.page||1,currentPage:(r.currentPage||0)+1}}),f(W)},500),[p,h,S,r,m,f]);et(()=>{g&&typeof g=="function"&&g()}),b.useEffect(()=>{(!r.currentPage||r.currentPage===1)&&C(r.total)},[r.total,r.currentPage]),b.useEffect(()=>{setTimeout(()=>{const d=document.getElementById(P);d&&d.scrollIntoView({behavior:"smooth",block:"center"}),v(!0)},100),setTimeout(()=>{v(!1)},3e3)},[P]);const q=M(()=>p?.length>0&&p.length<$,[p,$]),H=b.useCallback(d=>{const{blocklet:j={}}=window,E=[j?.did,...(j?.ancestors||[]).map(W=>W)];return y?.includes(d)||E.findIndex(W=>W===d)>-1},[y]),ne=b.useMemo(()=>{const d=new Map;return t.length&&t.forEach(j=>{const E=j?.did||j.meta?.did;E&&!d.has(E)&&(j.ancestors=[],d.set(E,j),j?.alsoKnownAs?.length>0&&j.alsoKnownAs.forEach(W=>{d.has(W)||d.set(W,j)})),j?.children?.length>0&&j.children.forEach(W=>{const U=W?.did||W.meta?.did;U&&!d.has(U)&&H(U)&&(W.ancestors=[j],d.set(U,W))})}),d},[t,H]),he=b.useCallback(()=>{m||B({page:r.page+1})},[r.page,m,B]),[oe]=Zr({loading:m,hasNextPage:q,onLoadMore:he}),se=d=>{!d||Fe(d)||w(d.id).then(()=>{o&&a()})},ge=({severity:d,id:j})=>{if(m)return;let E={};i==="component"?E={entityId:[],componentDid:j}:i==="entity"&&(E={componentDid:[],entityId:j}),f({...h,severity:d,...E,paging:{...h.paging,page:1}})},me=d=>{if(m)return;let j={...h,paging:{...h.paging,page:1}};d==="unread"?(j.read=!1,j.paging.currentPage=1):j=or(j,"read"),f(j)},Y=M(()=>i==="component"?Array.isArray(h.componentDid)?h.componentDid:[]:i==="entity"?Array.isArray(h.entityId)?h.entityId:[]:[],[h,i]),be=M(()=>(Array.isArray(h.severity)?h.severity:[])[0]||"",[h.severity]);return e.jsxs(nn,{inDialog:!!o,children:[o?e.jsx(st,{currentTab:be,type:"line",theme:"light",onSelectType:k}):e.jsx(at,{loading:m,blockletMap:ne,unReadCount:c,filterType:i,type:l,selectedId:Y,onFilterChange:ge,severity:h.severity,onReadFilterChange:me,currentReadFilter:S}),!R&&m?e.jsx(x,{sx:{display:"flex",width:"100%",minHeight:400,justifyContent:"center",alignItems:"center"},children:e.jsx(V,{})}):e.jsx(wr,{data:p,blockletMap:ne,onReadNotification:se,onReadBatch:w,inDialog:o,highlightId:P,highlight:!o&&L,type:l}),n&&!R?e.jsx(Jr,{loading:m,paging:r,onChange:B}):null,n&&R&&(m||q)?e.jsx(x,{ref:oe,sx:{display:"flex",width:"100%",minHeight:100,justifyContent:"center",alignItems:"center"},children:e.jsx(V,{})}):null,!o&&R?e.jsx(rn,{}):null]})}const on=b.memo(lt),F=new Gt;function Ae(t){const{userDid:s=""}={},{session:n}=qt(),o=M(()=>{if(s)return s;const r=window.location.href,f=sr(r);return f?.did?Array.isArray(f.did)?f.did[0]:f.did:n?.user?.did},[n?.user?.did,s]),i=M(()=>n.user,[n]),a=M(()=>i?o===i?.did:!1,[o,i?.did]),l=te(async()=>{if(await Ht(()=>n?.initialized),a)return n.user;if(o)return F.user.getUserPublicInfo({did:o})},{refreshDeps:[o,a,n?.initialized,i]}),p=M(()=>i.passports?.some(r=>r.role===Pe.ROLES.OWNER),[i]);return{currentDid:o,session:n,isMyself:a,user:i,viewUser:l.data,isOwner:p}}function ct({user:t,...s}){const{t:n}=D(),o=zt(),i=M(()=>{const p=(t?.passports||[]).map(r=>({...r,revoked:r.status===lr.REVOKED}));return p.sort((r,f)=>r.revoked===f.revoked?0:r.revoked?1:-1),$e(p.filter(r=>!r.display),"role").concat($e(p.filter(r=>r.display),"display.content"))},[t?.passports]),a=M(()=>i?.find(p=>p.name===t.role),[i,t?.role]),l=o.palette.primary.main;return i.length===0?e.jsx(x,{children:e.jsx(Ze,{children:n("userCenter.noPassport")})}):e.jsx(x,{...s,sx:{display:"grid",justifyItems:"start",gridTemplateColumns:{xs:"repeat(2, 1fr)",sm:"repeat(2, 1fr)",md:"repeat(3, 1fr)",lg:"repeat(5, 1fr)"},gap:2.5,...s.sx},children:i.map(p=>e.jsx(kr,{passport:p,user:t,color:window.blocklet.passportColor,createPassportSvg:Kt,title:a&&a.role===p.role?n("userCenter.currentPassport"):"",sx:{flexDirection:"column",alignItems:"center",gap:1,".passport-item__display":{width:166,height:166,borderRadius:1,px:2,display:"flex",justifyContent:"center",backgroundColor:"grey.50",boxShadow:a&&a.role===p.role?`0px 2px 4px 0px ${l}, 0px 1px 2px -1px ${l}, 0px 0px 0px 1px ${l} !important`:"unset"},".passport-item__body":{marginLeft:"0 !important"}}},p.id))})}ct.propTypes={user:u.object.isRequired};function sn({visible:t,onClose:s,nft:n}){return!t||!n?null:e.jsx(an,{children:e.jsx(Lt,{open:t,onClose:s,children:e.jsx(ln,{onClick:s,children:e.jsx(rt,{data:nt(n),address:n.address,inset:!0})})})})}const an=ee.div`
|
|
77
|
-
position: relative;
|
|
78
|
-
width: 100%;
|
|
79
|
-
height: 100%;
|
|
80
|
-
cursor: pointer;
|
|
81
|
-
|
|
82
|
-
&:hover {
|
|
83
|
-
.mask {
|
|
84
|
-
opacity: 1;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.mask {
|
|
89
|
-
position: absolute;
|
|
90
|
-
top: 0;
|
|
91
|
-
left: 0;
|
|
92
|
-
display: flex;
|
|
93
|
-
align-items: center;
|
|
94
|
-
justify-content: center;
|
|
95
|
-
width: 100%;
|
|
96
|
-
height: 100%;
|
|
97
|
-
background: rgba(0, 0, 0, 0.6);
|
|
98
|
-
opacity: 0;
|
|
99
|
-
transition: opacity 0.2s;
|
|
100
|
-
}
|
|
101
|
-
`,ln=ee.div`
|
|
102
|
-
display: flex;
|
|
103
|
-
justify-content: center;
|
|
104
|
-
align-items: center;
|
|
105
|
-
height: 100vh;
|
|
106
|
-
width: 100vw;
|
|
107
|
-
|
|
108
|
-
img,
|
|
109
|
-
object {
|
|
110
|
-
max-width: 90vw;
|
|
111
|
-
max-height: 75vh;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
.nft-display--inset {
|
|
115
|
-
> .MuiBox-root,
|
|
116
|
-
.nft-display__loading {
|
|
117
|
-
width: 75vmin;
|
|
118
|
-
height: 75vmin;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
`,cn=t=>({position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.6)",opacity:0,transition:"opacity 0.3s ease-in-out",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1,"& .mask-item":{backgroundColor:le(t.palette.background.paper,.9),color:"text.primary","&:hover":{backgroundColor:le(t.palette.background.paper,1)}}}),dn={position:"absolute",bottom:0,left:0,right:0,height:24,backgroundColor:"rgba(0, 0, 0, 0.6)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",gap:1,zIndex:1,"& .mask-item":{width:20,height:20,color:"white"}},He="https://main.abtnetwork.io/explorer";function dt({user:t}){const{t:s}=D(),n=re(),[o,i]=b.useState({visible:!1,nft:null}),[a,l]=b.useState({anchorEl:null,props:null}),p=P=>{const R=ce(He,"assets",P);window.open(R,"_blank")},r=(P,R)=>{let $="";typeof R.data?.value=="string"?$=JSON.parse(R.data?.value)?.domain:$=R.data?.value?.domain,l({anchorEl:P,props:{title:$?`Hey, I just won an NFT at the ${$} event!`:"Hey, I just won an NFT!",url:ce(He,"assets",R.address)}})},f=P=>{i({visible:!0,nft:P})},m=K({page:1,size:20}),h=te(async(P=m)=>(await ir.get(`${Pe.WELLKNOWN_SERVICE_PATH_PREFIX}/ocap/listAssets`,{params:{ownerAddress:t.did,...P}})).data,{defaultParams:[m],refreshDeps:[t.did,m]}),{loading:w,data:y}=h,c=y?.page??{cursor:0,next:!1,total:0},g=(P,R)=>{m.page=R,h.run(m)},k=z(P=>[e.jsx(O,{size:"small",className:"mask-item",onClick:R=>{R.stopPropagation(),p(P.address)},children:e.jsx(N,{icon:"tabler:link",fontSize:18})},"link"),e.jsx(O,{size:"small",onClick:R=>{R.stopPropagation(),r(R.currentTarget,P)},className:"mask-item",children:e.jsx(N,{icon:"tabler:share-2",fontSize:18})},"share"),e.jsx(O,{size:"small",onClick:R=>{R.stopPropagation(),f(P)},className:"mask-item",children:e.jsx(N,{icon:"tabler:eye",fontSize:18})},"view")]),T=M(()=>{if(w){const P=["skeleton-1","skeleton-2","skeleton-3","skeleton-4","skeleton-5"].map(R=>e.jsx(We,{variant:"rectangular",width:"15%",height:166,sx:{borderRadius:1,flexShrink:0}},R));return e.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:2},children:[e.jsx(We,{width:"20%"}),e.jsx(x,{sx:{display:"flex",flexDirection:"row",gap:2,flexWrap:"nowrap"},children:P})]})}return e.jsxs(e.Fragment,{children:[e.jsx(A,{sx:{color:"grey.A700",fontWeight:600,mb:2.5},children:s("userCenter.common.nft")}),y?.assets?.length===0&&!w&&e.jsx(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",height:"100%"},children:e.jsx(Ze,{children:s("userCenter.common.noNFT")})}),e.jsx(x,{className:"nft-list-wrapper",sx:{display:"grid",justifyItems:"start",gridTemplateColumns:{xs:"repeat(2, 1fr)",sm:"repeat(3, 1fr)",md:"repeat(3, 1fr)",lg:"repeat(5, 1fr)"},gap:2.5},children:y?.assets?.map(P=>e.jsxs(x,{sx:{flexShrink:0,width:{xs:120,sm:120,md:120,lg:166},height:{xs:120,sm:120,md:120,lg:166},position:"relative",borderRadius:1,overflow:"hidden",cursor:"pointer",...n?{}:{"&:hover .mask":{opacity:1}}},children:[e.jsx(rt,{data:nt(P),address:P.address,inset:!0,imageFilter:{imageFilter:"resize",w:"500",f:"webp"}}),n?e.jsx(x,{className:"footer-mask",sx:dn,children:k(P)}):e.jsx(x,{className:"mask",sx:cn,children:e.jsx(ke,{direction:"row",spacing:1,children:k(P)})})]},P.address))}),c.next||m.page>1?e.jsx(Bt,{sx:{display:"flex",justifyContent:"center",mt:2},page:m.page,onChange:g,count:Math.ceil(c.total/m.size),size:"small"}):null,e.jsx(sn,{visible:o.visible&&!!o.nft,nft:o.nft,onClose:()=>{i({visible:!1,nft:null})}}),e.jsx(cr,{anchorEl:a.anchorEl,onClose:()=>{l({anchorEl:null,props:null})},sharedProps:a.props||{title:"",url:""}})]})},[w,c,m.page,m.size,g,a,o]);return e.jsx(x,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2,mb:5},children:T})}dt.propTypes={user:u.object.isRequired};function un(){const{t}=D(),{user:s,isMyself:n}=Ae();return e.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:2.5},children:[n?e.jsxs(x,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1.5,p:2},children:[e.jsx(A,{sx:{color:"text.primary",fontWeight:600,mb:2.5},children:t("userCenter.passport")}),e.jsx(ct,{user:s})]}):null,e.jsx(dt,{user:s})]})}const pn=[{name:"English",code:"en"},{name:"中文",code:"zh"}];function ut({user:t,onSave:s}){const{t:n,changeLocale:o}=D(),i=K({locale:t.locale,loading:!1}),a=z(async l=>{try{const{value:p}=l.target;i.loading=!0,await F.user.saveProfile({locale:p}),await s("profile"),o(p),i.locale=p}catch(p){_.error(X(p))}finally{i.loading=!1}});return e.jsxs(x,{sx:{gap:1,display:"grid",alignItems:"center",gridTemplateColumns:{xs:"1fr",sm:"max-content 1fr"}},children:[e.jsx(x,{children:n("userCenter.commonSetting.locale")}),e.jsxs(x,{children:[i.loading?e.jsx(Wt,{color:"primary",sx:{height:2}}):e.jsx(x,{sx:{height:2,visibility:"hidden"}}),e.jsx(Se,{value:i.locale,onChange:a,size:"small",IconComponent:l=>e.jsx(tt,{...l,width:20,height:20}),sx:{minWidth:200,"&:hover":{"fieldset.MuiOutlinedInput-notchedOutline":{borderColor:"divider"}},fieldset:{borderColor:"divider"}},children:(window.blocklet.languages||pn).map(l=>e.jsx(ae,{value:l.code,children:l.name},l.code))})]})]})}ut.propTypes={user:u.shape({locale:u.string}).isRequired,onSave:u.func.isRequired};function Ce({onTest:t=Q,onDelete:s=Q,onSave:n=Q,onCancel:o=Q,type:i="slack",url:a="",edit:l=!1}){const{t:p}=D(),r=K({type:i||"slack",url:a||"",edit:l??!1,error:"",loading:!1}),f=z(()=>r.url?Yt(r.url)?(r.error="",!0):(r.error=p("common.invalid"),!1):(r.error=p("common.required"),!1)),m=z(()=>{r.edit=!1,r.url=a||"",r.type=i||"slack",r.error="",r.loading=!1,o()}),h=z(async c=>{r.loading=!0,await t(c),r.loading=!1}),w=z(c=>()=>{f()&&c({type:r.type,url:r.url})}),y=M(()=>r.error?e.jsx(A,{component:"span",color:"error",children:r.error}):r.edit?r.loading?e.jsx(V,{size:16}):e.jsx(O,{size:"small",onClick:w(h),sx:{mr:-1},children:e.jsx(N,{icon:Pr})}):null,[r.error,r.edit,r.loading]);return e.jsxs(x,{sx:{display:"flex",gap:1.5,width:"100%",alignItems:{xs:"flex-start",md:"center"},flexDirection:{xs:"column",md:"row"}},children:[e.jsxs(Se,{sx:{borderRadius:1,"&.Mui-disabled":{backgroundColor:"grey.50"}},disabled:!r.edit||r.loading,size:"small",value:r.type,onChange:c=>{r.type=c.target.value},children:[e.jsx(ae,{value:"api",children:p("userCenter.webhook.url")}),e.jsx(ae,{value:"slack",children:p("userCenter.webhook.slack")})]}),e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:.5,width:"100%"},children:[e.jsx(Ye,{sx:{flex:1,".MuiInputBase-root":{borderRadius:1,"&.Mui-disabled":{backgroundColor:"grey.50"}}},disabled:!r.edit||r.loading,fullWidth:!0,size:"small",required:!0,value:r.url,onChange:c=>{r.url=c.target.value,f()},error:!!r.error,slotProps:{input:{endAdornment:e.jsx(Qe,{position:"end",children:y})}}}),e.jsx(x,{sx:{display:"flex",gap:.5},children:r.edit?e.jsxs(e.Fragment,{children:[e.jsx(O,{color:"success",onClick:w((...c)=>{n(...c),r.edit=!1}),sx:{borderRadius:1,border:"1px solid",borderColor:"grey.200"},children:e.jsx(N,{icon:dr})}),e.jsx(O,{color:"error",onClick:m,sx:{borderRadius:1,border:"1px solid",borderColor:"grey.200"},children:e.jsx(N,{icon:ur})})]}):e.jsxs(e.Fragment,{children:[e.jsx(O,{onClick:()=>{r.edit=!0},sx:{borderRadius:1,border:"1px solid",borderColor:"grey.200"},children:e.jsx(N,{icon:Rr})}),e.jsx(O,{color:"error",onClick:()=>{s({type:r.type,url:r.url})},sx:{borderRadius:1,border:"1px solid",borderColor:"grey.200"},children:e.jsx(N,{icon:Ir})})]})})]})]})}Ce.propTypes={onTest:u.func,onDelete:u.func,onSave:u.func,onCancel:u.func,type:u.oneOf(["api","slack"]),url:u.string,edit:u.bool};function ie({title:t=void 0,description:s=void 0,value:n,onChange:o,isMobile:i}){const a=z(l=>{l.stopPropagation()});return e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(ot,{checked:n,size:"small",onChange:o}),e.jsxs(A,{component:"div",onClick:a,sx:{color:"text.primary",fontSize:14,display:"flex",flexWrap:i?"wrap":"nowrap",columnGap:1,flex:1,whiteSpace:i?"normal":"nowrap"},children:[t,s]})]})}ie.propTypes={title:u.string,description:u.node,value:u.bool.isRequired,onChange:u.func.isRequired,isMobile:u.bool.isRequired};function pt({user:t,isMobile:s}){const{t:n}=D(),o=K({showAdd:!1}),i=te(async()=>await F.user.getUserNotificationConfig(),{refreshDeps:[t],loadingDelay:300}),a=M(()=>({wallet:!0,email:!0,phone:!1,push:!0,...i?.data?.notifications||{}}),[i?.data?.notifications]),l=M(()=>i?.data?.webhooks||[],[i?.data?.webhooks]),p=z(async y=>{try{await F.user.saveUserNotificationConfig(y),_.success(n("userCenter.saveSuccess")),i.run()}catch(c){_.error(X(c))}}),r=z(async(y,c)=>{await p({notifications:{[y]:c}})}),f=async y=>{try{await F.user.testNotificationWebhook(y),_.success(n("userCenter.webhookTested"))}catch(c){_.error(X(c))}},m=z(async y=>{await p({webhooks:l.filter((c,g)=>g!==y)})}),h=z(async(y,c)=>{await p({webhooks:l.map((g,k)=>k===y?c:g)})}),w=z(async y=>{await p({webhooks:[...l,y]}),o.showAdd=!1});return i.error?e.jsx($t,{severity:"error",children:i.error.message}):i.loading||!i.data?e.jsx(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100px"},children:e.jsx(V,{})}):e.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:2},children:[e.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:1,alignItems:"start",".MuiFormControlLabel-root":{gap:1,m:0,flexDirection:{xs:"row-reverse",md:"row"},width:{xs:"100%",md:"unset"}},".MuiSwitch-track":{borderRadius:"100vw"},".MuiSwitch-thumb":{borderRadius:"100%"},".MuiSwitch-root.MuiSwitch-sizeSmall":{height:"20px",width:"36px",".MuiSwitch-thumb":{width:"16px",height:"16px"}}},children:[e.jsx(ie,{value:a.wallet,isMobile:s,title:n("userCenter.walletNotification"),onChange:y=>r("wallet",y.target.checked),description:De(t)&&e.jsx(pr,{did:De(t),showQrcode:!1,showAvatar:!s,copyable:!0,compact:!0,responsive:!0,startChars:s?2:6})}),e.jsx(ie,{value:a.email,isMobile:s,onChange:y=>r("email",y.target.checked),title:n("userCenter.emailNotification"),description:t?.email&&e.jsx(A,{component:"span",sx:{color:"text.secondary",fontSize:13},children:t?.email})}),e.jsx(ie,{isMobile:s,value:a.push,title:n("userCenter.pushNotification"),onChange:y=>r("push",y.target.checked)})]}),e.jsxs(ke,{spacing:1.5,useFlexGap:!0,direction:"column",sx:{alignItems:"start"},children:[l.map((y,c)=>e.jsx(Ce,{onTest:f,onDelete:()=>m(c),onSave:(...g)=>h(c,...g),type:y.type,url:y.url,edit:!1},`${c}_${y.url}`)),o.showAdd&&e.jsx(Ce,{onTest:f,onCancel:()=>{o.showAdd=!1},onSave:(...y)=>w(...y),edit:!0},"add"),e.jsx(Je,{variant:"outlined",size:"small",sx:{color:"text.primary",borderColor:"divider","&:hover":{borderColor:"divider"},py:.5,borderRadius:1},startIcon:e.jsx(N,{icon:Tr}),onClick:()=>{o.showAdd=!0},children:n("userCenter.addWebhook")})]})]})}pt.propTypes={user:u.object.isRequired,isMobile:u.bool.isRequired};function xt({item:t}){const s=Te(),{blocklet:n}=Qt(),{confirmApi:o,confirmHolder:i}=Re(),a=K({loading:!1}),{t:l}=D(),{session:p}=b.use(fe),{bindOAuth:r,unbindOAuth:f,setBaseUrl:m,baseUrl:h}=p.useOAuth(),{disconnectPasskey:w,setTargetAppPid:y}=p.usePasskey(),c={[I.AUTH0]:xr,[I.APPLE]:Zt,[I.GITHUB]:Br,[I.GOOGLE]:Vt,[I.PASSKEY]:Mr,[I.WALLET]:Ar},g=M(()=>c[t?.provider],[t?.provider]),k=M(()=>fr[t?.provider]||"unknown",[t?.provider]),T=z(async()=>{if(t?.provider===I.PASSKEY){await new Promise((C,L)=>{o.open({title:l("userCenter.thirdPartyLogin.disconnectPasskey",{name:k}),content:l("userCenter.thirdPartyLogin.disconnectPasskeyDescription",{name:k}),confirmButtonText:l("common.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:l("common.cancel"),onConfirm(v){w({session:p,connectedAccount:t}).then(C).catch(L),v()},onCancel:C})});return}try{a.loading=!0,await new Promise((C,L)=>{if(t?._bind)o.open({title:l("userCenter.thirdPartyLogin.confirmUnbind",{name:k}),content:l("userCenter.thirdPartyLogin.confirmUnbindDescription",{name:k}),confirmButtonText:l("common.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:l("common.confirm"),onConfirm(v){f({session:p,connectedAccount:{...ar(t,["did","pk"]),showProvider:t.provider,provider:t._rawProvider}}).then(C).catch(L),v()},onCancel:C});else if(t.provider===I.WALLET)p.bindWallet({onSuccess:C,onCancel:L});else{const v=h,S=window?.blocklet;let B="/";const q=hr(S),H=gr(S);q&&H?.appPid&&p?.user?.sourceAppPid&&(B=H.appUrl),m(B),y(n?.appPid),r({session:p,oauthItem:{...t,provider:t._rawProvider}}).then(C).catch(L).finally(()=>{m(v),y()})}})}catch(C){console.error(`Failed to ${t?._bind?"unbind":"bind"} oauth account`,C)}finally{a.loading=!1}}),P=z(C=>C.provider===I.WALLET&&C.did?l("userCenter.thirdPartyLogin.walletAccount"):C._mainProvider?l("userCenter.thirdPartyLogin.mainAccount"):C?._bind?l("userCenter.thirdPartyLogin.disconnect"):l("userCenter.thirdPartyLogin.connect")),R=z(C=>C.provider===I.WALLET&&C.did?l("userCenter.thirdPartyLogin.walletAccountCantRemove"):C.provider===I.PASSKEY?l("userCenter.thirdPartyLogin.dontSupportRemoveinArcSphere"):C._mainProvider?l("userCenter.thirdPartyLogin.mainProviderCantRemove"):""),$=z(C=>C.provider===I.WALLET&&C.did||C.provider===I.PASSKEY&&(s.arcSphere||s.wallet)?!0:!!t._mainProvider,[s.arcSphere]);return e.jsxs(e.Fragment,{children:[e.jsxs(x,{sx:{borderRadius:1,border:"1px solid",borderColor:"divider",backgroundColor:"grey.50",display:"flex",alignItems:"center",py:1,px:1.5,gap:.75,fontSize:"14px",lineHeight:1,overflow:"hidden"},children:[e.jsx(x,{component:N,icon:g,fill:"currentColor",sx:{width:"1em",height:"1em",flexShrink:0,fontSize:16,filter:({palette:C})=>t?.provider===I.GITHUB&&C.mode==="dark"?"invert(1)":"none"}}),e.jsx(x,{sx:{flex:1,display:{xs:t.userInfo?.email||t.did?"none":"block",sm:"block"}},children:k}),t.userInfo?.email||t.did?e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:.5,overflow:"hidden"},children:[e.jsx(x,{sx:{flex:1,textOverflow:"ellipsis",overflow:"hidden",lineHeight:"normal"},children:t.userInfo?.email||t.did}),t.userInfo?.name?e.jsx(J,{title:e.jsx(e.Fragment,{children:e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(Xe,{size:36,variant:"circle",shape:"circle",src:t.userInfo?.picture,did:t.did}),e.jsxs(x,{children:[e.jsx(A,{sx:{whiteSpace:"normal",wordBreak:"break-all",fontSize:"0.9rem"},children:t.userInfo?.name}),e.jsx(A,{sx:{whiteSpace:"normal",wordBreak:"break-all",fontSize:"0.9rem"},children:t.userInfo?.email})]})]})}),children:e.jsx(x,{component:N,icon:Jt,sx:{color:"text.secondary",fontSize:16,cursor:"pointer",flexShrink:0}})}):null]}):null]}),e.jsx(J,{title:R(t),placement:"auto",children:e.jsx(x,{children:e.jsx(Je,{variant:"outlined",size:"small",sx:C=>{const L=C.palette.error.main,v=C.palette.primary.main;return{color:t?._bind?L:v,borderColor:t?._bind?L:v,backgroundColor:"background.default","&:hover":{borderColor:t?._bind?L:v,backgroundColor:"action.hover"},py:.5,borderRadius:1,fontWeight:500,whiteSpace:"nowrap"}},fullWidth:!0,startIcon:a.loading?null:e.jsx(N,{icon:Er}),onClick:T,disabled:$(t),loading:a.loading,children:P(t)})})}),i]})}xt.propTypes={item:u.shape({provider:u.string,did:u.string,pk:u.string,userInfo:u.object,id:u.string,_bind:u.bool,_rawProvider:u.string,_mainProvider:u.bool}).isRequired};function ft({user:t}){const{session:s}=b.use(fe),[n,o]=b.useState({}),{getOAuthConfigs:i}=s.useOAuth(),a=Te();jr(async()=>{const r=await i({sourceAppPid:t?.sourceAppPid});o(r)},[t?.sourceAppPid]);const l=M(()=>{const r=Object.keys(n).map(f=>({...n[f],provider:f})).filter(f=>f.enabled);return[{provider:I.WALLET,order:-1},...r,{provider:I.PASSKEY,order:1/0}]},[n]),p=M(()=>{const r=mr(t);let f=!1,m="",h=br(t);const w=r.find(c=>c.provider===I.AUTH0);return w&&(w.id.startsWith("google-oauth2|")&&(r.some(c=>c.provider==="google")||(f=!0,m=I.GOOGLE,h===I.AUTH0&&(h=I.GOOGLE))),w.id.startsWith("appleid|")&&(r.some(c=>c.provider===I.APPLE)||(f=!0,m=I.APPLE,h===I.AUTH0&&(h=I.APPLE))),w.id.startsWith("github|")&&(r.some(c=>c.provider===I.GITHUB)||(f=!0,m=I.GITHUB,h===I.AUTH0&&(h=I.GITHUB)))),l.map(c=>{if(c.provider===I.AUTH0&&f)return null;const g=f&&c.provider===m?r.find(k=>k.provider===I.AUTH0):r.find(k=>k.provider===c.provider);return g?{...c,provider:c.provider,did:g.did,pk:g.pk,userInfo:g.userInfo,_bind:!0,_rawProvider:g.provider,_mainProvider:c.provider===h}:{...c,provider:c.provider,_rawProvider:c.provider,_mainProvider:c.provider===h}}).filter(c=>!(!c||c.provider===I.PASSKEY&&!c.did)).sort((c,g)=>c._mainProvider?-1:c?.order!==void 0&&g?.order!==void 0?c.order-g.order:c?.order!==void 0?-1:1)},[t?.connectedAccounts,l]);return e.jsxs(x,{sx:{gap:1,display:"grid",gridTemplateColumns:"1fr min-content"},children:[p.map(r=>e.jsx(xt,{item:r},r?.provider)),a.wallet||a.arcSphere?null:e.jsx(Xt,{behavior:"only-new",action:"connect",createMode:"connect",createButtonText:"Add New Passkey",onSuccess:Q,onError:Q,dense:!0,sx:{px:1.5,py:1,gap:.75}})]})}ft.propTypes={user:u.object.isRequired};function ht({configList:t,onSave:s}){const[n,o]=b.useState(t),{t:i}=D(),a=z(async(l,p)=>{try{const r=await F.user.saveUserPrivacyConfig({[l]:!p});o(n.map(f=>({...f,value:r?.[f.key]??f.value}))),_.success(i("userCenter.saveSuccess")),s("privacy")}catch(r){_.error(X(r))}});return b.useEffect(()=>{o(t)},[t]),e.jsx(x,{sx:{display:"flex",flexDirection:"column",gap:1,alignItems:"start",".MuiFormControlLabel-root":{gap:1,m:0,flexDirection:{xs:"row-reverse",md:"row"},width:{xs:"100%",md:"unset"}},".MuiSwitch-track":{borderRadius:"100vw"},".MuiSwitch-thumb":{borderRadius:"100%"},".MuiSwitch-root.MuiSwitch-sizeSmall":{height:"20px",width:"36px",".MuiSwitch-thumb":{width:"16px",height:"16px"}}},children:n.map(l=>l.isPrivate?null:e.jsx(ot,{checked:!l.value,labelProps:{label:e.jsx(A,{sx:{color:"text.primary",fontSize:14,display:"flex",flexFlow:"wrap",columnGap:1,flex:1},children:i("userCenter.toPublic",{name:l.name})})},size:"small",onChange:p=>a(l.key,p.target.checked)},l.key))})}ht.propTypes={configList:u.arrayOf(u.shape({key:u.string.isRequired,name:u.string.isRequired,value:u.bool.isRequired,isPrivate:u.bool})).isRequired,onSave:u.func.isRequired};function gt({user:t,sessionUser:s}){const n=M(()=>(t?.passports||[])?.find(o=>o.name===s.role),[t?.passports,s?.role]);return e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(Xe,{size:40,variant:"circle",shape:"circle",src:s.avatar,did:s.did,sx:{flexShrink:0}}),e.jsxs(x,{sx:{flex:1,overflow:"hidden"},children:[e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(J,{title:s.fullName,children:e.jsx(A,{sx:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",flex:1},children:s.fullName})}),e.jsx(we,{label:n?.title||n?.name||"Guest",size:"small",variant:"outlined",sx:{flexShrink:0,fontWeight:"bold",fontSize:"12px",color:"text.primary",borderColor:"grey.300",backgroundColor:"transparent",textTransform:"capitalize",pr:.5,pl:0,height:"auto"}})]}),e.jsx(J,{title:s.email,children:e.jsx(A,{variant:"body2",color:"grey",sx:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s.email})})]})]})}gt.propTypes={user:u.object.isRequired,sessionUser:u.shape({role:u.string,avatar:u.string,did:u.string,fullName:u.string,email:u.string}).isRequired};const xn=()=>Promise.resolve(""),Ge=t=>new ve(t,{browser:[[/(ArcWallet)\/([\w\.]+)/i],[ve.BROWSER.NAME,ve.BROWSER.VERSION]]}).getResult(),Ke={display:"flex",justifyContent:"flex-end",textAlign:"right"},fn=new er({concurrency:1}),Me=b.memo(({userSession:t,isMobile:s=!1})=>{const n=K({loading:!0,ipRegion:""}),{t:o}=D();return b.useEffect(()=>{fn.add(async()=>{try{n.ipRegion=await xn(t.lastLoginIp)}finally{n.loading=!1}})},[n,t.lastLoginIp]),e.jsx(x,{...s&&{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:1,flexWrap:"wrap"},children:n.ipRegion?e.jsxs(e.Fragment,{children:[e.jsx(A,{variant:"body2",children:n.ipRegion}),e.jsx(A,{variant:"body2",color:"grey",children:t.lastLoginIp||o("userCenter.unknown")})]}):e.jsxs(e.Fragment,{children:[e.jsx(A,{children:t.lastLoginIp||o("userCenter.unknown")}),n.loading?e.jsx(A,{variant:"body2",color:"grey",sx:{textAlign:"center"},children:e.jsx(V,{size:12,color:"inherit"})}):null]})})});Me.propTypes={userSession:u.object.isRequired,isMobile:u.bool};Me.defaultProps={isMobile:!1};function mt({user:t,showAction:s=!0,showUser:n=!0,getUserSessions:o,showOffline:i=!1}){const a=K({status:"online",page:1,pageSize:10}),l=K({online:0,expired:0,offline:0}),p=yr(),{t:r}=D(),f=re({key:"md"}),m=xe(v=>v.breakpoints.down("lg")),{confirmApi:h,confirmHolder:w}=Re(),y=z(async()=>{const v=await o({page:a.page,pageSize:a.pageSize,status:a.status}),S=v?.paging?.total||0;return l[a.status]=S,{total:S,list:v?.list||[]}});et(async()=>{const v=await o({page:1,pageSize:1,status:"expired"});l.expired=v?.paging?.total||0;const S=await o({page:1,pageSize:1,status:"offline"});l.offline=S?.paging?.total||0});const c=te(y,{refreshDeps:[a.status,a.page,a.pageSize]}),g=M(()=>c.data?.list||[],[c.data?.list]),k=M(()=>{const{status:v}=a;return v==="online"?l[v]<=1:l[v]===0},[g,p]),T=M(()=>de({},f?Ke:{}),[f]),P=z(({visitorId:v})=>{h.open({title:r("userCenter.logoutThisSession"),content:r("userCenter.logoutThisSessionConfirm"),confirmButtonText:r("userCenter.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:r("userCenter.cancel"),onConfirm:async()=>{await F.user.logout({visitorId:v,includeFederated:!0});const{page:S=0}=a,{list:B=[]}=c.data||{},q=B.length||0;S>1&&q===1&&(a.page=Math.max(S-1,1)),c.refresh(),h.close()}})}),R=z(()=>{h.open({title:r("userCenter.logoutAllSession",{type:r(a.status)}),content:r("userCenter.logoutAllSessionConfirm",{type:r(a.status)}),confirmButtonText:r("userCenter.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:r("userCenter.cancel"),onConfirm:async()=>{await F.user.logout({status:a.status,visitorId:p,includeFederated:!0}),a.page=1,c.refresh(),h.close()}})}),$=[];s&&$.push(e.jsx(J,{title:r("userCenter.logoutAllTips",{type:r(a.status)}),children:e.jsx(G,{sx:{ml:.5},size:"small",variant:"contained",color:"error",onClick:R,disabled:k,children:r("userCenter.logoutAll",{type:r(a.status)})})},"logoutAll"));const C=M(()=>({search:!1,sort:!1,download:!1,filter:!1,print:!1,expandableRowsOnClick:!1,searchDebounceTime:600,page:a.page-1,rowsPerPage:a.pageSize,count:c.data?.total||0}),[c.data?.total,a.page,a.pageSize]),L=[{label:r("userCenter.platform"),name:"platform",options:{customBodyRenderLite:v=>{const S=g[v],B=Ge(S?.ua);return e.jsx(x,{sx:T,children:[B.os?.name,B.os?.version].filter(Boolean).join("/")||r("userCenter.unknown")})}}},{label:r("userCenter.deviceType"),name:"deviceType",options:{customBodyRenderLite:v=>{const S=g[v],B=Ge(S?.ua);return e.jsx(x,{sx:T,children:[B.browser?.name,B.browser?.version].filter(Boolean).join("/")||r("userCenter.unknown")})}}},{label:r("userCenter.walletOS"),name:"walletOS",options:{customBodyRenderLite:v=>{const S=g[v];return e.jsx(x,{sx:T,children:S.extra?.walletOS||r("userCenter.unknown")})}}},n&&{label:r("userCenter.user"),name:"user",options:{customBodyRenderLite:v=>{const S=g[v];return e.jsx(x,{sx:de({minWidth:150,maxWidth:250},f?Ke:{}),children:e.jsx(gt,{sessionUser:S.user,user:t})})}}},{label:r("userCenter.createdAt"),name:"createdAt",options:{customBodyRenderLite:v=>{const S=g[v];return e.jsx(x,{sx:T,children:S.createdAt?e.jsx(Ne,{value:S.createdAt,relativeRange:3*86400*1e3}):r("userCenter.unknown")})}}},!i&&{label:r("userCenter.updatedAt"),name:"updatedAt",options:{customBodyRenderLite:v=>{const S=g[v];return e.jsx(x,{sx:T,children:S.status==="expired"?r("userCenter.expired"):e.jsx(Ne,{value:S.updatedAt,relativeRange:3*86400*1e3})})}}},{label:r("userCenter.lastLoginIp"),name:"lastLoginIp",options:{customBodyRenderLite:v=>{const S=g[v];return e.jsx(Me,{userSession:S,isMobile:f})}}},s&&{label:r("userCenter.actions"),name:"actions",options:{customBodyRenderLite:v=>{const S=g[v];return e.jsx(x,{sx:T,children:e.jsx(G,{sx:{whiteSpace:"nowrap",fontSize:"12px !important",lineHeight:"1.25",px:1},disabled:p===S.visitorId,variant:"outlined",size:"small",color:"error",onClick:()=>P({visitorId:S.visitorId}),children:S.status==="expired"?r("userCenter.remove"):p===S.visitorId?r("userCenter.currentSession"):r("userCenter.logout")})})}}}].filter(Boolean);return e.jsxs(x,{className:"pc-user-sessions",sx:{maxWidth:f?"unset":m?"calc(100vw - 300px)":"100%",...f&&{".pc-user-sessions-table > div:nth-child(2)":{border:"1px solid",borderColor:"divider",borderRadius:1}},".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableRow-root":{border:"unset","&:nth-child(even)":{backgroundColor:"grey.50","&:hover":{backgroundColor:v=>`${v.palette.grey[50]} !important`}}},".MuiTableRow-hover":{"&:hover":{backgroundColor:"inherit !important"}},".MuiTableCell-root":{paddingRight:"8px",paddingLeft:"8px",color:"text.secondary",...f&&{padding:"8px !important","&:first-child":{paddingTop:"20px!important"},"&:last-child":{paddingBottom:"20px!important"}}}},children:[w,e.jsx(vr,{count:c.data?.total||0,data:g,columns:L,customButtons:$,options:C,loading:c.loading,className:"pc-user-sessions-table",title:e.jsxs(Dt,{row:!0,sx:{lineHeight:1,ml:1},onChange:v=>{a.status=v.target.value},children:[e.jsx(Z,{value:"online",control:e.jsx(ye,{size:"small",sx:{lineHeight:1,fontSize:0},checked:a.status==="online"}),label:e.jsxs(A,{sx:{display:"flex",alignItems:"center"},children:[r("userCenter.online"),e.jsxs(A,{component:"span",sx:{ml:.5,color:"text.secondary"},children:["(",l.online,")"]})]})}),e.jsx(Z,{value:"expired",control:e.jsx(ye,{size:"small",sx:{lineHeight:1,fontSize:0},checked:a.status==="expired"}),label:e.jsxs(A,{sx:{display:"flex",alignItems:"center"},children:[r("userCenter.expired"),e.jsxs(A,{component:"span",sx:{ml:.5,color:"text.secondary"},children:["(",l.expired,")"]})]})}),i?e.jsx(Z,{value:"offline",control:e.jsx(ye,{size:"small",sx:{lineHeight:1,fontSize:0},checked:a.status==="offline"}),label:e.jsxs(A,{sx:{display:"flex",alignItems:"center"},children:[r("userCenter.offline"),e.jsxs(A,{component:"span",sx:{ml:.5,color:"text.secondary"},children:["(",l.offline,")"]})]})}):null]}),onChange:v=>{a.page=v.page+1,a.pageSize=v.rowsPerPage}})]})}mt.propTypes={user:u.object.isRequired,showAction:u.bool,showUser:u.bool,showOffline:u.bool,getUserSessions:u.func.isRequired};function bt({onDestroySelf:t=void 0}){const{confirmHolder:s}=Re(),{t:n}=D(),{session:o}=b.use(fe),i=z(async()=>{if(!t||typeof t!="function")return;const a=o.withSecondaryAuth(t,{extraParams:{removeUserDid:o?.user?.did,input:{user:{did:o?.user?.did},teamDid:window?.blocklet?.did}},operation:"destroySelf"});try{await a(),o.logout()}catch(l){_.error(l?.message||n("userCenter.destroyMyself.error"))}});return e.jsxs(e.Fragment,{children:[e.jsx(x,{children:e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:1,justifyContent:"space-between",flexWrap:"wrap"},children:[e.jsxs(x,{children:[e.jsx(A,{variant:"h6",sx:{fontSize:"0.875rem !important",fontWeight:"bold"},children:n("userCenter.dangerZone.deleteAccount")}),e.jsx(A,{variant:"caption",sx:{color:"text.secondary"},children:n("userCenter.dangerZone.deleteAccountDescription")})]}),e.jsx(G,{variant:"contained",color:"error",size:"small",onClick:i,children:n("userCenter.dangerZone.delete")})]})}),s]})}bt.propTypes={onDestroySelf:u.func};function hn(){const t=re({key:"md"}),s=xe(i=>i.breakpoints.down("lg")),n={display:"flex",justifyContent:"flex-end",flexWrap:"wrap",textAlign:"right","&.expired-at > div":{maxWidth:160,justifyContent:"flex-end",flexWrap:"wrap"}},o=M(()=>de({},t?n:{}),[t]);return e.jsx(x,{id:"user-center-access-key-setting",sx:{maxWidth:t?"unset":s?"calc(100vw - 300px)":"100%",...t&&{".pc-access-key-table > div:nth-child(2)":{border:"1px solid",borderColor:"divider",borderRadius:1}},".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableRow-root":{border:"unset","&:nth-child(even)":{backgroundColor:"grey.50","&:hover":{backgroundColor:i=>`${i.palette.grey[50]} !important`}}},".MuiTableRow-hover":{"&:hover":{backgroundColor:"inherit !important"}},".MuiTableCell-root":{paddingRight:"8px",paddingLeft:"8px",color:"text.secondary",...t&&{padding:"8px !important","&:first-child":{paddingTop:"20px!important"},"&:last-child":{paddingBottom:"20px!important"}}}},children:e.jsx(Wr,{isSelf:!0,columnSx:o})})}function yt({onDestroySelf:t=void 0,userCenterTabs:s=[]}){const{t:n}=D(),{user:o,session:i,isMyself:a,isOwner:l}=Ae(),r=Te().arcSphere,f=re({key:"md"}),m=te(async()=>o&&a?await F.user.getUserPrivacyConfig({did:o.did}):null,{refreshDeps:[o,a],loadingDelay:300}),h=M(()=>s.map(c=>({key:c.value,name:c.label,value:c.protected,isPrivate:c.isPrivate})),[s]),w=z(async c=>c==="privacy"?(await m.runAsync(),m.data):(c==="profile"&&await i.refresh(),null));b.useEffect(()=>{const c=window.location.hash.slice(1);c&&document.getElementById(c)?.scrollIntoView({behavior:"smooth"})},[]);const y=M(()=>[r?void 0:{label:n("userCenter.commonSetting.title"),value:"common",content:e.jsx(ut,{user:o,onSave:w})},{label:n("userCenter.notificationManagement"),value:"notification",content:e.jsx(pt,{user:o,isMobile:f})},{label:n("userCenter.thirdPartyLogin.title"),value:"thirdPartyLogin",content:e.jsx(ft,{user:o})},{label:n("common.accessKeys"),value:"accessKeys",content:e.jsx(hn,{isSelf:!0})},{label:n("common.mcpServers"),value:"mcpServers",content:e.jsx(Lr,{})},{label:n("userCenter.privacyManagement"),value:"privacy",content:e.jsx(ht,{configList:h,onSave:w})},{label:n("userCenter.sessionManagement"),value:"session",content:e.jsx(mt,{user:o,showUser:!1,getUserSessions:c=>F.userSession.getMyLoginSessions({},c)})},!l&&t&&typeof t=="function"?{label:n("userCenter.dangerZone.title"),value:"dangerZone",content:e.jsx(bt,{onDestroySelf:t}),sx:{borderColor:"error.main"}}:null].filter(Boolean),[o,h,f,l,t]);return a?e.jsx(x,{sx:{display:"flex",flexDirection:"column",gap:2.5,minWidth:{md:500},maxWidth:"100%"},children:y.map(c=>c?e.jsxs(x,{id:c.value,sx:de({border:"1px solid",borderColor:"divider",borderRadius:1,p:2,"&:last-child":{mb:5}},c.sx),children:[e.jsx(A,{sx:{color:"text.primary",fontWeight:600},children:c.label}),e.jsx(x,{sx:{mt:2.5},children:c.content})]},c.value):null)}):null}yt.propTypes={onDestroySelf:u.func,userCenterTabs:u.array};const vt=b.createContext({}),{Provider:gn,Consumer:ho}=vt;function jt({children:t}){const[s]=b.useState(!1),{session:n}=b.use(fe),{user:o}=n,[i,a]=b.useState(),l=b.useMemo(()=>o?.didSpace?.endpoint,[o?.didSpace]);b.useEffect(()=>{a(o?.didSpace)},[o?.didSpace]);const p=async()=>{a(void 0)},r=h=>{},f=async h=>{a(h),await r(h.endpoint)},m=!!(l&&i);return e.jsx(gn,{value:{loading:s,spaceGateway:i,session:n,deleteSpaceGateway:p,updateSpaceGateway:f,storageEndpoint:l,settingStorageEndpoint:r,hasStorageEndpoint:m},children:t})}function Ee(){return b.use(vt)}jt.propTypes={children:u.node.isRequired};function mn(t){const s=t.replace(/\/api\/space\/.+/,""),o=t.replace(/\/$/,"").split("/").at(-4);return ce(s,"space",o)}function wt({session:t,spaceGateway:s,spaceStatus:n,refresh:o}){return e.jsxs(ke,{direction:"row",spacing:1,children:[n===Dr.DISCONNECTED&&e.jsx(ue,{reconnect:!0,variant:"outlined",session:t,spaceDid:t.user?.didSpace?.did,spaceGatewayUrl:t.user?.didSpace?.url,connectScope:"user",onSuccess:async()=>{await o()},onError:i=>{console.error(i),_.error(X(i))}}),e.jsx(O,{size:"small",LinkComponent:Nt,href:mn(s.endpoint),target:"_blank",children:e.jsx(Ot,{})})]})}wt.propTypes={session:u.object.isRequired,spaceGateway:u.object.isRequired,spaceStatus:u.string.isRequired,refresh:u.func.isRequired};function Ct({spaceGateway:t=void 0}){const{t:s}=D(),{updateSpaceGateway:n,session:o}=Ee(),i=re(),a=({spaceGateway:l})=>n(l);return e.jsxs(x,{sx:{display:"flex",flexDirection:"column"},children:[e.jsxs(x,{sx:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:"12px"},children:[e.jsx(A,{sx:{fontSize:"16px",fontWeight:"bold"},children:s("userCenter.storage.spaces.connected.title")}),!i&&e.jsx(ue,{connectScope:"user",session:o,onSuccess:a})]}),e.jsx(x,{children:t&&e.jsx(Nr,{endpoint:t.endpoint,deps:[t],selected:!0,footer:!0,action:l=>e.jsx(wt,{session:o,...l})},t.endpoint)}),i&&e.jsx(x,{sx:{display:"flex",alignItems:"center",justifyContent:"center",marginTop:2},children:e.jsx(ue,{connectScope:"user",session:o,onSuccess:a})})]})}Ct.propTypes={spaceGateway:u.object};function bn(){const{t}=D(),{updateSpaceGateway:s,session:n}=Ee(),o=({spaceGateway:i})=>s(i);return e.jsxs(x,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(A,{sx:{fontSize:"16px",fontWeight:"bold"},children:t("userCenter.storage.spaces.connect.providerForStorage")}),e.jsx(Or,{viewBox:"0 0 228 258",style:{width:"156px",height:"156px",margin:"16px 0"}}),e.jsx(x,{children:e.jsx(ue,{session:n,onSuccess:o})})]})}function yn(){const{spaceGateway:t,hasStorageEndpoint:s,loading:n}=Ee(),{isMyself:o}=Ae();return o?n?e.jsx($r,{relative:"parent",children:e.jsx(V,{})}):e.jsx(jn,{children:e.jsx(x,{sx:{maxWidth:"720px"},children:s?e.jsx(Ct,{spaceGateway:t}):e.jsx(bn,{})})}):null}function vn(){return e.jsx(jt,{children:e.jsx(yn,{})})}const jn=ee(x)`
|
|
122
|
-
height: 100%;
|
|
123
|
-
overflow-y: auto;
|
|
124
|
-
`;function go(){const{t}=D(),{api:s}=tr(),n=b.useRef(null),i=_t().tab,l=new URLSearchParams(window.location.search).get("embed")||window.sessionStorage?.getItem("embed"),p=rr(),r=M(()=>({...window.blocklet,meta:{did:window.blocklet.did,name:window.blocklet.did},children:window?.blocklet?.componentMountPoints.map(m=>({...m,meta:{...m,did:m.did,name:m.name||m.title||"",logo:"logo.png"}}))})),f=async m=>{const{input:h,sessionId:w}=m;try{await s.destroySelf({input:{...h,sessionId:w}})}catch(y){console.error("destroy myself error",y)}};return e.jsxs(e.Fragment,{children:[e.jsx(nr,{children:e.jsx("title",{children:t("pageTitle.userCenter")})}),e.jsx(Sr,{children:e.jsxs(zr,{ref:n,embed:l==="1",currentTab:i?ce(Pe.WELLKNOWN_SERVICE_PATH_PREFIX,"user",i):"",disableAutoRedirect:i==="settings",children:[i==="notifications"?e.jsx(on,{blocklets:[r],context:p}):null,i==="nfts"?e.jsx(un,{}):null,i==="settings"?e.jsx(yt,{onDestroySelf:f}):null,i==="did-spaces"?e.jsx(vn,{}):null]})})]})}export{go as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./vendor-mui-core-CcrDM-5l.js";import"./vendor-react-Dvs43sk9.js";import{S as t}from"./studio-Dg0TdHNU.js";import"./vendor-ux-Aiuoyn1t.js";import"./vendor-utils-BOkrEpKO.js";import"./vendor-hooks-DTeIFVkk.js";import"./lottie-web-4koyQiv_.js";import"./index-O5IErvL8.js";import"./index-ChbQ5IZK.js";import"./vendor-arcblock-BAR_xVfk.js";function f(){return o.jsx(t,{children:"Coming soon..."})}export{f as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e,d as o}from"./vendor-ux-Aiuoyn1t.js";const c=e("blocklet-services");o("blocklet-services");export{c as d};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as r}from"./vendor-mui-core-CcrDM-5l.js";import{W as o}from"./user-center-B5kWm-Hv.js";import{H as i}from"./index-ChbQ5IZK.js";import{T as e}from"./vendor-ux-Aiuoyn1t.js";import"./vendor-react-Dvs43sk9.js";import"./vendor-hooks-DTeIFVkk.js";import"./vendor-utils-BOkrEpKO.js";import"./index-g0GOIUzU.js";import"./arrow-down.svg-B7DowRKZ.js";import"./user-sessions-Dh05ZZ1r.js";import"./index-BCf6_SpY.js";import"./index-J8izjET5.js";import"./github-icon-CH2zo-td.js";import"./vendor-arcblock-BAR_xVfk.js";import"./index-COXPzb2c.js";import"./index-DRYJ0xIl.js";import"./index-BojVbZw0.js";import"./index-BbjQCNW8.js";import"./lottie-web-4koyQiv_.js";function R(){const{t}=e();return r.jsxs(r.Fragment,{children:[r.jsx(i,{children:r.jsx("title",{children:t("pageTitle.userCenter")})}),r.jsx(o,{onlyProfile:!0,currentTab:"",disableAutoRedirect:!0})]})}export{R as default};
|