@abtnode/blocklet-services 1.17.2 → 1.17.3-beta-20251117-102849-8103f298
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/middlewares/check-federated.js +1 -73
- package/api/routes/federated.js +10 -3
- package/api/services/auth/connect/verify-destroy.js +1 -0
- package/dist/assets/{AdapterDayjs-B04P6h7J.js → AdapterDayjs-CSsn7VEX.js} +1 -1
- package/dist/assets/{Google-CqFo2faB.js → Google-C-Ei9n0a.js} +1 -1
- package/dist/assets/{access-control-CjCxQlMu.js → access-control-D0vxk-Ay.js} +1 -1
- package/dist/assets/{actions-DqoNrBDK.js → actions-C0hEY5iN.js} +1 -1
- package/dist/assets/{add-component-core-C2S9QiqL.js → add-component-core-7Qng0h9D.js} +18 -18
- package/dist/assets/{add-resource-CuaLDI6L.js → add-resource-CS6pw4MD.js} +1 -1
- package/dist/assets/{addon-D41X7_Ha.js → addon-B5iZc5zB.js} +2 -2
- package/dist/assets/{advanced-DgrelCY3.js → advanced-QXzUapJI.js} +2 -2
- package/dist/assets/{aigne-Yr1coV9J.js → aigne-CviOmneT.js} +1 -1
- package/dist/assets/api-VWP7Oo6L.js +1 -0
- package/dist/assets/{appearance-DTPu5zPe.js → appearance-CkaT_h9I.js} +1 -1
- package/dist/assets/{arrow-down.svg-BIX16b-P.js → arrow-down.svg-CDi8ywws.js} +1 -1
- package/dist/assets/{audit-logs-ChufMFKS.js → audit-logs-D2VdqDH8.js} +2 -2
- package/dist/assets/{authorize-BvRxf82d.js → authorize-BJr_whxb.js} +1 -1
- package/dist/assets/{base-chart-C-Raz4Q-.js → base-chart-BIsPFns6.js} +1 -1
- package/dist/assets/{base32-CE_1-AN3.js → base32-cypJRki8.js} +1 -1
- package/dist/assets/bind-account-BCP_Ypfy.js +1 -0
- package/dist/assets/{branding-DbQznVYe.js → branding-B7OUNmDC.js} +1 -1
- package/dist/assets/branding-BDdxk2E2.js +1 -0
- package/dist/assets/{branding-C1ye6wGf.js → branding-wKKLyZjs.js} +5 -5
- package/dist/assets/{bundle-avatar-B1050zFo.js → bundle-avatar-Bft1K1fA.js} +1 -1
- package/dist/assets/button-DAumqZoi.js +1 -0
- package/dist/assets/{click-to-copy-BkU88dAD.js → click-to-copy-Kd1YilQn.js} +1 -1
- package/dist/assets/{cloneDeep-C6qewg0C.js → cloneDeep-3LGZOUYL.js} +1 -1
- package/dist/assets/{collapse-BMy0GGFk.js → collapse-Cc8IqFzl.js} +1 -1
- package/dist/assets/{complete-DZVVfX5P.js → complete-FhkNOVEb.js} +1 -1
- package/dist/assets/{component-CfrOI6i5.js → component-YEpcN0PM.js} +30 -30
- package/dist/assets/{config-CkNzsAXv.js → config-ABsyghax.js} +1 -1
- package/dist/assets/{config-D5LRMmb0.js → config-BH7esTqa.js} +1 -1
- package/dist/assets/config-CfZ5vdbi.js +57 -0
- package/dist/assets/{config-navigation-kBAhTt_z.js → config-navigation-C2Cya4Ts.js} +2 -2
- package/dist/assets/{config-space-GWPehdiS.js → config-space-k6_NPjjD.js} +1 -1
- package/dist/assets/{confirm-Cb7UwqYS.js → confirm-BWGQvLZx.js} +1 -1
- package/dist/assets/{connect-BXfNpVtu.js → connect-B1DJAH4e.js} +1 -1
- package/dist/assets/{connect-DL9YrliM.js → connect-DohcTFiY.js} +1 -1
- package/dist/assets/connect-to-BrFtlkBE.js +1 -0
- package/dist/assets/{content-layout-oyz1EqNZ.js → content-layout-DJL10aJT.js} +1 -1
- package/dist/assets/{create-passport-svg--kCsicWA.js → create-passport-svg-aTWV-cva.js} +1 -1
- package/dist/assets/createClass-sKvm4qit.js +1 -0
- package/dist/assets/{dashboard-Blst3P1q.js → dashboard-CuicHcGI.js} +2 -2
- package/dist/assets/{delete-confirm-oFx7NRBG.js → delete-confirm-DgdA8XR6.js} +1 -1
- package/dist/assets/{did-address-BeDbQEgo.js → did-address-B_YPBiI4.js} +1 -1
- package/dist/assets/domain-BeE_hgxW.js +9 -0
- package/dist/assets/domain-action-card-CBIJJCbh.js +28 -0
- package/dist/assets/domains-DgAenuDY.js +1 -0
- package/dist/assets/{email-AE87NO3k.js → email-Bn3hPH00.js} +1 -1
- package/dist/assets/{empty-spinner-DYOzicuy.js → empty-spinner-Dqkt-AHg.js} +1 -1
- package/dist/assets/engine-DH9sKH0j.js +1 -0
- package/dist/assets/{exchange-passport-Chzr6DQN.js → exchange-passport-3kSU2YMT.js} +1 -1
- package/dist/assets/{form-D_b_DG-x.js → form-MjxZB__D.js} +1 -1
- package/dist/assets/{form-text-input-C2U1m5ol.js → form-text-input-BhAqaNAJ.js} +1 -1
- package/dist/assets/{form-wrapper-C8oo_Fdy.js → form-wrapper-SZH1FnTd.js} +1 -1
- package/dist/assets/{fuel-C8FRHxLR.js → fuel-C5ze4Cx7.js} +2 -2
- package/dist/assets/{gen-access-key-DwnkD6OQ.js → gen-access-key-DKzPF3CU.js} +1 -1
- package/dist/assets/{gen-simple-access-key-D5wTuY1t.js → gen-simple-access-key-DTWz63Us.js} +1 -1
- package/dist/assets/get-safe-url-DEmvtN3J.js +1 -0
- package/dist/assets/{home-2prkME-Q.js → home-Bqn3mvqQ.js} +1 -1
- package/dist/assets/{iframe-DqyN02cu.js → iframe-CxCgprun.js} +1 -1
- package/dist/assets/index-B3O5tZNc.js +55 -0
- package/dist/assets/{index-BcWDbRWR.js → index-BCKWe_QR.js} +1 -1
- package/dist/assets/{index-D45OiFud.js → index-BPKZON9n.js} +7 -7
- package/dist/assets/{index-BK6jWBnR.js → index-BTBrooUu.js} +1 -1
- package/dist/assets/{index-D_MyW6is.js → index-BWszlIaS.js} +2 -2
- package/dist/assets/{index-Bkmh68gh.js → index-B_NniBaO.js} +1 -1
- package/dist/assets/{index-CDLNMKDM.js → index-Bero09ZY.js} +128 -126
- package/dist/assets/index-Bth96Xcv.js +7 -0
- package/dist/assets/{index-erLJSqBe.js → index-BwSFbkVa.js} +1 -1
- package/dist/assets/{index-D5TNmV3K.js → index-CAMegfIe.js} +1 -1
- package/dist/assets/{index-BjPh-7kQ.js → index-CI7en2_Z.js} +2 -2
- package/dist/assets/{index-CHnA2nN2.js → index-CNndXmIt.js} +1 -1
- package/dist/assets/{index-CkLEqkuR.js → index-CPJ0NzQN.js} +8 -8
- package/dist/assets/{index-0PQCgggo.js → index-CWQp0vgv.js} +1 -1
- package/dist/assets/{index-CIHjwyhW.js → index-CXA6Z-BW.js} +5 -5
- package/dist/assets/index-CZ4Y1y1j.js +120 -0
- package/dist/assets/{index-CA0pv3Uq.js → index-C_odLDQq.js} +13 -13
- package/dist/assets/{index-Dw-Z7YrL.js → index-CdA2hOvz.js} +1 -1
- package/dist/assets/{index-CiTIvXav.js → index-Clfe99AI.js} +1 -1
- package/dist/assets/{index-Ds523Kr4.js → index-D9bRGwyn.js} +1 -1
- package/dist/assets/{index-De-Vgsb6.js → index-DKuLdlGi.js} +1 -1
- package/dist/assets/{index-DEoXYS44.js → index-DUJ8lwX7.js} +10 -10
- package/dist/assets/index-DUiyqDLR.js +30 -0
- package/dist/assets/{index-DfxScG8C.js → index-Dgk0_7wf.js} +5 -5
- package/dist/assets/{index-DTf1TIHb.js → index-DlPcYWy3.js} +1 -1
- package/dist/assets/{index-BKvI-HQW.js → index-DnJ0ECmd.js} +1 -1
- package/dist/assets/{index-6DYfiGIi.js → index-OAcqMuQz.js} +2 -2
- package/dist/assets/{index-CHmNqpEJ.js → index-PwQ2doS3.js} +1 -1
- package/dist/assets/{index-DVeHusdz.js → index-VyLFO7R7.js} +4 -4
- package/dist/assets/{index-NomqB6Iy.js → index-WzLE1u-g.js} +1 -1
- package/dist/assets/index-bd0w0UHw.js +6 -0
- package/dist/assets/index-hKD4Miak.js +1 -0
- package/dist/assets/index-vci0NXIe.js +1 -0
- package/dist/assets/{invitation-BLXeyB9R.js → invitation-KNbJYWOf.js} +2 -2
- package/dist/assets/{invitations-DAbKE0z_.js → invitations-Di31zIeh.js} +1 -1
- package/dist/assets/{invite-nkH5yAFh.js → invite-Cq1bQR9j.js} +1 -1
- package/dist/assets/{isURL-B8QEuluM.js → isURL-RzSyCgzI.js} +2 -2
- package/dist/assets/{issue-passport-DHA-EFAO.js → issue-passport-DnHvhKR-.js} +1 -1
- package/dist/assets/{item-CjT9qBlP.js → item-DVQ8TUdv.js} +1 -1
- package/dist/assets/{landing-page-4maignTY.js → landing-page-BzztE6uh.js} +1 -1
- package/dist/assets/{launch-result-message-DWeUg9rM.js → launch-result-message-DZJ76kCs.js} +1 -1
- package/dist/assets/{layout-e6DMnPsI.js → layout-D4qCeoWb.js} +1 -1
- package/dist/assets/{list-DG5rE6en.js → list-BIECWQvk.js} +1 -1
- package/dist/assets/list-Dd8HkY3P.js +103 -0
- package/dist/assets/{list-header-BE2kzda_.js → list-header-BNFs7V0b.js} +1 -1
- package/dist/assets/localization-CCBoTGdU.js +1 -0
- package/dist/assets/{log-BUSdWhUD.js → log-Uj0MJfkC.js} +1 -1
- package/dist/assets/logger-D-AxDn18.js +1 -0
- package/dist/assets/login-DWAFC8kE.js +1 -0
- package/dist/assets/{login-oauth-callback-D958pJEU.js → login-oauth-callback-DB_9NuV_.js} +1 -1
- package/dist/assets/{logo-uploader-BBf1tYyb.js → logo-uploader-BaFwvDBA.js} +1 -1
- package/dist/assets/{lost-passport-C0Gat_y8.js → lost-passport-C2SpMW8x.js} +2 -2
- package/dist/assets/{observability-Zow0Sv-X.js → observability-BjKI3tFt.js} +1 -1
- package/dist/assets/{omit-hhiOJGRf.js → omit-BZEryV5a.js} +1 -1
- package/dist/assets/{open-window-BCPyuDbV.js → open-window-CVU9iEs4.js} +1 -1
- package/dist/assets/over-due-invoice-payment-CFwnz6K1.js +1 -0
- package/dist/assets/{overview-DDe_917X.js → overview-DpyqbS6x.js} +2 -2
- package/dist/assets/{page-header-DCvzRay5.js → page-header-xpG0yfsa.js} +1 -1
- package/dist/assets/passport-Bei4Q65O.js +1 -0
- package/dist/assets/{passport-item-CrqI8LZP.js → passport-item-Af9VCIFW.js} +1 -1
- package/dist/assets/{permission-CRiK9UiX.js → permission-bm6ygywx.js} +1 -1
- package/dist/assets/{playground-CAOOFQT1.js → playground-DKMlueFr.js} +1 -1
- package/dist/assets/preferences-lGhRntFn.js +1 -0
- package/dist/assets/profile-embed-JHxbEwL7.js +1 -0
- package/dist/assets/publish-resource-D19FmjtU.js +1 -0
- package/dist/assets/{react-beautiful-dnd.esm-BsXmsXbi.js → react-beautiful-dnd.esm-aD7p6S7F.js} +1 -1
- package/dist/assets/{react-stripe.esm-Dc9snvfb.js → react-stripe.esm-BV6kfV2w.js} +1 -1
- package/dist/assets/{required-BGaDOGrj.js → required-C9DLcn9T.js} +1 -1
- package/dist/assets/runtime-Kn_kNxXD.js +1 -0
- package/dist/assets/{sanitize-BEqBHa8a.js → sanitize-usZAK6S4.js} +1 -1
- package/dist/assets/sdk-C0BAXQzO.js +1 -0
- package/dist/assets/{section-C75bzkkL.js → section-MSasF4Cx.js} +1 -1
- package/dist/assets/{security-CDnrU-XX.js → security-DbLAyZY0.js} +1 -1
- package/dist/assets/{session-BDmvqOvc.js → session-jDtNo9RS.js} +1 -1
- package/dist/assets/{setup-Cju8Z063.js → setup-C5jTmWDG.js} +1 -1
- package/dist/assets/{shorten-label-RqvHqcC3.js → shorten-label-dRmYvYJ7.js} +1 -1
- package/dist/assets/{simple-select-DWI2SRq6.js → simple-select-CQxVe4SK.js} +1 -1
- package/dist/assets/{spaces-CNXRZTcd.js → spaces-V5-JD9i7.js} +1 -1
- package/dist/assets/{start-BBRJjidX.js → start-6JVejCmJ.js} +1 -1
- package/dist/assets/{starting-progress-D-1aLd8t.js → starting-progress-BYVwnaNc.js} +1 -1
- package/dist/assets/status-C9q9BOVN.js +1 -0
- package/dist/assets/{step-actions-CWp-NtsH.js → step-actions-C1GR4GhW.js} +1 -1
- package/dist/assets/{studio-B1WBQVRk.js → studio-DmcnkjTl.js} +1 -1
- package/dist/assets/{switch-control-BXLt-KrD.js → switch-control-CG7qdize.js} +1 -1
- package/dist/assets/{table-tips-CD2JCnV7.js → table-tips-CdXwFA3X.js} +1 -1
- package/dist/assets/team-PZ1SHeY3.js +146 -0
- package/dist/assets/traffic-Dh35q8G-.js +1 -0
- package/dist/assets/{transfer-8WkD_jUd.js → transfer-D3XcQgCt.js} +1 -1
- package/dist/assets/{unsubscribe-DVeiVKLX.js → unsubscribe-D-eN0zoM.js} +1 -1
- package/dist/assets/{use-app-logo-lNueneHC.js → use-app-logo-CMlvKxYW.js} +1 -1
- package/dist/assets/{use-mobile-DCNBsOlH.js → use-mobile-Bjbo_Gou.js} +1 -1
- package/dist/assets/{use-mobile-maRlSUwU.js → use-mobile-CjZIGfWP.js} +1 -1
- package/dist/assets/{use-server-logo-n_aaKVoZ.js → use-server-logo-uMEEt675.js} +1 -1
- package/dist/assets/use-window-close-Dmw6cTVQ.js +1 -0
- package/dist/assets/{useAsync-BcVLpt2E.js → useAsync-BT7wPXCF.js} +1 -1
- package/dist/assets/{useAsync-cZ_FPf9k.js → useAsync-D25sKCXL.js} +1 -1
- package/dist/assets/{useAsyncRetry-DwwEjrjs.js → useAsyncRetry-D-vTCNcS.js} +1 -1
- package/dist/assets/{useLocalStorage-E5ZXDlU2.js → useLocalStorage-BVI5Gy_v.js} +1 -1
- package/dist/assets/user-center-Cwsrx5yP.js +126 -0
- package/dist/assets/{user-follower-DLzUfaiE.js → user-follower-CaGHj3ZA.js} +1 -1
- package/dist/assets/{util-Bj9Es728.js → util-B-6GuSKY.js} +1 -1
- package/dist/assets/{util-CeZoM_ul.js → util-BsBRHu6F.js} +1 -1
- package/dist/assets/{vendor-arcblock-DrHS8FbJ.js → vendor-arcblock-B0VYnHWE.js} +115 -114
- package/dist/assets/{vendor-hooks-CjESGRlR.js → vendor-hooks-iFsOjihK.js} +1 -1
- package/dist/assets/{vendor-mui-core-CnXrAOs3.js → vendor-mui-core-BPcN1m8_.js} +1 -1
- package/dist/assets/{vendor-mui-x-bJ5idfMH.js → vendor-mui-x-DEgOZXst.js} +1 -1
- package/dist/assets/vendor-utils-D6HS5QsS.js +213 -0
- package/dist/assets/{vendor-ux-CzE32faw.js → vendor-ux-CheVAuK7.js} +10 -10
- package/dist/assets/{wait-connect-ySKEj_Ph.js → wait-connect-DyWyU1dI.js} +1 -1
- package/dist/assets/{wizard-sjepmmF5.js → wizard-CwvOHxpL.js} +1 -1
- package/dist/assets/{wizard-components-B1CGAMtl.js → wizard-components-Cu3iAFug.js} +1 -1
- package/dist/assets/wrap-locale-BLNR9__l.js +1 -0
- package/dist/assets/{zh-CUmZifBZ.js → zh-qs5i9EFZ.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/service-worker.js +1 -1
- package/package.json +50 -50
- package/dist/assets/api-Btn0Tp3W.js +0 -1
- package/dist/assets/bind-account-xMtYaPJ7.js +0 -1
- package/dist/assets/branding-C5BV6PKe.js +0 -1
- package/dist/assets/button-9QcssggO.js +0 -1
- package/dist/assets/config-DeWFFWZ4.js +0 -53
- package/dist/assets/connect-to-5xKcFhJq.js +0 -1
- package/dist/assets/createClass-D9-Z7Ng8.js +0 -1
- package/dist/assets/domain-BAz5Jnp3.js +0 -9
- package/dist/assets/domain-action-card-BPIGiyRz.js +0 -28
- package/dist/assets/domains-DzH4E7Ky.js +0 -1
- package/dist/assets/engine-CHbWdoYF.js +0 -1
- package/dist/assets/get-safe-url-mHb8MGmt.js +0 -1
- package/dist/assets/index-BFjPk5rY.js +0 -29
- package/dist/assets/index-C-PaVJtk.js +0 -1
- package/dist/assets/index-CGsJfc7B.js +0 -1
- package/dist/assets/index-CLdviW_b.js +0 -120
- package/dist/assets/index-YZ0yjUWt.js +0 -6
- package/dist/assets/index-dhiRVZZQ.js +0 -55
- package/dist/assets/index-heiIZy8r.js +0 -7
- package/dist/assets/list-B_m0p7sB.js +0 -103
- package/dist/assets/localization-Ds_U2GMW.js +0 -1
- package/dist/assets/logger-BsYh0hGr.js +0 -1
- package/dist/assets/login-ML7YmOtr.js +0 -1
- package/dist/assets/over-due-invoice-payment-BXBLnoyA.js +0 -1
- package/dist/assets/passport-Be2_BAlL.js +0 -1
- package/dist/assets/preferences-B8QM8HJG.js +0 -1
- package/dist/assets/profile-embed-Dkf-JFZx.js +0 -1
- package/dist/assets/publish-resource-DDAEroSI.js +0 -1
- package/dist/assets/runtime-Dx-xN_gK.js +0 -1
- package/dist/assets/sdk-DjGKLOyd.js +0 -1
- package/dist/assets/status-CK9xg7pT.js +0 -1
- package/dist/assets/team-CCbX1N7p.js +0 -146
- package/dist/assets/traffic-Bxkf9fJx.js +0 -1
- package/dist/assets/use-window-close-D8vmtt2d.js +0 -1
- package/dist/assets/user-center-BU_yo3ue.js +0 -126
- package/dist/assets/vendor-utils-cJEl_UEd.js +0 -213
- package/dist/assets/wrap-locale-cNkWnEw5.js +0 -1
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import{V as ee,H as B,a3 as X,ad as Ee,ae as Ue,af as We,ag as Ve,q as K,X as je,p as ke,n as z,ah as Me,x as _e,z as Ne,A as Ie}from"./vendor-ux-CheVAuK7.js";import{b as u,a as H,g as ie,c as $e}from"./vendor-hooks-iFsOjihK.js";import{r as C}from"./vendor-react-Dvs43sk9.js";import{j as e,ak as r,b6 as R,am as ce,y as O,z as F,Q as V,T as Y,I as le,a3 as oe,W as E,b1 as W,bb as qe,cb as Le,cE as He,at as Fe,D as ye,ah as Oe,cF as Be,a6 as be,cG as Je,a$ as Ze}from"./vendor-mui-core-BPcN1m8_.js";import{_ as N,ac as M,Y as G,be as se,c as ve,b8 as Ke,az as Ge,Z as Ye}from"./index-Bero09ZY.js";import{A as Z,Q as Qe,b as de,Z as Xe,n as Q,$ as et,C as tt,a as nt}from"./vendor-utils-D6HS5QsS.js";import{u as te,C as k,a as Ce}from"./index.esm-JPZAjt0x.js";import{S as re}from"./switch-control-CG7qdize.js";import{S as y}from"./section-MSasF4Cx.js";import{d as st}from"./keyboard-arrow-down-rounded-8U0_i9QO.js";import{u as ot}from"./index-BTBrooUu.js";import{v as it}from"./index-DlPcYWy3.js";import{r as rt}from"./base32-cypJRki8.js";import{C as at}from"./click-to-copy-Kd1YilQn.js";import{u as lt}from"./use-mobile-Bjbo_Gou.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-B0VYnHWE.js";import"./required-C9DLcn9T.js";const we={width:24,height:24,body:'<path fill="currentColor" d="M5 4v16V4v5v-5Zm3 10h2.675q.275-.575.638-1.075t.812-.925H8q-.425 0-.713.288T7 13q0 .425.288.713T8 14Zm0 4h2.075Q10 17.5 10 17t.075-1H8q-.425 0-.713.288T7 17q0 .425.288.713T8 18Zm-3 4q-.825 0-1.413-.588T3 20V4q0-.825.588-1.413T5 2h7.175q.4 0 .763.15t.637.425l4.85 4.85q.275.275.425.638t.15.762V10.3q-.475-.15-.975-.225T17 10V9h-4q-.425 0-.713-.288T12 8V4H5v16h5.675q.275.575.638 1.075t.812.925H5Zm12-10q2.075 0 3.538 1.463T22 17q0 2.075-1.463 3.538T17 22q-2.075 0-3.538-1.463T12 17q0-2.075 1.463-3.538T17 12Zm0 8q.275 0 .463-.188t.187-.462q0-.275-.187-.463T17 18.7q-.275 0-.463.188t-.187.462q0 .275.188.463T17 20Zm0-6q-.475 0-.875.238t-.65.637q-.1.15-.025.313t.25.237q.15.075.3 0t.275-.2q.125-.175.313-.275t.412-.1q.325 0 .563.213t.237.537q0 .275-.15.463t-.35.387q-.15.15-.313.3t-.287.35q-.075.15-.113.313t-.037.337q0 .225.125.413t.325.187q.2 0 .325-.15t.125-.35q0-.275.15-.488t.35-.412q.3-.275.525-.613t.225-.737q0-.675-.5-1.138T17 14Z"/>'},ue={enabled:!1,domain:"",clientId:"",clientSecret:""};function ct(){const{api:b}=N(),{blocklet:c}=M(),{t,locale:n}=ee(),o=c?.meta?.did,a=Object.assign({...ue},c?.settings?.oauth?.auth0||{}),{handleSubmit:x,control:i,formState:p,watch:d,reset:f}=te({defaultValues:Z(a,Object.keys(ue))}),l=d("enabled"),j=u(async s=>{try{const{blocklet:I}=await b.configOAuth({input:{did:o,oauth:JSON.stringify({auth0:s})}}),L=Object.assign({...ue},I?.settings?.oauth?.auth0||{});f(L),B.success(t("oauth.saveSuccess"))}catch(I){B.error(I.message||t("oauth.saveFailed"))}}),v=u(s=>s?.trim()?!0:t("oauth.auth0.domainDescription")),S=u(s=>s?.trim()?!0:t("oauth.auth0.clientIdDescription")),g=u(s=>s?.trim()?!0:t("oauth.auth0.clientSecretDescription")),w=u(()=>!0),h=H(()=>n==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-auth0":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-auth0",[n]);return e.jsx(r,{children:e.jsxs("form",{onSubmit:x(j),disabled:!0,children:[e.jsx(y,{title:e.jsxs(r,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx("span",{children:t("oauth.auth0.enable")}),e.jsx(ce,{title:t("oauth.viewDocument"),children:e.jsx(r,{component:"a",sx:{display:"inline-block",color:"inherit",fontSize:0,lineHeight:1},href:h,target:"_blank",rel:"noreferrer",children:e.jsx(X,{icon:we,fontSize:20})})})]}),mb:2.5,children:e.jsx(k,{name:"enabled",control:i,render:({field:s})=>e.jsx(R,{control:e.jsx(re,{sx:{ml:1},checked:s.value,...s})})})}),e.jsx(y,{title:t("oauth.auth0.domain"),children:e.jsx(k,{name:"domain",control:i,rules:{validate:l?v:w},render:({field:s})=>e.jsx(O,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.auth0.domain"),error:!!p.errors[s.name],helperText:p.errors[s.name]?.message||" ",disabled:!l})})})}),e.jsx(y,{title:t("oauth.auth0.clientId"),children:e.jsx(k,{name:"clientId",control:i,rules:{validate:l?S:w},render:({field:s})=>e.jsx(O,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.auth0.clientId"),error:!!p.errors[s.name],helperText:p.errors[s.name]?.message||" ",disabled:!l})})})}),e.jsx(y,{title:t("oauth.auth0.clientSecret"),children:e.jsx(k,{name:"clientSecret",control:i,rules:{validate:l?g:w},render:({field:s})=>e.jsx(O,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",type:"password",label:t("oauth.auth0.clientSecret"),error:!!p.errors[s.name],helperText:p.errors[s.name]?.message||" ",disabled:!l})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:x(j),disabled:!p.isDirty,children:t("oauth.save")})]})})}const he={enabled:!1,clientId:"",clientSecret:""};function dt(){const{api:b}=N(),{blocklet:c}=M(),{t,locale:n}=ee(),o=c?.meta?.did,a=Object.assign({...he},c?.settings?.oauth?.github||{}),{handleSubmit:x,control:i,formState:p,watch:d,reset:f}=te({defaultValues:Z(a,Object.keys(he))}),l=d("enabled"),j=u(async h=>{try{const{blocklet:s}=await b.configOAuth({input:{did:o,oauth:JSON.stringify({github:h})}}),I=Object.assign({...he},s?.settings?.oauth?.github||{});f(I),B.success(t("oauth.saveSuccess"))}catch(s){B.error(s.message||t("oauth.saveFailed"))}}),v=u(h=>h?.trim()?!0:t("oauth.github.clientIdDescription")),S=u(h=>h?.trim()?!0:t("oauth.github.clientSecretDescription")),g=u(()=>!0),w=H(()=>n==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-github":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-github",[n]);return e.jsx(r,{children:e.jsxs("form",{onSubmit:x(j),disabled:!0,children:[e.jsx(y,{title:e.jsxs(r,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx("span",{children:t("oauth.github.enable")}),e.jsx(ce,{title:t("oauth.viewDocument"),children:e.jsx(r,{component:"a",sx:{display:"inline-block",color:"inherit",fontSize:0,lineHeight:1},href:w,target:"_blank",rel:"noreferrer",children:e.jsx(X,{icon:we,fontSize:20})})})]}),mb:2.5,sx:{"& .section-content":{alignItems:"center"}},children:e.jsx(k,{name:"enabled",control:i,sx:{alignItems:"center"},render:({field:h})=>e.jsx(R,{control:e.jsx(re,{sx:{ml:1},size:"small",checked:h.value,...h})})})}),e.jsx(y,{title:t("oauth.github.clientId"),children:e.jsx(k,{name:"clientId",control:i,rules:{validate:l?v:g},render:({field:h})=>e.jsx(O,{fullWidth:!0,children:e.jsx(F,{...h,size:"small",label:t("oauth.github.clientId"),error:!!p.errors[h.name],helperText:p.errors[h.name]?.message||" ",disabled:!l})})})}),e.jsx(y,{title:t("oauth.github.clientSecret"),children:e.jsx(k,{name:"clientSecret",control:i,rules:{validate:l?S:g},render:({field:h})=>e.jsx(O,{fullWidth:!0,children:e.jsx(F,{...h,size:"small",type:"password",label:t("oauth.github.clientSecret"),error:!!p.errors[h.name],helperText:p.errors[h.name]?.message||" ",disabled:!l})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:x(j),disabled:!p.isDirty,children:t("oauth.save")})]})})}const me={enabled:!1,clientId:"",clientSecret:""};function ut(){const{api:b}=N(),{blocklet:c}=M(),{t,locale:n}=ee(),o=c?.meta?.did,a=Object.assign({...me},c?.settings?.oauth?.google||{}),{handleSubmit:x,control:i,formState:p,watch:d,reset:f}=te({defaultValues:Z(a,Object.keys(me))}),l=d("enabled"),j=u(async h=>{try{const{blocklet:s}=await b.configOAuth({input:{did:o,oauth:JSON.stringify({google:h})}}),I=Object.assign({...me},s?.settings?.oauth?.google||{});f(I),B.success(t("oauth.saveSuccess"))}catch(s){B.error(s.message||t("oauth.saveFailed"))}}),v=u(h=>h?.trim()?!0:t("oauth.google.clientIdDescription")),S=u(h=>h?.trim()?!0:t("oauth.google.clientSecretDescription")),g=u(()=>!0),w=H(()=>n==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-google":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-google",[n]);return e.jsx(r,{children:e.jsxs("form",{onSubmit:x(j),disabled:!0,children:[e.jsx(y,{title:e.jsxs(r,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx("span",{children:t("oauth.google.enable")}),e.jsx(ce,{title:t("oauth.viewDocument"),children:e.jsx(r,{component:"a",sx:{display:"inline-block",color:"inherit",fontSize:0,lineHeight:1},href:w,target:"_blank",rel:"noreferrer",children:e.jsx(X,{icon:we,fontSize:20})})})]}),mb:2.5,children:e.jsx(k,{name:"enabled",control:i,render:({field:h})=>e.jsx(R,{control:e.jsx(re,{sx:{ml:1},checked:h.value,...h})})})}),e.jsx(y,{title:t("oauth.google.clientId"),children:e.jsx(k,{name:"clientId",control:i,rules:{validate:l?v:g},render:({field:h})=>e.jsx(O,{fullWidth:!0,children:e.jsx(F,{...h,size:"small",label:t("oauth.google.clientId"),error:!!p.errors[h.name],helperText:p.errors[h.name]?.message||" ",disabled:!l})})})}),e.jsx(y,{title:t("oauth.google.clientSecret"),children:e.jsx(k,{name:"clientSecret",control:i,rules:{validate:l?S:g},render:({field:h})=>e.jsx(O,{fullWidth:!0,children:e.jsx(F,{...h,size:"small",type:"password",label:t("oauth.google.clientSecret"),error:!!p.errors[h.name],helperText:p.errors[h.name]?.message||" ",disabled:!l})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:x(j),disabled:!p.isDirty,children:t("oauth.save")})]})})}const pe={enabled:!1,teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function ht(){const{api:b}=N(),{blocklet:c}=M(),{t}=ee(),n=c?.meta?.did,o=Object.assign({...pe},c?.settings?.oauth?.apple||{}),{handleSubmit:a,control:x,formState:i,watch:p,reset:d}=te({defaultValues:Z(o,Object.keys(pe))}),f=p("enabled"),l=u(async s=>{try{const{blocklet:I}=await b.configOAuth({input:{did:n,oauth:JSON.stringify({apple:s})}}),L=Object.assign({...pe},I?.settings?.oauth?.apple||{});d(L),B.success(t("oauth.saveSuccess"))}catch(I){B.error(I.message||t("oauth.saveFailed"))}}),j=u(s=>s?.trim()?!0:t("oauth.apple.teamIdDescription")),v=u(s=>s?.trim()?!0:t("oauth.apple.serviceIdDescription")),S=u(s=>s?.trim()?!0:t("oauth.apple.keyIdDescription")),g=u(s=>s?.trim()?!0:t("oauth.apple.authKeyDescription")),w=u(s=>s?.trim()?!0:t("oauth.apple.bundleIdDescription")),h=u(()=>!0);return e.jsx(r,{children:e.jsxs("form",{onSubmit:a(l),disabled:!0,children:[e.jsx(y,{title:t("oauth.apple.enable"),mb:2.5,children:e.jsx(k,{name:"enabled",control:x,render:({field:s})=>e.jsx(R,{control:e.jsx(re,{sx:{ml:1},checked:s.value,...s})})})}),e.jsx(y,{title:t("oauth.apple.teamId"),children:e.jsx(k,{name:"teamId",control:x,rules:{validate:f?j:h},render:({field:s})=>e.jsx(O,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.apple.teamId"),error:!!i.errors[s.name],helperText:i.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.apple.bundleId"),children:e.jsx(k,{name:"bundleId",control:x,rules:{validate:f?w:h},render:({field:s})=>e.jsx(O,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.apple.bundleId"),error:!!i.errors[s.name],helperText:i.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.apple.serviceId"),children:e.jsx(k,{name:"serviceId",control:x,rules:{validate:f?v:h},render:({field:s})=>e.jsx(O,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.apple.serviceId"),error:!!i.errors[s.name],helperText:i.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.apple.keyId"),children:e.jsx(k,{name:"keyId",control:x,rules:{validate:f?S:h},render:({field:s})=>e.jsx(O,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.apple.keyId"),error:!!i.errors[s.name],helperText:i.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.apple.authKey"),children:e.jsx(k,{name:"authKey",control:x,rules:{validate:f?g:h},render:({field:s})=>e.jsx(O,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",type:"password",label:t("oauth.apple.authKey"),multiline:!0,rows:4,error:!!i.errors[s.name],helperText:i.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:a(l),disabled:!i.isDirty,children:t("oauth.save")})]})})}const xe={enabled:!1,clientId:"",clientSecret:""};function mt(){const{api:b}=N(),{blocklet:c}=M(),{t}=ee(),n=c?.meta?.did,o=Object.assign({...xe},c?.settings?.oauth?.twitter||{}),{handleSubmit:a,control:x,formState:i,watch:p,reset:d}=te({defaultValues:Z(o,Object.keys(xe))}),f=p("enabled"),l=u(async g=>{try{const{blocklet:w}=await b.configOAuth({input:{did:n,oauth:JSON.stringify({twitter:g})}}),h=Object.assign({...xe},w?.settings?.oauth?.twitter||{});d(h),B.success(t("oauth.saveSuccess"))}catch(w){B.error(w.message||t("oauth.saveFailed"))}}),j=u(g=>g?.trim()?!0:t("oauth.twitter.clientIdDescription")),v=u(g=>g?.trim()?!0:t("oauth.twitter.clientSecretDescription")),S=u(()=>!0);return e.jsx(r,{children:e.jsxs("form",{onSubmit:a(l),disabled:!0,children:[e.jsx(y,{title:e.jsx(r,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsx("span",{children:t("oauth.twitter.enable")})}),mb:2.5,sx:{"& .section-content":{alignItems:"center"}},children:e.jsx(k,{name:"enabled",control:x,sx:{alignItems:"center"},render:({field:g})=>e.jsx(R,{control:e.jsx(re,{sx:{ml:1},size:"small",checked:g.value,...g})})})}),e.jsx(y,{title:t("oauth.twitter.clientId"),children:e.jsx(k,{name:"clientId",control:x,rules:{validate:f?j:S},render:({field:g})=>e.jsx(O,{fullWidth:!0,children:e.jsx(F,{...g,size:"small",label:t("oauth.twitter.clientId"),error:!!i.errors[g.name],helperText:i.errors[g.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.twitter.clientSecret"),children:e.jsx(k,{name:"clientSecret",control:x,rules:{validate:f?v:S},render:({field:g})=>e.jsx(O,{fullWidth:!0,children:e.jsx(F,{...g,size:"small",type:"password",label:t("oauth.twitter.clientSecret"),error:!!i.errors[g.name],helperText:i.errors[g.name]?.message||" ",disabled:!f})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:a(l),disabled:!i.isDirty,children:t("oauth.save")})]})})}const pt={width:24,height:24,body:'<path fill="currentColor" d="M9 20q-.825 0-1.413-.588T7 18q0-.825.588-1.413T9 16q.825 0 1.413.588T11 18q0 .825-.588 1.413T9 20Zm6 0q-.825 0-1.413-.588T13 18q0-.825.588-1.413T15 16q.825 0 1.413.588T17 18q0 .825-.588 1.413T15 20Zm-6-6q-.825 0-1.413-.588T7 12q0-.825.588-1.413T9 10q.825 0 1.413.588T11 12q0 .825-.588 1.413T9 14Zm6 0q-.825 0-1.413-.588T13 12q0-.825.588-1.413T15 10q.825 0 1.413.588T17 12q0 .825-.588 1.413T15 14ZM9 8q-.825 0-1.413-.588T7 6q0-.825.588-1.413T9 4q.825 0 1.413.588T11 6q0 .825-.588 1.413T9 8Zm6 0q-.825 0-1.413-.588T13 6q0-.825.588-1.413T15 4q.825 0 1.413.588T17 6q0 .825-.588 1.413T15 8Z"/>'};function Re({id:b,title:c,children:t,index:n,onMove:o,defaultExpand:a=!1,onEnd:x,icon:i=null}){const[p,d]=C.useState(a),f=C.useRef(null),l=C.useRef(null),[{handlerId:j},v]=Ee({accept:"dragItem",collect(s){return{handlerId:s.getHandlerId()}},hover(s,I){if(!f.current)return;const L=s.index,m=n;if(L===m)return;const A=f.current?.getBoundingClientRect(),_=l.current?.getBoundingClientRect(),ae=(_.bottom-_.top)/2,$=I.getClientOffset().y-A.top;L<m&&$<ae||L>m&&$>ae||(o(L,m),s.index=m)}}),[{isDragging:S},g]=Ue({item:{index:n,type:"dragItem"},collect:s=>({isDragging:s.isDragging()}),end:x});g(l),v(f);const w=S?.5:1,h=u(s=>{s.preventDefault(),s.stopPropagation(),d(!p)});return e.jsxs(r,{ref:f,children:[e.jsxs(r,{sx:{cursor:"pointer","&:hover":{backgroundColor:"grey.100"}},ref:l,"data-handler-id":j,children:[e.jsxs(r,{sx:{py:2,px:1,opacity:w,display:"flex",alignItems:"center",gap:.5},draggable:!1,onClick:h,children:[e.jsx(r,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:"text.hint","&:hover":{color:"text.secondary"}},children:e.jsx(X,{fontSize:20,icon:pt})}),e.jsx(r,{sx:{display:"flex",alignItems:"center",flexShrink:0,mr:.5,transform:"translateY(-1px)"},children:i}),e.jsx(Y,{sx:{flex:1},children:c}),e.jsx(le,{size:"small",sx:{pointerEvents:"auto",transform:p?"":"rotate(180deg)",transition:"transform 0.3s ease"},children:e.jsx(X,{icon:st,style:{transform:"scale(1.5)"}})})]}),e.jsx(oe,{})]}),e.jsx(r,{sx:{pl:4,py:2.5,display:p?"block":"none"},children:t})]})}Re.propTypes={title:E.string.isRequired,id:E.string.isRequired,children:E.node.isRequired,index:E.number.isRequired,onMove:E.func.isRequired,onEnd:E.func.isRequired,defaultExpand:E.bool,icon:E.any};const xt=[{name:"github",title:G.PROVIDER_NAME.github,icon:e.jsx(se,{provider:"github",sx:{width:20,height:20}}),component:e.jsx(dt,{})},{name:"google",title:G.PROVIDER_NAME.google,icon:e.jsx(se,{provider:"google",sx:{width:20,height:20}}),component:e.jsx(ut,{})},{name:"apple",title:G.PROVIDER_NAME.apple,icon:e.jsx(se,{provider:"apple",sx:{width:20,height:20}}),component:e.jsx(ht,{})},{name:"twitter",title:G.PROVIDER_NAME.twitter,icon:e.jsx(se,{provider:"twitter",sx:{width:20,height:20}}),component:e.jsx(mt,{})},{name:"auth0",title:G.PROVIDER_NAME.auth0,icon:e.jsx(se,{provider:"auth0",sx:{width:20,height:20}}),component:e.jsx(ct,{})}],ft=["github","google","apple","twitter","auth0"];function gt(){const{api:b}=N(),{blocklet:c}=M(),t=c?.meta?.did,n=c?.settings?.oauth||{},o=Object.keys(n).sort((l,j)=>n[l]?.order!==void 0&&n[j]?.order!==void 0?n[l].order-n[j].order:n[l]?.order!==void 0?-1:1);for(const l of ft)o.includes(l)||o.push(l);const a=ie(o.reduce((l,j,v)=>Object.assign(l,{[j]:v}),{})),x=H(()=>{const l=[...xt];return l.sort((j,v)=>a[j.name]-a[v.name]),l.map(j=>({...j,enabled:n[j.name]?.enabled??!1}))},[a.auth0,a.github,a.google]),i={};typeof window<"u"&&(i.context=window);const p=u(async l=>{const j={};Object.keys(l).forEach(v=>{j[v]={order:l[v]}}),await b.configOAuth({input:{did:t,oauth:JSON.stringify(j)}})}),d=u((l,j)=>{const v=x[l],S=x[j];a[v.name]=j,a[S.name]=l}),f=u(async()=>{await p(a)});return e.jsx(r,{sx:{".section-left":{width:"180px"}},children:e.jsx(We,{backend:Ve,...i,children:x.map((l,j)=>e.jsx(Re,{index:j,id:l.name,title:l.title,icon:l.icon,onMove:d,onEnd:f,defaultExpand:l.enabled,children:l.component},l.name))})})}const J={ttl:ve.SESSION_TTL,cacheTtl:ve.SESSION_CACHE_TTL,email:{enabled:!1,requireVerified:!1,requireUnique:!1,trustOauthProviders:!1,trustedIssuers:[],enableDomainBlackList:!1,domainBlackList:[],enableDomainWhiteList:!1,domainWhiteList:[]},phone:{enabled:!1,requireVerified:!1,requireUnique:!1,regionBlackList:[],trustedIssuers:[]},enableBlacklist:!1};function U(b){return e.jsx(ot,{...b,sx:{transform:"scale(0.75)"}})}function fe(b,c=!1){const t=c?b.ttl*86400:b.ttl/86400;return{...b,ttl:t}}function jt(){const{api:b}=N(),{blocklet:c}=M(),t=c?.meta?.did,n=Qe({},J,c?.settings?.session||{});de(n.ttl)&&(n.ttl=J.ttl),de(n.cacheTtl)&&(n.cacheTtl=J.cacheTtl),n.phone||(n.phone=J.phone),n.email||(n.email=J.email),de(n.enableBlacklist)&&(n.enableBlacklist=J.enableBlacklist);const{handleSubmit:o,control:a,formState:x,reset:i,watch:p}=te({defaultValues:Z(fe(n),["ttl","cacheTtl","email","phone","enableBlacklist"])}),{t:d}=ee(),f=p("email.enabled"),l=p("phone.enabled"),j=p("email.enableDomainBlackList"),v=p("email.enableDomainWhiteList"),{fields:S,append:g,remove:w}=Ce({control:a,name:"email.domainBlackList"}),{fields:h,append:s,remove:I}=Ce({control:a,name:"email.domainWhiteList"}),L=u(async m=>{try{const{blocklet:A}=await b.updateAppSessionConfig({input:{did:t,config:Xe(fe(m,!0),["phone"])}}),_=Object.assign({},J,Z(A?.settings?.session||{},["ttl","cacheTtl","email","phone","enableBlacklist"]));i(fe(_)),B.success(d("common.configSuccess"))}catch(A){B.error(A.message)}});return e.jsx(bt,{onSubmit:o(L),children:e.jsxs(W,{direction:"column",sx:{gap:6},children:[e.jsxs(r,{children:[e.jsxs(r,{children:[e.jsx(Y,{variant:"h6",sx:{fontWeight:600},children:d("blocklet.config.session.profile")}),e.jsx(r,{component:oe,sx:{my:3}})]}),e.jsxs(W,{sx:{gap:2},children:[e.jsx(y,{title:d("blocklet.config.session.fullNameEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(r,{sx:{alignSelf:"flex-start"},children:e.jsx(U,{disabled:!0,checked:!0})})}),e.jsx(y,{title:d("blocklet.config.session.avatarEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(r,{sx:{alignSelf:"flex-start"},children:e.jsx(U,{disabled:!0,checked:!0})})}),e.jsx(y,{title:d("blocklet.config.session.emailEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(r,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.enabled",control:a,render:({field:m})=>e.jsx(U,{...m,checked:m.value})})})}),f&&e.jsxs(W,{direction:"column",sx:{ml:2,gap:.5},children:[e.jsx(y,{title:d("blocklet.config.session.emailRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(r,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.requireVerified",control:a,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),e.jsx(y,{title:d("blocklet.config.session.emailRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(r,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.requireUnique",control:a,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),e.jsx(y,{title:d("blocklet.config.session.emailTrustOauthProviders"),sectionLeftSx:{width:"600px"},children:e.jsx(r,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.trustOauthProviders",control:a,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),e.jsx(y,{title:d("blocklet.config.session.enableDomainBlackList"),sectionLeftSx:{width:"600px"},children:e.jsx(r,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.enableDomainBlackList",control:a,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),j&&e.jsxs(r,{children:[S.map((m,A)=>e.jsxs(W,{direction:"row",sx:{alignItems:"center",my:1,maxWidth:"720px"},children:[e.jsx(k,{name:`email.domainBlackList.${A}`,control:a,render:_=>e.jsx(F,{..._.field,size:"small",fullWidth:!0})}),e.jsx(le,{onClick:()=>w(A),children:e.jsx(qe,{})})]},m.id)),e.jsx(V,{startIcon:e.jsx(Le,{}),onClick:()=>g(""),children:d("blocklet.config.session.addDomain")})]}),e.jsx(y,{title:d("blocklet.config.session.enableDomainWhiteList"),sectionLeftSx:{width:"600px"},children:e.jsx(r,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.enableDomainWhiteList",control:a,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),v&&e.jsxs(r,{children:[h.map((m,A)=>e.jsxs(W,{direction:"row",sx:{alignItems:"center",my:1,maxWidth:"720px"},children:[e.jsx(k,{name:`email.domainWhiteList.${A}`,control:a,render:_=>e.jsx(F,{..._.field,size:"small",fullWidth:!0})}),e.jsx(le,{onClick:()=>I(A),children:e.jsx(qe,{})})]},m.id)),e.jsx(V,{startIcon:e.jsx(Le,{}),onClick:()=>s(""),children:d("blocklet.config.session.addDomain")})]})]}),e.jsxs(r,{sx:{display:"none"},children:[e.jsx(y,{title:d("blocklet.config.session.phoneEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(r,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"phone.enabled",control:a,disabled:!0,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),l&&e.jsxs(W,{direction:"column",sx:{ml:2,mt:1},children:[e.jsx(y,{title:d("blocklet.config.session.phoneRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(r,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"phone.requireVerified",control:a,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),e.jsx(y,{title:d("blocklet.config.session.phoneRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(r,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"phone.requireUnique",control:a,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})})]})]})]})]}),e.jsxs(r,{children:[e.jsx(Y,{variant:"h6",sx:{fontWeight:600},children:d("blocklet.config.session.period")}),e.jsx(r,{component:oe,sx:{my:3}}),e.jsx(W,{direction:"column",spacing:2,children:e.jsx(k,{name:"ttl",control:a,rules:{min:1,max:30},render:({field:m})=>e.jsx(O,{fullWidth:!0,sx:{mb:2},children:e.jsx(y,{title:d("blocklet.config.session.ttl",{day:m.value}),sectionLeftSx:{width:"600px"},children:e.jsx(r,{sx:{width:"100%",maxWidth:500,px:2},children:e.jsx(He,{...m,defaultValue:7,step:1,marks:[{value:1,label:d("blocklet.config.session.day",{day:1})},{value:7,label:d("blocklet.config.session.days",{day:7})},{value:14,label:d("blocklet.config.session.days",{day:14})},{value:21,label:d("blocklet.config.session.days",{day:21})},{value:30,label:d("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto"})})})})})})]}),e.jsxs(r,{children:[e.jsx(Y,{variant:"h6",sx:{fontWeight:600},children:d("blocklet.config.session.experimentalSettings")}),e.jsx(r,{component:oe,sx:{my:3}}),e.jsx(W,{direction:"column",spacing:2,children:e.jsx(y,{title:d("blocklet.config.session.enableBlacklist"),sectionLeftSx:{width:"600px"},children:e.jsx(r,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"enableBlacklist",control:a,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})})})]}),e.jsx(r,{children:e.jsx(V,{type:"submit",variant:"contained",disabled:!x.isDirty,children:d("oauth.save")})})]})})}const bt=Fe.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
|
+
${b=>b.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
|
+
`,vt={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 ge,De;function kt(){if(De)return ge;De=1;const{DEFAULT_IP_DOMAIN_SUFFIX:b,SLOT_FOR_IP_DNS_SITE:c,DEFAULT_DID_DOMAIN:t}=Ke(),{encode:n}=rt();return ge={getIpDnsDomainForBlocklet:x=>`${n(x.meta.did)}-${c}.${b}`,getDidDomainForBlocklet:({did:x,didDomain:i=t})=>`${n(x)}.${i}`},ge}var yt=kt();function Ae({ref:b=null}){const{t:c}=C.useContext(K),{blocklet:t}=M(),{api:n}=N(),o=ie({loadingReject:!1,loadingApprove:!1,mode:"view",show:!1,data:{},callback:Q}),x=ye()?.transitions?.duration?.leavingScreen||300,i=u(()=>{o.mode="view",o.data={},o.callback=Q}),p=u(()=>{o.show=!1,setTimeout(()=>{i()},x)}),d=u(g=>{o.mode="view",o.show=!0,o.data=g}),f=u((g,w=Q)=>{o.mode="approve",o.show=!0,o.data=g,o.callback=w});C.useImperativeHandle(b,()=>({open:d,close:p,approve:f}),[d,p,f]);const l=H(()=>{if(!o.show)return[];o.data.migratedFrom=[o.data.appId,o.data.appPid];const g=["appName","appLogo","appId","appPid","migratedFrom","appDescription","appUrl","version","appliedAt","status","serverId","serverVersion"];return o.data.isMaster!==!1&&et(g,"appliedAt","status"),g.map(w=>{const h=c(`federated.info.${w}`);let s=o.data[w];if(w==="appName"&&o.data.isMaster&&(s=e.jsxs(r,{children:[e.jsx(Oe,{component:Be}),s]})),["appId","appPid","serverId"].includes(w)&&(s=e.jsx(je,{children:s})),["appUrl"].includes(w)&&(s=e.jsx(r,{component:"a",href:s,target:"_blank",children:s})),["appLogo"].includes(w)){const I=tt(`https://${yt.getDidDomainForBlocklet({did:o.data.appPid})}`,ve.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo");try{const L=new URL(I);L.searchParams.set("imageFilter","resize"),L.searchParams.set("w","80"),L.searchParams.set("h","80"),s=e.jsx("img",{src:L.href,width:"60",height:"60",alt:o.data.appName})}catch{s=e.jsx("img",{src:I,width:"60",height:"60",alt:o.data.appName})}}return w==="status"&&(s=s&&c(`federated.status.${s}`)),w==="migratedFrom"&&(s=(o.data.migratedFrom||[]).filter(m=>![o.data.appId,o.data.appPid].includes(m)).map(m=>e.jsx(je,{children:m}))),nt(s)&&(s="-"),{name:h,value:s}})},[o.data]),j=o.mode==="approve",v=u(async()=>{try{o.loadingReject=!0,await n.auditFederatedLogin({input:{memberPid:o.data.appPid,did:t.appPid,status:"rejected"}}),p(),o?.callback(!1)}finally{o.loadingReject=!1}}),S=u(async()=>{try{o.loadingApprove=!0,await n.auditFederatedLogin({input:{memberPid:o.data.appPid,did:t.appPid,status:"approved"}}),p(),o?.callback(!0)}finally{o.loadingApprove=!1}});return e.jsx(ke,{open:o.show,title:c(j?"federated.approveToJoinLogin":"federated.siteDetail"),onClose:p,actions:j?e.jsxs(e.Fragment,{children:[e.jsxs(V,{color:"error",variant:"contained",onClick:v,disabled:o.loadingReject,children:[o.loadingReject?e.jsx(be,{size:16,color:"grey"}):null,c("common.reject")]}),e.jsxs(V,{variant:"contained",onClick:S,disabled:o.loadingApprove,children:[o.loadingApprove?e.jsx(be,{size:16,color:"grey"}):null,c("common.approve")]})]}):e.jsx(V,{variant:"outlined",onClick:p,children:c("common.close")}),children:l.map(g=>e.jsx(it,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:180,name:g.name,children:g.value},g.name))})}Ae.propTypes={ref:E.any};function Se({ref:b=null}){const t=ye()?.transitions?.duration?.leavingScreen||300,{t:n}=C.useContext(K),o=ie({show:!1,data:{link:""}}),a=u(()=>{o.data.link=""}),x=u(()=>{o.show=!1,setTimeout(()=>{a()},t)}),i=u(({link:d})=>{o.show=!0,o.data.link=d});C.useImperativeHandle(b,()=>({open:i,close:x}),[i,x]);const p=u(()=>{$e(o.data.link),x()});return e.jsxs(ke,{open:o.show,title:n("federated.joinFederatedLogin"),onClose:x,PaperProps:{style:{minHeight:"unset"}},actions:e.jsx(z,{color:"primary",autoFocus:!0,variant:"contained",onClick:p,children:n("common.copyAndClose")}),children:[e.jsx(r,{sx:{mb:2},children:n("federated.inviteJoinFederatedLoginDescription")}),e.jsx(r,{sx:{"& .copy-button":{display:"none !important"}},children:e.jsx(at,{children:o.data.link})})]})}Se.propTypes={ref:E.any};function Pe({mode:b="member"}){const c=C.useRef(null),t=C.useRef(null),{t:n,locale:o}=C.useContext(K),{blocklet:a,actions:{refreshBlocklet:x}}=M(),{confirmApi:i,confirmHolder:p}=Ge(),{api:d}=N(),f=a.settings.federated?.sites||[],l=a.settings.federated?.config||{},j=l.isMaster!==!1,v=f.find(T=>T.appPid===a.appPid),S=ie({loadingSync:!1}),g=u(T=>{t.current?.open(T)}),w=u(T=>{t.current?.approve(T,x)}),h=u(T=>{i.open({title:n("federated.removeFederatedLogin"),content:n("federated.removeFederatedLoginDescription"),confirmButtonText:n("common.confirm"),cancelButtonText:n("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(D){await d.quitFederatedLogin({input:{did:a.appPid,targetDid:T.appPid}}),D()}})}),s=u(T=>{i.open({title:n("federated.disableFederatedLogin"),content:n("federated.disableFederatedLoginDescription"),confirmButtonText:n("common.confirm"),cancelButtonText:n("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(D){await d.auditFederatedLogin({input:{memberPid:T.appPid,did:a.appPid,status:"revoked"}}),D()}})}),I=u(T=>{i.open({title:n("federated.enableFederatedLogin"),content:n("federated.enableFederatedLoginDescription"),confirmButtonText:n("common.confirm"),cancelButtonText:n("common.cancel"),async onConfirm(D){await d.auditFederatedLogin({input:{memberPid:T.appPid,did:a.appPid,status:"approved"}}),D()}})}),L=H(()=>{const T=[{label:n("common.name"),name:"appName",options:{customBodyRenderLite:D=>{const q=f[D],ne=q.isMaster!==!1;return e.jsx(r,{sx:{display:"inline-block"},children:e.jsxs(r,{component:"a",href:q.appUrl,target:"_blank",onClick:P=>{P.stopPropagation()},sx:{display:"flex",alignItems:"center"},children:[ne&&e.jsx(Oe,{component:Be,style:{marginRight:"4px"}}),q.appName]})})}}},{label:n("common.did"),name:"appId",options:{customBodyRenderLite:D=>{const q=f[D];return e.jsx(je,{children:q.appId})}}},{label:n("common.status"),name:"status",options:{customBodyRenderLite:D=>{const q=f[D],ne=q.isMaster!==!1;return e.jsx(r,{children:ne?"-":n(`federated.status.${q.status}`)})}}}];return j&&T.push({label:n("common.actions"),name:"actions",options:{customBodyRenderLite:D=>{const q=f[D],ne=q.isMaster!==!1;return e.jsx(r,{sx:{display:"flex",gap:1},children:ne?e.jsxs(e.Fragment,{children:[q.status==="rejected"&&e.jsx(z,{variant:"contained",color:"error",size:"small",onClick:P=>{P.stopPropagation()},children:n("federated.status.rejected")}),q.status==="revoked"&&e.jsx(z,{variant:"contained",color:"secondary",size:"small",onClick:P=>{P.stopPropagation()},children:n("federated.status.revoked")})]}):e.jsxs(e.Fragment,{children:[e.jsx(z,{variant:"contained",color:"error",size:"small",onClick:P=>{P.stopPropagation(),h(q)},children:n("federated.quitMember")},"quiteSite"),q.status==="pending"&&e.jsx(z,{variant:"contained",color:"primary",size:"small",onClick:P=>{P.stopPropagation(),w(q)},children:n("federated.status.pending")},"auditSite"),q.status==="approved"&&e.jsx(z,{variant:"contained",color:"error",size:"small",onClick:P=>{P.stopPropagation(),s(q)},style:{whiteSpace:"nowrap"},children:n("federated.revoke")},"revokeSite"),q.status==="revoked"&&e.jsx(z,{variant:"contained",color:"warning",size:"small",onClick:P=>{P.stopPropagation(),I(q)},style:{whiteSpace:"nowrap"},children:n("federated.approve")},"approveSite")]})})}}}),T},[l.appId,f,j,n]),m=H(()=>({sort:!0,download:!1,filter:!1,print:!1,expandableRowsOnClick:!0,onRowClick(T,{dataIndex:D}){const q=f[D];g(q)}}),[]),A=u(()=>{const T=a.environments.find(D=>D.key===G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL);T?.value?c.current?.open({link:T.value}):B.error(n("federated.failedToGetFederatedLoginLink"))},[a.site?.domainAliases?.[0]?.href]),_=u(()=>{i.open({title:n("federated.quitFederatedLogin"),content:n("federated.quitFederatedLoginDescription"),confirmButtonText:n("common.confirm"),cancelButtonText:n("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(T){await d.quitFederatedLogin({input:{did:a.appPid}}),T()}})}),ae=u(()=>{i.open({title:n("federated.disbandFederatedLogin"),content:n("federated.disbandFederatedLoginDescription"),confirmButtonText:n("common.confirm"),cancelButtonText:n("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(T){await d.disbandFederatedLogin({input:{did:a.appPid}}),T()}})}),Te=u(async()=>{try{S.loadingSync=!0,await Promise.all([await d.syncFederatedConfig({input:{did:a.appPid}}),Me(500)]),B.success(n("common.succeeded"))}finally{S.loadingSync=!1}}),$=[];return v.status!=="pending"&&$.push(e.jsx(ce,{title:n("federated.syncConfig"),children:e.jsx(le,{size:"small",onClick:Te,disabled:S.loadingSync,sx:[{"@keyframes spin":{from:{transform:"rotate(0deg)"},to:{transform:"rotate(360deg)"}}},S.loadingSync?{animation:"spin 1s linear infinite"}:{}],children:e.jsx(X,{icon:vt,style:{fontSize:24}})},"syncConfig")})),b==="master"?($.push(e.jsx(z,{size:"small",variant:"contained",onClick:A,sx:{ml:1},children:n("federated.inviteJoinFederatedLogin")},"inviteJoinFederatedLogin")),$.push(e.jsx(z,{color:"error",size:"small",variant:"contained",onClick:ae,sx:{ml:1},children:n("federated.disbandFederatedLogin")},"disbandFederatedLogin"))):$.push(e.jsx(z,{size:"small",variant:"contained",color:"error",onClick:_,sx:{ml:1},children:n("federated.quitFederatedLogin")},"quitFederatedLogin")),e.jsxs(e.Fragment,{children:[e.jsx(_e,{className:"main-table",locale:o,data:f,columns:L,customButtons:$,title:e.jsx(r,{className:"table-toolbar-left",children:n("oauth.federated")}),options:m}),p,e.jsx(Se,{ref:c}),e.jsx(Ae,{ref:t})]})}Pe.propTypes={mode:E.oneOf(["member","master"])};function ze({ref:b=null}){const{t:c}=C.useContext(K),{api:t}=N(),{blocklet:n}=M(),o=n?.appPid,x=ye()?.transitions?.duration?.leavingScreen||300,i=ie({loading:!1,show:!1,appUrl:"",appUrlError:"",callback:Q}),p=u(()=>{i.appUrl="",i.appUrlError="",i.callback=Q}),d=u(()=>{i.show=!1,setTimeout(()=>{p()},x)}),f=u((v=Q)=>{i.show=!0,i.callback=v});C.useImperativeHandle(b,()=>({open:f,close:d}),[f,d]);const l=u(v=>{if(!v)throw new Error(c("federated.federatedJoinAppUrlRequired"));if(!Ye(v))throw new Error(c("federated.federatedJoinAppUrlInvalid"))}),j=u(async()=>{try{l(i.appUrl),i.loading=!0;const v=await t.joinFederatedLogin({input:{did:o,appUrl:i.appUrl}});i.show=!1,d(),i?.callback(v)}catch(v){i.appUrlError=v.message}finally{i.loading=!1}});return e.jsxs(ke,{open:i.show,title:c("federated.joinFederatedLogin"),onClose:d,PaperProps:{style:{minHeight:"unset"}},actions:e.jsxs(z,{color:"primary",autoFocus:!0,variant:"contained",onClick:j,disabled:i.loading,children:[i.loading?e.jsx(be,{size:16,sx:{mr:1},color:"grey"}):null,c("common.confirm")]}),children:[e.jsx(r,{sx:{mb:1},children:c("federated.joinFederatedLoginDescription")}),e.jsx(F,{fullWidth:!0,variant:"outlined",margin:"dense",placeholder:c("federated.federatedJoinAppUrl"),label:c("federated.federatedJoinAppUrl"),value:i.appUrl,error:!!i.appUrlError,helperText:i.appUrlError||"eg: https://www.arcblock.io",onChange:v=>{i.appUrl=v.target.value}})]})}ze.propTypes={ref:E.any};function wt(){const{t:b}=C.useContext(K);return e.jsxs(W,{direction:"row",spacing:2,sx:{alignItems:"flex-start",p:2},children:[e.jsx(Je,{fontSize:"large",color:"primary"}),e.jsxs(r,{children:[e.jsx(Y,{variant:"h6",gutterBottom:!0,children:b("federated.title")}),e.jsx(Y,{variant:"body2",sx:{color:"text.secondary"},children:b("federated.description")}),e.jsx(Ze,{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:b("federated.link")})]})]})}function St(){const b=C.useRef(null),c=C.useRef(null),{t}=C.useContext(K),{blocklet:n,actions:{refreshBlocklet:o}}=M(),a=u(()=>{const i=n.site?.domainAliases?.[0]?.href;if(i)try{const p=new URL(i);b.current?.open({link:p.origin})}catch{B.error(t("federated.failedToGetFederatedLoginLink"))}},[n.site?.domainAliases?.[0]?.href]),x=u(()=>{c.current?.open(()=>{o()})});if(n.settings.federated?.sites.length>0){const i=n.settings.federated?.config.isMaster!==!1;return e.jsx(Pe,{mode:i?"master":"member"})}return e.jsxs(e.Fragment,{children:[e.jsx(r,{sx:{display:"flex",flexDirection:"column",gap:2,justifyContent:"center",alignItems:"center",minHeight:"200px"},children:e.jsxs(r,{sx:{maxWidth:400,borderRadius:2,border:"1px solid",borderColor:"divider"},children:[e.jsx(wt,{}),e.jsx(oe,{sx:{width:1}}),e.jsxs(W,{sx:{width:1,p:2,gap:1.5},children:[e.jsx(z,{variant:"contained",onClick:a,sx:{width:1},children:t("federated.inviteJoinFederatedLogin")}),e.jsx(z,{variant:"outlined",onClick:x,sx:{width:1},children:t("federated.joinFederatedLogin")})]})]})}),e.jsx(Se,{ref:b}),e.jsx(ze,{ref:c})]})}function Tt({orientation:b="horizontal"}){const{t:c}=C.useContext(K),t=lt({key:"lg"}),n=[{label:e.jsx(r,{sx:{textAlign:"center",width:"100%"},children:c("oauth.commonSettings")}),value:"settings"},{label:e.jsx(r,{sx:{textAlign:"center",width:"100%"},children:c("oauth.federated")}),value:"federated"},{label:e.jsx(r,{sx:{textAlign:"center",width:"100%"},children:c("oauth.oauth")}),value:"oauth"},{label:e.jsx(r,{sx:{textAlign:"center",width:"100%"},children:c("oauth.moreLogin")}),value:"more"}],[o,a]=C.useState(n[0].value),x=H(()=>({oauth:e.jsx(gt,{}),federated:e.jsx(St,{}),more:e.jsx(Ne,{children:c("oauth.comingSoon")}),settings:e.jsx(jt,{})}),[c]);return b==="vertical"?e.jsx(It,{children:e.jsxs(W,{direction:{md:"column",lg:"row"},sx:{gap:2},children:[e.jsx(r,{sx:{minWidth:"240px",flexShrink:0},children:e.jsx(Ie,{tabs:n,current:o,orientation:t?"horizontal":"vertical",onChange:a,sx:{borderRight:t?0:1,height:"100%",borderColor:"divider"}})}),e.jsx(r,{sx:{flexGrow:1,minWidth:0},children:e.jsx(r,{sx:{maxWidth:"1200px"},children:x[o]})})]})}):e.jsxs(r,{children:[e.jsx(Ie,{tabs:n,current:o,onChange:a}),e.jsx(r,{sx:{marginTop:"10px"},children:x[o]})]})}Tt.propTypes={orientation:E.oneOf(["horizontal","vertical"])};const It=Fe.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{Tt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as r}from"./vendor-ux-
|
|
1
|
+
import{_ as r}from"./vendor-ux-CheVAuK7.js";import{V as _,W as e}from"./index-Bero09ZY.js";const m={en:_(e),ar:()=>r(()=>import("./ar-CCM7LUa7.js"),[],import.meta.url).then(t=>_(t.default)),de:()=>r(()=>import("./de-STCToRpb.js"),[],import.meta.url).then(t=>_(t.default)),es:()=>r(()=>import("./es-CrUw-8oc.js"),[],import.meta.url).then(t=>_(t.default)),fr:()=>r(()=>import("./fr-B6GuZu9m.js"),[],import.meta.url).then(t=>_(t.default)),hi:()=>r(()=>import("./hi-Cw_VH7M3.js"),[],import.meta.url).then(t=>_(t.default)),id:()=>r(()=>import("./id-ErxRX4DU.js"),[],import.meta.url).then(t=>_(t.default)),ja:()=>r(()=>import("./ja-CvssCilG.js"),[],import.meta.url).then(t=>_(t.default)),ko:()=>r(()=>import("./ko-CwfYSSYs.js"),[],import.meta.url).then(t=>_(t.default)),pt:()=>r(()=>import("./pt-DiKRyIZy.js"),[],import.meta.url).then(t=>_(t.default)),ru:()=>r(()=>import("./ru-5wNmeEUO.js"),[],import.meta.url).then(t=>_(t.default)),th:()=>r(()=>import("./th-B6ebKspD.js"),[],import.meta.url).then(t=>_(t.default)),vi:()=>r(()=>import("./vi-PpVWvm1I.js"),[],import.meta.url).then(t=>_(t.default)),"zh-TW":()=>r(()=>import("./zh-tw-C3Px30Ps.js"),[],import.meta.url).then(t=>_(t.default)),zh:()=>r(()=>import("./zh-Daif36Hm.js"),[],import.meta.url).then(t=>_(t.default))};export{m as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as v,g as $e,a as qe}from"./vendor-react-Dvs43sk9.js";import{g as Ue,k as Z}from"./vendor-hooks-
|
|
1
|
+
import{r as v,g as $e,a as qe}from"./vendor-react-Dvs43sk9.js";import{g as Ue,k as Z}from"./vendor-hooks-iFsOjihK.js";import{j as e,ak as t,at as $,b1 as Y,a6 as B,aX as He,am as G,co as Ge,U as Ye,T as F,a3 as Ke,W as S,z as O,M as J,I as _,cp as ge,cb as ye,A as Ve,x as Ze,c3 as Je,c4 as ee,bw as Xe,F as Qe,bc as es,s as ss}from"./vendor-mui-core-BPcN1m8_.js";import{V as A,p as W,A as ts,x as ae,J as se,H as D,n as z,z as re,a1 as je,a2 as as,a9 as rs}from"./vendor-ux-CheVAuK7.js";import{_ as P,o as os,a1 as ve,c as M,B as Q,ac as ns,e as is,Y as ls,a2 as V,b5 as be,b6 as cs}from"./index-Bero09ZY.js";import{W as oe}from"./did-address-B_YPBiI4.js";import{u as N}from"./team-PZ1SHeY3.js";import{a as ne,r as ie,b as le,c as Se,d as X,e as ds,u as ps,f as us}from"./passport-item-Af9VCIFW.js";import{p as Ce}from"./util-BsBRHu6F.js";import{u as ms}from"./use-mobile-Bjbo_Gou.js";import{v as H}from"./index-PwQ2doS3.js";import{w as q,P as fs}from"./permission-bm6ygywx.js";import{C as xs}from"./Google-C-Ei9n0a.js";import{c as hs}from"./create-passport-svg-aTWV-cva.js";import{A as gs}from"./vendor-arcblock-B0VYnHWE.js";import{G as K,_ as ys}from"./vendor-utils-D6HS5QsS.js";import{e as we}from"./edit.svg-DycWG9v3.js";import{H as ce,P as js}from"./index-BwSFbkVa.js";import{C as Te}from"./confirm-BWGQvLZx.js";import{L as Ie}from"./list-header-BNFs7V0b.js";import{f as te}from"./index-DBs9Ljax.js";import{u as vs}from"./useSetState-DFuQZPPV.js";import"./lottie-web-4koyQiv_.js";import"./session-jDtNo9RS.js";import"./isURL-RzSyCgzI.js";import"./use-app-logo-CMlvKxYW.js";import"./ua-parser-DP5omx3I.js";import"./base32-cypJRki8.js";import"./cloneDeep-3LGZOUYL.js";import"./lock.svg-COUP8tyO.js";const me="info";function De({createPassportSvg:c,passport:s,onCancel:p,onSwitchPassport:u=()=>{}}){const{t:f}=A(),i=Ue({tab:me}),d={info:{label:f("common.basicInfo"),value:me,component:()=>e.jsx(Pe,{passport:s,createPassportSvg:c})},logs:{label:f("common.logs"),value:"logs",component:()=>e.jsx(Ae,{passport:s})},related:{label:f("team.passport.related"),value:"related",component:()=>e.jsx(Le,{passport:s,onSwitchPassport:u})}},l=Object.values(d).map(({label:h,value:m})=>({label:h,value:m})).filter(h=>h.value==="related"?s.parentDid:!0),r=d[i.tab]||d.info,n=h=>{i.tab=h};return e.jsx(W,{title:f("common.passport"),onClose:p,open:!0,PaperProps:{style:{maxWidth:800,minHeight:"80vh"}},fullWidth:!0,children:e.jsxs(bs,{children:[e.jsx(t,{className:"tabs",children:e.jsx(ts,{tabs:l,current:i.tab,onChange:n,scrollButtons:"auto"})}),e.jsx(t,{className:"body",children:e.jsx(r.component,{})})]})})}De.propTypes={createPassportSvg:S.func.isRequired,passport:S.object.isRequired,onCancel:S.func.isRequired,onSwitchPassport:S.func};const bs=$(t)`
|
|
2
2
|
margin-top: -16px;
|
|
3
3
|
|
|
4
4
|
.tabs {
|
|
@@ -9,7 +9,7 @@ import{r as v,g as $e,a as qe}from"./vendor-react-Dvs43sk9.js";import{g as Ue,k
|
|
|
9
9
|
.body {
|
|
10
10
|
margin-top: 24px;
|
|
11
11
|
}
|
|
12
|
-
`;function
|
|
12
|
+
`;function Pe({createPassportSvg:c,passport:s}){const{t:p,locale:u}=A(),{teamDid:f}=N(),{inService:i}=P(),d=ms(),l=[{items:[{label:p("common.role"),content:ne(s.title)},{label:p("common.did"),content:e.jsx(oe,{did:s.id})},{label:p("team.passport.status"),content:le(s.status)},{label:p("common.type"),content:e.jsx(t,{sx:{display:"flex",gap:1,flexWrap:"wrap"},children:(s.type||[]).map(n=>e.jsx(Ye,{label:n,variant:"outlined",size:"small",sx:{borderRadius:1}},n))})}]}],r=[{title:p("team.passport.owner"),items:[{label:p("team.passport.owner"),content:e.jsx(t,{children:ie(s.user,i)})}]},{title:p("common.timeInfo"),items:[{label:p("team.passport.issuanceTime"),content:s.issuanceDate?e.jsx(se,{value:s.issuanceDate,type:"all",locale:u}):"-"},{label:p("team.member.lastLogin"),content:s.lastLoginAt?e.jsx(se,{value:s.lastLoginAt,type:"all",locale:u}):"-"},{label:p("common.expires"),content:s.expirationDate?e.jsx(se,{value:s.expirationDate,type:"all",locale:u}):"-"}]},{title:p("blocklet.overview.source"),items:[{label:p("blocklet.overview.source"),content:X(s.source)}]}];return e.jsxs(Ss,{gap:3,children:[e.jsxs(t,{sx:{display:"flex",flexDirection:d?"column":"row",alignItems:d?"flex-start":"center",justifyContent:d?"center":"flex-start",width:"100%",overflow:"hidden",gap:d?2:4},children:[e.jsx(t,{sx:{display:"flex",width:"180px"},className:"passport-image",dangerouslySetInnerHTML:{__html:c({scope:s.scope,role:s.role,title:s.scope==="kyc"?s.name:s.title,issuer:s.issuer&&s.issuer.name,issuerDid:s.issuer&&s.issuer.id,ownerName:s.user?.fullName,ownerDid:s.user?.did,ownerAvatarUrl:s.user?.avatar?Ce(s.user?.avatar,f,i):"",revoked:s.revoked,extra:s?.expirationDate?{key:"Exp",value:ve(s.expirationDate).format("YYYY-MM-DD HH:mm:ss")}:null})}}),e.jsx(t,{className:"info-area",children:l.map(n=>e.jsxs(t,{children:[n.title&&e.jsx(F,{variant:"h6",sx:{mb:2},children:n.title}),e.jsx(t,{className:"info-grid",sx:{gap:"12px !important"},children:n.items.map(h=>e.jsxs(t,{className:"info-item",children:[e.jsx(t,{className:"info-label",sx:{maxWidth:40},children:e.jsx(F,{variant:"subtitle2",color:"textSecondary",children:h.label})}),e.jsx(t,{sx:{display:"flex",flexWrap:"wrap",gap:.5,minWidth:0},children:h.content})]},h.label))})]},n.title))})]}),e.jsx(Ke,{}),e.jsx(t,{className:"info-area",children:r.map(n=>e.jsxs(t,{children:[e.jsx(F,{variant:"h5",sx:{mb:1.5},children:n.title}),e.jsx(t,{className:"info-grid",children:n.items.map(h=>e.jsxs(t,{className:"info-item",children:[e.jsx(t,{className:"info-label",children:e.jsx(F,{variant:"subtitle2",color:"textSecondary",children:h.label})}),e.jsx(t,{sx:{minWidth:500},children:h.content})]},h.label))})]},n.title))})]})}Pe.propTypes={passport:S.object.isRequired,createPassportSvg:S.func.isRequired};const Ss=$(Y)`
|
|
13
13
|
.info-card {
|
|
14
14
|
margin-bottom: 24px;
|
|
15
15
|
overflow: hidden;
|
|
@@ -87,7 +87,7 @@ import{r as v,g as $e,a as qe}from"./vendor-react-Dvs43sk9.js";import{g as Ue,k
|
|
|
87
87
|
margin: 0;
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
`,ke=10,Re=1;function Ae({passport:c}){const{api:s}=
|
|
90
|
+
`,ke=10,Re=1;function Ae({passport:c}){const{api:s}=P(),{teamDid:p}=N(),{t:u,locale:f}=A(),[i,d]=v.useState({pageSize:ke,page:Re}),{data:l,loading:r}=Z(async()=>{const x={teamDid:p,query:{passportId:c.id},paging:{page:i.page,pageSize:i.pageSize}},a=await s.getPassportLogs({input:x});return{logs:a.passportLogs||[],total:a.paging.total}},{refreshDeps:[i.page,i.pageSize],onError:x=>D.error(x.message)}),n=v.useMemo(()=>l?.logs||[],[l?.logs]),h=x=>x.action===M.PASSPORT_LOG_ACTION.APPROVE||x.action===M.PASSPORT_LOG_ACTION.REVOKE?x?.metadata?.operator?.fullName?`${u("common.operator")}: ${x?.metadata?.operator?.fullName}`:null:x.action===M.PASSPORT_LOG_ACTION.ISSUE&&x.metadata?.action===M.PASSPORT_ISSUE_ACTION.ISSUE_ON_INVITE?x?.metadata?.inviter?.fullName?`${u("common.inviter")}: ${x?.metadata?.inviter?.fullName}`:null:`passportId: ${x.passportId}`,m=v.useMemo(()=>[{label:u("common.action"),name:"action",options:{customBodyRender:(x,{rowIndex:a})=>{const o=n[a];return e.jsx(G,{title:h(o),children:`${x} ${o.metadata?.action?`(${o.metadata.action})`:""}`})}}},{label:"IP",name:"operatorIp",options:{customBodyRender:x=>e.jsx(t,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsx("span",{children:x||"-"})})}},{label:"UA",width:250,name:"operatorUa",options:{customBodyRender:(x,{rowIndex:a})=>{const o=n[a];return e.jsxs(t,{sx:{display:"flex",alignItems:"center",gap:1},children:[o.operatorUa&&e.jsx(t,{children:ds(o.operatorUa)}),o.operatorUa&&e.jsx(G,{title:o.operatorUa,children:e.jsx(Ge,{fontSize:"small",color:"action",sx:{fontSize:16,cursor:"pointer"}})})]})}}},{label:u("common.createdAt"),name:"createdAt",options:{customBodyRender:x=>os(x,f)}}],[u,f,n]),g=({page:x,rowsPerPage:a})=>{i.pageSize!==a?d(o=>({...o,pageSize:a,page:1})):i.page!==x+1&&d(o=>({...o,page:x+1}))},T={sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,search:!1,page:i.page-1,rowsPerPage:i.pageSize,count:l?.total||0};return r?e.jsx(t,{sx:{py:2},children:e.jsx(Y,{direction:"row",spacing:1,sx:{position:"relative",pb:2},children:e.jsx(B,{})})}):e.jsx(t,{children:e.jsx(ae,{className:"logs-table",verticalKeyWidth:100,locale:f,data:n,columns:m,options:T,loading:r,onChange:g})})}Ae.propTypes={passport:S.object.isRequired};function Le({passport:c,onSwitchPassport:s}){const{api:p}=P(),{teamDid:u}=N(),{t:f,locale:i}=A(),[d,l]=v.useState({pageSize:ke,page:Re}),{data:r,loading:n}=Z(async()=>{const a={teamDid:u,passportId:c.parentDid,paging:{page:d.page,pageSize:d.pageSize}},o=await p.getRelatedPassports({input:a});return{passports:o.passports||[],total:o.paging.total}},{refreshDeps:[d.page,d.pageSize],onError:a=>D.error(a.message)}),h=v.useMemo(()=>r?.passports||[],[r?.passports]),m=v.useMemo(()=>[{label:f("team.passport.role"),name:"role",options:{customBodyRender:ne}},{label:f("team.passport.owner"),name:"user",options:{customBodyRender:ie}},{label:f("team.passport.status"),name:"status",options:{customBodyRender:le}},{label:f("team.member.lastLogin"),name:"lastLoginAt",options:{customBodyRender:a=>Se(a,i)}},{label:f("blocklet.overview.source"),name:"source",options:{customBodyRender:X}}],[f,i]),g=({page:a,rowsPerPage:o})=>{d.pageSize!==o?l(b=>({...b,pageSize:o,page:1})):d.page!==a+1&&l(b=>({...b,page:a+1}))},T=v.useRef(null),x={sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,search:!1,page:d.page-1,rowsPerPage:d.pageSize,count:r?.total||0,onRowClick(a,{dataIndex:o},b){if(T.current?.contains(b.target)){const j=h[o];s(j)}}};return n?e.jsx(t,{sx:{py:2},children:e.jsx(Y,{direction:"row",spacing:1,sx:{position:"relative",pb:2},children:e.jsx(B,{})})}):e.jsxs(Y,{spacing:1,children:[e.jsx(He,{severity:"warning",children:f("team.passport.relatedDescription")}),e.jsx(t,{ref:T,sx:{".MuiTableRow-root":{cursor:"pointer"}},children:e.jsx(ae,{className:"related-table",verticalKeyWidth:100,locale:i,data:h.filter(a=>a.id!==c.id),columns:m,options:x,loading:n,onChange:g})})]})}Le.propTypes={passport:S.object.isRequired,onSwitchPassport:S.func.isRequired};function de({onCancel:c,onSuccess:s}){const{api:p}=P(),{blocklet:u}=ns(),{t:f}=A(),[i,d]=v.useState(!1),l=(u.environments.find(g=>g.key==="BLOCKLET_PASSPORT_COLOR")||{}).value||"auto",r=l==="auto"?gs(u.appDid):l,[n,h]=v.useState(r),m=async()=>{const g=[{key:ls.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_PASSPORT_COLOR,value:n}];try{d(!0),await p.configBlocklet({input:{did:u.meta.did,configs:g}}),s()}catch(T){D.error(T.message)}finally{d(!1)}};return e.jsx(W,{title:f("team.passport.color"),onClose:c,open:!0,fullWidth:!0,actions:e.jsxs(e.Fragment,{children:[e.jsx(z,{onClick:c,color:"inherit",children:f("common.cancel")}),e.jsxs(z,{onClick:m,color:"primary",disabled:i,variant:"contained",autoFocus:!0,"data-cy":"color-btn-confirm",children:[i&&e.jsx(B,{size:16}),f("common.save")]})]}),children:e.jsxs(t,{className:"dialog-content",sx:{display:"flex",justifyContent:"center",alignItems:"center"},children:[e.jsx(xs,{disableAlpha:!0,color:n,onChange:g=>h(g.hex)}),e.jsx("div",{style:{width:220,marginLeft:24},dangerouslySetInnerHTML:{__html:hs({scope:"passport",role:"owner",title:"Owner",issuer:is.getDisplayName(u),issuerDid:u.appDid,ownerName:"Your Name",ownerDid:u.appDid,preferredColor:n})}})]})})}const Cs=q(de,"mutate_team"),ws=q(de,"",Q);function Ts(c){const{inService:s}=P();return s?e.jsx(ws,{...c}):e.jsx(Cs,{...c})}de.propTypes={onCancel:S.func.isRequired,onSuccess:S.func.isRequired};var ze=function(s){return e.jsx("svg",{...s,children:e.jsx("path",{d:"M64.707 8.707a1 1 0 0 0 0-1.414L58.343.929a1 1 0 1 0-1.414 1.414L62.586 8l-5.657 5.657a1 1 0 0 0 1.414 1.414l6.364-6.364ZM0 9h64V7H0v2Z",fill:"#666"})})};ze.defaultProps={width:"65",height:"16",fill:"none",xmlns:"http://www.w3.org/2000/svg"};const Is=(c,s)=>c?!s.some(p=>!p.from.passport||!p.to.role):!1;function Ne({onCancel:c,onSuccess:s,data:p={},trustedPassports:u=[]}){const{api:f}=P(),{roles:i,teamDid:d}=N(),{t:l}=A(),[r,n]=v.useState(!1),[h,m]=v.useState(p.issuerDid||""),[g,T]=v.useState(p.remark||""),[x,a]=v.useState(K(p.mappings)||[]),o=u.findIndex(j=>j.issuerDid===p.issuerDid),b=async()=>{if(r)return;const j={issuerDid:h,remark:g,mappings:x.map(w=>({...w,to:{...w.to,ttl:w.to.ttl||0}}))},C=[...u];o===-1?C.unshift(j):C[o]=j;try{n(!0),await f.configTrustedPassports({input:{teamDid:d,trustedPassports:C}}),await V(800),n(!1),D.success(l("common.saveSuccess")),s()}catch(w){n(!1),D.error(te(w))}};return e.jsx(W,{title:l("team.passport.trustedIssuers"),open:!0,showCloseButton:!1,PaperProps:{style:{minHeight:"80vh"}},fullWidth:!0,prepend:e.jsx(_,{onClick:c,"data-cy":"trusted-issuer-close",size:"large",children:e.jsx(ge,{})}),actions:e.jsxs(e.Fragment,{children:[e.jsx(z,{onClick:c,color:"inherit",children:l("common.cancel")}),e.jsxs(z,{onClick:()=>b(),color:"primary",disabled:!Is(h,x)||!g||r,variant:"contained",autoFocus:!0,"data-cy":"save-mapping",children:[r&&e.jsx(B,{size:16}),l("common.save")]})]}),children:e.jsx(Ds,{children:e.jsxs("div",{className:"dialog-content",children:[e.jsx(O,{fullWidth:!0,"data-cy":"input-issuer-did",placeholder:l("team.passport.issuerDid"),value:h,onChange:j=>{m(j.target.value)}}),e.jsx(O,{style:{marginTop:16},fullWidth:!0,"data-cy":"input-issuer-remark",placeholder:l("common.remark"),value:g,onChange:j=>{T(j.target.value)}}),e.jsxs(t,{sx:{mt:"30px",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsx(t,{className:"dialog-h1",children:l("team.passport.mappingRule")}),e.jsx(t,{children:e.jsx(z,{variant:"outlined",color:"primary","data-cy":"add-mapping",onClick:()=>{a(j=>{const C=[...j];return C.unshift({from:{passport:""},to:{role:M.ROLES.GUEST}}),C})},children:l("team.add")})})]}),e.jsxs(t,{className:"list",sx:{mt:-.5},children:[x.map((j,C)=>e.jsxs(t,{className:"mapping-item",sx:{display:"flex",alignItems:"center",justifyContent:"space-between",my:1},children:[e.jsxs(t,{sx:{display:"flex",alignItems:"center",flexGrow:1},children:[e.jsx(t,{sx:{flexGrow:1,flexBasis:1},children:e.jsx(O,{fullWidth:!0,size:"small","data-cy":`input-${C}-from`,placeholder:"Issuer’s Passport Name/ID *",value:j.from.passport,onChange:w=>{const{value:k}=w.target;a(L=>{const U=[...L];return U[C].from.passport=k,U})},sx:{"& .MuiInputBase-input::placeholder":{fontSize:14},"& .Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"primary.main"}}})}),e.jsx(t,{sx:{flexShrink:0,mx:1,width:65,height:16},children:e.jsx(ze,{})}),e.jsx(t,{sx:{flexGrow:1,flexBasis:1},children:e.jsx(O,{fullWidth:!0,size:"small",select:!0,value:j.to.role,onChange:w=>{a(k=>{const L=[...k];return L[C].to.role=w.target.value,L})},variant:"outlined",children:i.filter(w=>w.name!=="owner").map(w=>e.jsx(J,{value:w.name,"data-cy":`passport-mapping-select-option-${w.name}`,children:e.jsx("span",{children:w.title||w.name})},w.name))})})]}),e.jsx(t,{sx:{flexShrink:0},children:e.jsx(_,{onClick:()=>{a(w=>{const k=[...w];return k.splice(C,1),k})},size:"large",children:e.jsx(ce,{})})})]},`mapping-${C}`)),!x.length&&e.jsx(t,{sx:{my:2,color:"text.secondary",fontSize:"16px"},children:e.jsx(re,{children:l("common.empty")})})]})]})})})}Ne.propTypes={onCancel:S.func.isRequired,onSuccess:S.func.isRequired,trustedPassports:S.array,data:S.object};const Ds=$.div`
|
|
91
91
|
.dialog-h1 {
|
|
92
92
|
font-size: 18px;
|
|
93
93
|
}
|
|
@@ -99,7 +99,7 @@ import{r as v,g as $e,a as qe}from"./vendor-react-Dvs43sk9.js";import{g as Ue,k
|
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
-
`;function pe({onCancel:c,hasPermission:s=!1}){const{api:p}=
|
|
102
|
+
`;function pe({onCancel:c,hasPermission:s=!1}){const{api:p}=P(),{teamDid:u,trustedPassports:f}=N(),{t:i}=A(),[d,l]=v.useState(null),[r,n]=v.useState(!1),[h,m]=v.useState(!1),[g,T]=v.useState(""),x=async o=>{if(r)return;const b=f.findIndex(C=>C.issuerDid===o);b===-1&&D.error("Cannot find passports");const j=[...f];j.splice(b,1);try{n(!0),await p.configTrustedPassports({input:{teamDid:u,trustedPassports:j}}),await V(800),n(!1),D.success(i("common.saveSuccess")),l(!1)}catch(C){n(!1),D.error(C.message)}},a=f.filter(o=>!g||o.issuerDid.toLowerCase().includes(g.toLowerCase()));return e.jsxs(W,{title:i("team.passport.trustedIssuers"),open:!0,onClose:c,fullWidth:!0,PaperProps:{style:{minHeight:"80vh"}},children:[e.jsx(As,{children:e.jsxs("div",{className:"dialog-content",children:[e.jsx("div",{className:"dialog-h1",children:i("team.passport.trustedPassportIssuers")}),e.jsx(Ie,{sx:{mt:3},actions:e.jsxs(e.Fragment,{children:[e.jsx(je,{options:{searchPlaceholder:i("team.passport.searchIssuerDid"),searchDebounceTime:600},search:g,searchText:g,searchTextUpdate:T,searchClose:()=>T(""),onSearchOpen:()=>{}}),s&&e.jsxs(z,{variant:"contained",color:"primary","data-cy":"add-trusted-issuer",onClick:()=>m({mode:"add"}),children:[e.jsx(ye,{style:{fontSize:16,marginRight:4}}),i("team.add")]})]})}),e.jsxs("div",{className:"list",children:[a.map(o=>e.jsxs(t,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mt:"20px"},children:[e.jsxs(t,{sx:{flexShrink:0},children:[e.jsx(oe,{copyable:!1,size:16,did:be.toAddress(o.issuerDid),showDidLogo:!1}),!!o.remark&&e.jsx(t,{sx:{fontSize:12,maxWidth:"300px"},children:o.remark})]}),e.jsx(t,{sx:{color:"gray",ml:"28px",flexGrow:1},children:o.mappings&&o.mappings.length?`${o.mappings.length} ${i("team.passport.mappingRule")}`:i("team.passport.defaultRule")}),e.jsxs(t,{sx:{flexShrink:0,display:"flex",alignItems:"center"},children:[e.jsx(_,{onClick:()=>m({mode:"update",data:K(o)}),"data-cy":"edit-mapping-rule",size:"large",children:e.jsx(we,{})}),e.jsx(_,{"data-cy":"delete-mapping-rule",onClick:()=>l({title:i("common.delete"),description:i("common.delConfirmDescription",{data:o.issuerDid}),confirm:i("common.delConfirm"),cancel:i("common.cancel"),onConfirm:()=>x(o.issuerDid),onCancel:()=>{n(!1),l(null)}}),size:"large",children:e.jsx(ce,{})})]})]},o.issuerDid)),!f.length&&e.jsx(re,{children:i("common.empty")})]})]})}),h&&e.jsx(Ne,{mode:h.mode,data:h.data,trustedPassports:K(f),onCancel:()=>m(null),onSuccess:()=>{m(null)}}),d&&e.jsx(Te,{title:d.title,description:d.description,confirm:d.confirm,cancel:d.cancel,params:d.params,onConfirm:d.onConfirm,onCancel:d.onCancel})]})}pe.propTypes={onCancel:S.func.isRequired,hasPermission:S.bool};const Ps=q(pe,"mutate_team"),ks=q(pe,"",Q);function Rs(c){const{inService:s}=P();return s?e.jsx(ks,{...c}):e.jsx(Ps,{...c})}const As=$.div`
|
|
103
103
|
.list {
|
|
104
104
|
.MuiIconButton-root {
|
|
105
105
|
svg {
|
|
@@ -107,7 +107,7 @@ import{r as v,g as $e,a as qe}from"./vendor-react-Dvs43sk9.js";import{g as Ue,k
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
`;var Ls=
|
|
110
|
+
`;var Ls=ys();const fe=$e(Ls);function Be({onCancel:c,onSuccess:s,data:p={},trustedFactories:u=[]}){const{api:f}=P(),{roles:i,teamDid:d}=N(),{t:l}=A(),[r,n]=vs({loading:!1,fetching:!1,fetched:[],errored:[],factoryAddress:p.factoryAddress||"",remark:p.remark||"",role:p.passport?.role||"member",ttlPolicy:p.passport?.ttlPolicy||"never",ttl:fe(+p.passport?.ttl||365*24*60*60*1e3),error:""}),h=u.findIndex(a=>a.factoryAddress===p.factoryAddress),m=async()=>{if(r.loading)return;const{factoryAddress:a,remark:o,role:b,ttlPolicy:j,ttl:C}=r,w={factoryAddress:a,remark:o,passport:{role:b,ttlPolicy:j,ttl:j==="never"?0:fe(C)}},k=[...u];h===-1?k.unshift(w):k[h]=w;try{n({loading:!0}),await f.configTrustedFactories({input:{teamDid:d,trustedFactories:k}}),await V(800),D.success(l("common.saveSuccess")),s()}catch(L){console.error(L),D.error(te(L))}finally{n({loading:!1})}};v.useEffect(()=>{const a=r.fetched.find(b=>b.address===r.factoryAddress),o=r.errored.find(b=>b.address===r.factoryAddress);be.isValid(r.factoryAddress)&&!r.fetching&&!a&&!o&&(n({fetching:!0}),cs(M.MAIN_CHAIN_ENDPOINT).getFactoryState({address:r.factoryAddress}).then(j=>{j.state?n({fetching:!1,fetched:[...r.fetched.filter(C=>C.address!==r.factoryAddress),j.state],remark:j.state.name}):n({fetching:!1,errored:[...r.errored.filter(C=>C.address!==r.factoryAddress),{address:r.factoryAddress}],error:l("team.passport.factory404",r)})}).catch(j=>{console.error(j),n({fetching:!1,error:te(j)})}))},[r.factoryAddress,r.fetching]);let g=r.error;const T=r.factoryAddress?r.errored.find(a=>a.address===r.factoryAddress):null;!g&&T&&(g=l("team.passport.factory404",r));const x=r.factoryAddress?r.fetched.find(a=>a.address===r.factoryAddress):null;return!g&&x&&(g=x.description),g||(g=l("team.passport.factoryAddressTip")),e.jsx(W,{title:l("team.passport.trustedFactories"),open:!0,showCloseButton:!1,PaperProps:{style:{minHeight:"80vh"}},fullWidth:!0,prepend:e.jsx(_,{onClick:c,"data-cy":"close-trusted-factory",size:"large",children:e.jsx(ge,{})}),actions:e.jsxs(e.Fragment,{children:[e.jsx(z,{onClick:c,color:"inherit",children:l("common.cancel")}),e.jsxs(z,{onClick:()=>m(),color:"primary",disabled:!r.factoryAddress||!r.remark||!r.role||r.loading||r.error||T,variant:"contained",autoFocus:!0,"data-cy":"save-trusted-factory",children:[r.loading&&e.jsx(B,{size:16}),l("common.save")]})]}),children:e.jsx(zs,{children:e.jsxs("div",{className:"dialog-content",children:[e.jsx(O,{fullWidth:!0,error:!!r.error||!!T,"data-cy":"input-factory-address",label:l("team.passport.factoryAddress"),helperText:g,value:r.factoryAddress,onChange:a=>{n({factoryAddress:a.target.value,error:""})},slotProps:{input:{endAdornment:r.fetching?e.jsx(Ve,{position:"end",children:e.jsx(B,{size:16})}):null}}}),e.jsx(O,{style:{marginTop:32},fullWidth:!0,"data-cy":"input-factory-remark",label:l("common.remark"),value:r.remark,onChange:a=>{n({remark:a.target.value})}}),e.jsx(O,{style:{marginTop:32},fullWidth:!0,"data-cy":"input-passport-role",label:l("team.passport.role"),select:!0,value:r.role,onChange:a=>{n({role:a.target.value})},variant:"outlined",children:i.filter(a=>a.name!=="owner").map(a=>e.jsx(J,{value:a.name,"data-cy":`passport-role-select-option-${a.name}`,children:e.jsx("span",{children:a.title||a.name})},a.name))}),e.jsxs("div",{style:{marginTop:32},children:[e.jsx(Ze,{children:l("team.passport.ttl")}),e.jsxs(Je,{color:"primary",size:"small",value:r.ttlPolicy,exclusive:!0,style:{marginTop:16},onChange:(a,o)=>n({ttlPolicy:o}),"data-cy":"input-passport-ttl-since","aria-label":"Expire Policy",children:[e.jsx(ee,{value:"never","data-cy":"input-passport-ttl-never",children:e.jsx(G,{title:l("team.passport.ttlNeverTip"),children:e.jsx(F,{children:l("team.passport.ttlNever")})})}),e.jsx(ee,{value:"mint","data-cy":"input-passport-ttl-mint",children:e.jsx(G,{title:l("team.passport.ttlMintTip"),children:e.jsx(F,{children:l("team.passport.ttlMint")})})}),e.jsx(ee,{value:"exchange","data-cy":"input-passport-ttl-exchange",children:e.jsx(G,{title:l("team.passport.ttlExchangeTip"),children:e.jsx(F,{children:l("team.passport.ttlExchange")})})})]}),r.ttlPolicy!=="never"&&e.jsxs(e.Fragment,{children:[e.jsx(Xe,{fullWidth:!0,type:"text",style:{marginTop:16},"data-cy":"input-passport-ttl",value:r.ttl,onChange:a=>{n({ttl:a.target.value})}}),e.jsx(Qe,{children:l("team.passport.ttlTip")})]})]})]})})})}Be.propTypes={onCancel:S.func.isRequired,onSuccess:S.func.isRequired,trustedFactories:S.array,data:S.object};const zs=$.div`
|
|
111
111
|
.dialog-h1 {
|
|
112
112
|
font-size: 18px;
|
|
113
113
|
}
|
|
@@ -119,7 +119,7 @@ import{r as v,g as $e,a as qe}from"./vendor-react-Dvs43sk9.js";import{g as Ue,k
|
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
-
`;function ue({onCancel:c,hasPermission:s=!1}){const{api:p}=
|
|
122
|
+
`;function ue({onCancel:c,hasPermission:s=!1}){const{api:p}=P(),{teamDid:u,trustedFactories:f}=N(),{t:i}=A(),[d,l]=v.useState(null),[r,n]=v.useState(!1),[h,m]=v.useState(null),[g,T]=v.useState(""),x=async o=>{if(!r)try{n(!0),await p.configTrustedFactories({input:{teamDid:u,trustedFactories:f.filter(b=>b.factoryAddress!==o)}}),await V(800),n(!1),D.success(i("common.saveSuccess")),l(null)}catch(b){n(!1),D.error(b.message)}},a=f.filter(o=>!g||o.factoryAddress.toLowerCase().includes(g.toLowerCase()));return e.jsxs(W,{title:i("team.passport.trustedFactories"),open:!0,onClose:c,fullWidth:!0,PaperProps:{style:{minHeight:"80vh"}},children:[e.jsx(Fs,{children:e.jsxs("div",{className:"dialog-content",children:[e.jsx("div",{className:"dialog-h1",children:i("team.passport.trustedFactoriesTip")}),e.jsx(Ie,{sx:{mt:3},actions:e.jsxs(e.Fragment,{children:[e.jsx(je,{options:{searchPlaceholder:i("team.passport.searchFactoryAddress"),searchDebounceTime:600},search:g,searchText:g,searchTextUpdate:T,searchClose:()=>T(""),onSearchOpen:()=>{}}),s&&e.jsxs(z,{variant:"contained",color:"primary",size:"small","data-cy":"add-trusted-factory",onClick:()=>m({mode:"add"}),children:[e.jsx(ye,{style:{fontSize:16,marginRight:4}}),i("team.add")]})]})}),e.jsxs("div",{className:"list",children:[a.map(o=>e.jsxs(t,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mt:"20px"},children:[e.jsxs(t,{sx:{flexGrow:1},children:[e.jsx(oe,{copyable:!1,did:o.factoryAddress,size:16,showDidLogo:!1}),!!o.remark&&e.jsx(t,{sx:{fontSize:12,maxWidth:"300px"},children:o.remark})]}),e.jsx(t,{sx:{color:"gray",mr:"24px"},children:e.jsx(as,{type:"success",children:o.passport.role})}),e.jsxs(t,{sx:{flexShrink:0,display:"flex",alignItems:"center"},children:[e.jsx(_,{onClick:()=>m({mode:"update",data:K(o)}),"data-cy":"edit-trusted-factory",size:"large",children:e.jsx(we,{})}),e.jsx(_,{"data-cy":"delete-trusted-factory",onClick:()=>l({title:i("common.delete"),description:i("common.delConfirmDescription",{data:o.factoryAddress}),confirm:i("common.delConfirm"),cancel:i("common.cancel"),onConfirm:()=>x(o.factoryAddress),onCancel:()=>{n(!1),l(null)}}),size:"large",children:e.jsx(ce,{})})]})]},o.factoryAddress)),!f.length&&e.jsx(re,{children:i("common.empty")})]})]})}),h&&e.jsx(Be,{data:h.data,trustedFactories:K(f),onCancel:()=>m(null),onSuccess:()=>{m(null)}}),d&&e.jsx(Te,{title:d.title,description:d.description,confirm:d.confirm,cancel:d.cancel,params:d.params,onConfirm:d.onConfirm,onCancel:d.onCancel})]})}ue.propTypes={onCancel:S.func.isRequired,hasPermission:S.bool};const Ns=q(ue,"mutate_team"),Bs=q(ue,"",Q);function Es(c){const{inService:s}=P();return s?e.jsx(Bs,{...c}):e.jsx(Ns,{...c})}const Fs=$.div`
|
|
123
123
|
.list {
|
|
124
124
|
.MuiIconButton-root {
|
|
125
125
|
svg {
|
|
@@ -127,7 +127,7 @@ import{r as v,g as $e,a as qe}from"./vendor-react-Dvs43sk9.js";import{g as Ue,k
|
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
-
`;function Ee({createPassportSvg:c}){const{t:s}=A(),{api:p,inService:u}=
|
|
130
|
+
`;function Ee({createPassportSvg:c}){const{t:s}=A(),{api:p,inService:u}=P(),{teamDid:f,refresh:i,enablePassportIssuance:d,isNodeTeam:l}=N(),[r,n]=v.useState(!1),[h,m]=v.useState(!1),[g,T]=v.useState(!1),[x,a]=v.useState(!1),[o,b]=v.useState(!1),j=async C=>{if(C.stopPropagation(),!x){a(!0);try{await p.configPassportIssuance({input:{teamDid:f,enable:!d}}),i(),await V(800),D.success(s("common.configSuccess"))}catch(w){D.error(w.message)}finally{a(!1)}}};return e.jsxs(t,{sx:{display:"flex",alignItems:"center",gap:1,ml:1},children:[e.jsx(fs,{permission:u?"":"mutate_team",role:u?Q:[],children:e.jsx(H,{variant:"outlined",menuButtonProps:{"data-cy":"trusted-issuers-more"},menu:e.jsxs(e.Fragment,{children:[e.jsx(H.Item,{onClick:()=>m(!0),"data-cy":"config-trusted-issuers",children:e.jsxs(t,{children:[s("team.passport.trustedPassportIssuers"),e.jsx(t,{sx:{fontSize:12,color:"#888"},children:s("team.passport.trustedPassportIssuersTip")})]})}),e.jsx(H.Item,{onClick:()=>T(!0),"data-cy":"config-show-trusted-factories",children:e.jsxs(t,{children:[s("team.passport.configFactories"),e.jsx(t,{sx:{fontSize:12,color:"#888"},children:s("team.passport.configFactoriesTip")})]})}),e.jsx(H.Item,{"data-cy":"config-show-issue-passport",onClick:j,children:e.jsxs(t,{sx:{display:"flex",alignItems:"center"},children:[x&&e.jsx(B,{size:16,style:{marginRight:8}}),e.jsxs(t,{children:[s(d?"team.passport.disableIssuance":"team.passport.enableIssuance"),e.jsx(t,{sx:{fontSize:12,color:"#888"},children:s(d?"team.passport.disableIssuanceTip":"team.passport.enableIssuanceTip")})]})]})}),!l&&e.jsx(H.Item,{onClick:()=>n(!0),"data-cy":"config-passport-color",children:e.jsxs(t,{children:[s("team.passport.configColor"),e.jsx(t,{sx:{fontSize:12,color:"#888"},children:s("team.passport.configColorTip")})]})})]}),children:()=>e.jsx(z,{variant:"outlined",onClick:()=>{b(!0)},children:s("team.passport.view")})})}),h&&e.jsx(Rs,{onCancel:()=>m(!1)}),g&&e.jsx(Es,{onCancel:()=>T(!1)}),r&&e.jsx(Ts,{onCancel:()=>n(!1),onSuccess:()=>n(!1)}),o&&e.jsx(W,{open:!0,maxWidth:"lg",onClose:()=>b(!1),onBackdropClick:()=>b(!1),onEscapeKeyDown:()=>b(!1),title:s("team.passport.view"),children:e.jsx(js,{createPassportSvg:c,onCancel:()=>b(!1)})})]})}Ee.propTypes={createPassportSvg:S.func.isRequired};const xe="$all",he="",Fe=qe.memo(({createPassportSvg:c,passport:s,teamDid:p,inService:u})=>e.jsx(t,{sx:{display:"flex"},dangerouslySetInnerHTML:{__html:c({scope:s.scope,role:s.role,title:s.scope==="kyc"?s.name:s.title,issuer:s.issuer&&s.issuer.name,issuerDid:s.issuer&&s.issuer.id,ownerName:s.user?.fullName,ownerDid:s.user?.did,ownerAvatarUrl:s.user?.avatar?Ce(s.user?.avatar,p,u):"",revoked:s.revoked,width:"36px",extra:s?.expirationDate?{key:"Exp",value:ve(s.expirationDate).format("YYYY-MM-DD HH:mm:ss")}:null})}}));Fe.propTypes={passport:S.object.isRequired,createPassportSvg:S.func.isRequired,teamDid:S.string.isRequired,inService:S.bool.isRequired};function Os({createPassportSvg:c}){const{api:s}=P(),{teamDid:p}=N(),{t:u,locale:f}=A(),{SYSTEM_ROLES:i}=ps(),{inService:d}=P(),[l,r]=v.useState(!1),n=`passports-${p}`,h=rs(n),[m,g]=v.useState({role:xe,status:he,searchText:h.searchText||"",pageSize:h.rowsPerPage||10,page:h.page?h.page+1:1}),{data:T,loading:x}=Z(async()=>(await s.getPassportRoleCounts({input:{teamDid:p}})).counts||[],{refreshDeps:[p]}),{data:a,loading:o}=Z(async()=>{const y={};m.role!==xe&&(y.role=m.role),m.status&&(y.status=m.status);const I=await s.getPassportsByRole({input:{teamDid:p,query:y,paging:{page:m.page,pageSize:m.pageSize}}});return{passports:I.passports||[],total:I.paging.total}},{refreshDeps:[m.role,m.status,m.page,m.pageSize],onError:y=>D.error(y.message)}),b=y=>T?.find(R=>R.key===y)?.value||0,j=v.useMemo(()=>Object.keys(i).map(y=>({name:y,title:i[y],num:b(y)})),[T,b]),C=v.useMemo(()=>[{label:u("team.passport.role"),name:"role",options:{customBodyRender:(y,{rowIndex:I})=>{const R=a?.passports[I];return e.jsxs(t,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(Fe,{createPassportSvg:c,passport:R,teamDid:p}),e.jsx(t,{children:ne(R.title)})]})}}},{label:u("team.passport.owner"),name:"user",options:{customBodyRender:y=>ie(y,d)}},{label:u("team.passport.status"),name:"status",options:{customBodyRender:le}},{label:u("team.member.lastLogin"),name:"lastLoginAt",options:{customBodyRender:y=>Se(y,f)}},{label:u("common.address"),name:"id",options:{customBodyRender:us}},{label:u("blocklet.overview.source"),name:"source",options:{customBodyRender:(y,{rowIndex:I})=>{const R=a?.passports[I];return R.parentDid?X("recover"):X(R.source)}}}],[u,f,a?.passports,p,c,d]),w=y=>{g(I=>({...I,role:y,page:1}))},k=({page:y,rowsPerPage:I,searchText:R})=>{m.pageSize!==I?g(E=>({...E,searchText:"",pageSize:I,page:1})):m.page!==y+1?g(E=>({...E,searchText:"",page:y+1})):m.searchText!==R&&g(E=>({...E,searchText:R,page:1}))},L=v.useRef(null),U=a?.passports||[],Oe=m.searchText?U.filter(y=>y.id.includes(m.searchText)||(y?.user?.fullName||"").includes(m.searchText)):U,Me={sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,onRowClick(y,{dataIndex:I},R){if(L.current?.contains(R.target)){const E=a?.passports[I];r(E)}},page:m.page-1,rowsPerPage:m.pageSize,count:a?.total||0,searchDebounceTime:600},_e=y=>{g(I=>({...I,status:y.target.value,page:1}))},We=e.jsxs(t,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsxs(t,{sx:{fontSize:16,fontWeight:400},children:[u("team.passport.status"),":"]}),e.jsxs(es,{size:"small",value:m.status,onChange:_e,displayEmpty:!0,sx:{minWidth:120,height:36,".MuiSelect-select":{py:.5,px:1.5}},children:[e.jsx(J,{value:he,children:u("common.all")}),Object.values(M.PASSPORT_STATUS).map(y=>e.jsx(J,{value:y,sx:{py:1},children:u(`team.passport.statusMap.${y}`)},y))]})]});return x?e.jsx(t,{sx:{py:2},children:e.jsx(Y,{direction:"row",spacing:1,sx:{justifyContent:"center",alignItems:"center",position:"relative",pb:2},children:e.jsx(B,{})})}):e.jsxs(Ms,{children:[e.jsxs(t,{className:"main",sx:{display:"flex",mt:0,gap:3},children:[e.jsx(t,{className:"left",children:e.jsx(t,{className:"tabs",children:j.map(y=>e.jsxs(t,{className:`tab ${m.role===y.name?"active":""}`,onClick:()=>w(y.name),children:[e.jsx("span",{className:"text",children:y.title}),e.jsx(t,{sx:{color:"text.secondary"},children:y.num})]},y.name))})}),e.jsx(t,{ref:L,className:"right",children:e.jsx(ae,{className:"main-table",verticalKeyWidth:100,locale:f,durable:n,durableKeys:["page","rowsPerPage"],data:Oe,columns:C,options:Me,loading:o,onChange:k,customButtons:[e.jsx(Ee,{createPassportSvg:c})],title:We})})]}),l&&e.jsx(De,{createPassportSvg:c,onCancel:()=>r(null),passport:l,onSwitchPassport:r})]})}Os.propTypes={createPassportSvg:S.func.isRequired};const Ms=ss(t)`
|
|
131
131
|
.main {
|
|
132
132
|
.left {
|
|
133
133
|
width: 256px;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as i,b6 as e,bg as a,W as s}from"./vendor-mui-core-
|
|
1
|
+
import{j as i,b6 as e,bg as a,W as s}from"./vendor-mui-core-BPcN1m8_.js";import{l}from"./vendor-ux-CheVAuK7.js";const r=l(t=>i.jsx(a,{focusVisibleClassName:".Mui-focusVisible",disableRipple:!0,...t}))(({theme:t})=>({width:42,height:26,padding:0,"& .MuiSwitch-switchBase":{padding:0,margin:2,transitionDuration:"300ms","&.Mui-checked":{transform:"translateX(16px)",color:"#fff","& + .MuiSwitch-track":{backgroundColor:t.palette.primary.main,opacity:1,border:0},"&.Mui-disabled + .MuiSwitch-track":{opacity:.5}},"&.Mui-focusVisible .MuiSwitch-thumb":{color:t.palette.primary.main,border:"6px solid #fff"},"&.Mui-disabled .MuiSwitch-thumb":{color:t.palette.mode==="light"?t.palette.grey[100]:t.palette.grey[600]},"&.Mui-disabled + .MuiSwitch-track":{opacity:t.palette.mode==="light"?.7:.3}},"& .MuiSwitch-thumb":{boxSizing:"border-box",width:22,height:22},"& .MuiSwitch-track":{borderRadius:26/2,backgroundColor:t.palette.grey[200],opacity:1,transition:t.transitions.create(["background-color"],{duration:500})}}));function c({labelProps:t=null,...o}){return t?i.jsx(e,{control:i.jsx(r,{...o}),...t}):i.jsx(r,{...o})}c.propTypes={labelProps:s.object};export{c as u};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{j as e,W as u,a6 as z,T as j,at as _e,D as We,cH as V,ao as J,cI as Ke,ak as h,b1 as K,a$ as Ge,s as fe,cJ as be,co as Fe,am as ge,cq as Ye,M as F,aO as Y,bX as $e,aP as $,Q as qe,be as He,aR as Qe,cK as Xe,cL as Ve,cM as Je,cN as Ze,c2 as he}from"./vendor-mui-core-
|
|
2
|
-
`)},backgroundColor:a.palette.background.paper,borderColor:a.palette.divider,textStyle:{color:a.palette.text.primary,fontSize:14},extraCssText:`box-shadow: ${a.shadows[2]}; border-radius: 4px;`,padding:[8,10]},visualMap:{show:!1,min:-12,max:12,pieces:[{min:Number.MIN_SAFE_INTEGER,max:-9,color:V[600]},{min:-9,max:-6,color:V[500]},{min:-6,max:-3,color:V[400]},{min:-3,max:-1,color:V[300]},{min:0,max:0,color:a.palette.grey[200]},{min:1,max:3,color:J[300]},{min:3,max:6,color:J[400]},{min:6,max:9,color:J[500]},{min:9,max:Number.MAX_SAFE_INTEGER,color:J[600]}],orient:"horizontal",left:"center",bottom:12,itemWidth:12,itemHeight:12,textStyle:{color:a.palette.text.secondary,fontSize:12}},calendar:{top:30,left:50,right:10,bottom:4,cellSize:[8,8],splitLine:{show:!1},itemStyle:{borderWidth:2,borderColor:a.palette.background.default,color:a.palette.background.default},dayLabel:{show:!0,firstDay:0,nameMap:["","Mon","","Wed","","Fri",""],position:"start",margin:4,fontSize:10,color:a.palette.text.primary,fontWeight:"400",width:20},monthLabel:{show:!0,nameMap:"cn",align:"left",color:a.palette.text.primary,fontWeight:"400",fontSize:12,position:"start",margin:4,width:30,padding:[0,2]},yearLabel:{show:!1},range:[E().subtract(11,"month").startOf("month").format("YYYY-MM-DD"),E().endOf("month").format("YYYY-MM-DD")],orient:"horizontal"},series:{type:"heatmap",coordinateSystem:"calendar",data:i.map(k=>[k.date,k.errorCount?-k.errorCount:k.successCount]),label:{show:!1},itemStyle:{borderWidth:2,borderColor:a.palette.background.default,borderRadius:4},emphasis:{itemStyle:{borderWidth:2,borderColor:Ke[200],color:"inherit"}}}}),[i,t,a]);return e.jsxs(e.Fragment,{children:[e.jsx(h,{ref:r,sx:{maxWidth:"1280px",border:"1px solid",borderColor:"divider",padding:"8px",overflowX:"auto"},children:e.jsx(h,{sx:{width:"1200px",height:"180px",position:"relative"},children:e.jsx(Et,{option:d,style:{height:"100%",width:"100%"},notMerge:!0,lazyUpdate:!1,opts:{renderer:"canvas"},onEvents:{click:l=>{l.componentType==="series"&&l.data&&c(l.data[0])}}})})}),e.jsx(h,{sx:{display:"flex",justifyContent:"flex-end",mt:1,mr:s?2:5,mb:2},children:e.jsxs(K,{direction:s?"column":"row",spacing:s?2:1,sx:{width:"100%",justifyContent:"flex-start",alignItems:s?"flex-start":"center"},children:[e.jsxs(K,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(h,{sx:{width:32,height:12,borderRadius:.5,background:"linear-gradient(90deg, #8B5000 0%, #A36200 33%, #C17700 66%, #E29000 100%)"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.failed")})]}),e.jsxs(K,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(h,{sx:{width:32,height:12,borderRadius:.5,bgcolor:"grey.200",border:"1px solid",borderColor:"grey.200"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.without")})]}),e.jsxs(K,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(h,{sx:{width:32,height:12,borderRadius:.5,background:"linear-gradient(90deg, #9be9a8 0%, #40c463 33%, #30a14e 66%, #216e39 100%)"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.succeeded")})]})]})})]})}const Nt=fe(({className:t,...n})=>e.jsx(ge,{...n,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function Ae({status:t,message:n="",createdAt:o}){const{t:s}=D(),r=t===T.BACKUPS.STATUS.PROGRESS&&E().diff(o,"hours")>=T.BACKUPS.TIMEOUT_HOURS,a=r&&s("common.timeoutError"),c=t===T.BACKUPS.STATUS.PROGRESS&&!r,i=t===T.BACKUPS.STATUS.SUCCEEDED&&!r;return c?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(z,{sx:{marginRight:"4px"},size:"12px"}),s("common.progress")]}):i?e.jsx(q,{type:"success",children:s("common.succeeded")}):e.jsxs(h,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(q,{type:"error",children:s("common.failed")}),e.jsx(ge,{style:{display:"flex",alignItems:"center",flexShrink:0},title:n||a,children:e.jsx(be,{children:e.jsx(Ye,{style:{width:"24px",height:"24px"},color:"error"})})})]})}Ae.propTypes={status:u.string.isRequired,message:u.string,createdAt:u.string.isRequired};function ze({metadata:t={}}){const{t:n}=D();if(H(t))return e.jsx(q,{type:"success",children:n("common.succeeded")});const o=t.count||0,s=t.size||0,r=It(s,{iec:!0}),a=e.jsxs(h,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:[e.jsxs(j,{variant:"body2",children:[n("common.fileCount"),": ",o]}),e.jsxs(j,{variant:"body2",children:[n("common.fileSize"),": ",r]})]});return e.jsxs(h,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(q,{type:"success",children:n("common.succeeded")}),e.jsx(Nt,{title:a,style:{display:"flex",alignItems:"center",flexShrink:0},placement:"left",children:e.jsx(be,{children:e.jsx(Fe,{style:{width:"24px",height:"24px"},color:"primary"})})})]})}ze.propTypes={metadata:u.object};function Oe(){const{t,locale:n}=D(),{spaceGateways:o,backups:s,backupsLoading:r}=U(),a=b.useMemo(()=>[{label:"DID Space",name:"target",options:{customBodyRenderLite:i=>{const{targetUrl:d,targetName:l,status:x,createdAt:g}=s[i],m=x===T.BACKUPS.STATUS.PROGRESS&&E().diff(g,"hours")>=T.BACKUPS.TIMEOUT_HOURS,p=x===T.BACKUPS.STATUS.SUCCEEDED&&!m,k=l||o.find(w=>d?.includes(xe(w?.endpoint)))?.name||"Unknown DID Space";return p?e.jsx(Ge,{href:d,target:"_blank",sx:{fontSize:"16px"},children:k}):e.jsx(j,{variant:"body1",sx:{fontSize:"16px"},children:k})}}},{label:t("common.strategy"),name:"strategy",options:{customBodyRender:i=>{const d=t(i===0?"common.auto":"common.manual");return e.jsx(q,{children:d})}}},{label:t("common.startTime"),name:"createdAt",options:{customBodyRender:i=>E(i).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.endTime"),name:"updatedAt",options:{customBodyRender:i=>H(i)?"":E(i).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.status"),name:"status",options:{customBodyRenderLite:i=>{const d=s?.[i]??{},{status:l,message:x,createdAt:g,metadata:m}=d,p=l===T.BACKUPS.STATUS.PROGRESS&&E().diff(g,"hours")>=T.BACKUPS.TIMEOUT_HOURS,k=l===T.BACKUPS.STATUS.PROGRESS&&!p,w=l===T.BACKUPS.STATUS.SUCCEEDED&&!p;return k?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(z,{sx:{marginRight:"4px"},size:"12px"}),t("common.progress")]}):w?e.jsx(ze,{metadata:m}):e.jsx(Ae,{status:l,message:x,createdAt:g})}}}],[s,o,t]),c=b.useMemo(()=>!s?.length,[s]);return e.jsx(e.Fragment,{children:c?e.jsx(h,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100px",color:"#9397A1",marginTop:"16px",marginBottom:"24px"},children:t("storage.spaces.record.emptyData")}):e.jsx(rt,{title:"",loading:r,data:s,columns:a,emptyNode:t("storage.spaces.record.emptyData",n),options:{download:!1,filter:!1,print:!1,search:!1,viewColumns:!1}})})}function _t(){const{t}=D();return e.jsxs(h,{children:[e.jsxs(h,{sx:{display:"flex",gap:3,flexDirection:{xs:"column",md:"row"}},children:[e.jsxs(h,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",alignContent:"center",minWidth:240},children:[e.jsx(xt,{style:{cursor:"pointer",width:"150px",height:"100%",maxHeight:160}}),e.jsx(j,{sx:{my:2,textAlign:"center",color:"text.secondary"},children:t("storage.spaces.connect.provider")}),e.jsx(Re,{})]}),e.jsxs(h,{sx:{flexGrow:1,minWidth:0},children:[e.jsx(h,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:t("storage.spaces.backup.records")})}),e.jsx(ve,{})]})]}),e.jsx(Oe,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2,mt:2},children:t("common.dataStorage")}),e.jsx(Pe,{})]})}function Le({spaceGateway:t,onConfirm:n=()=>{},onCancel:o=()=>{}}){const{t:s}=D(),[r,a]=b.useState(!1),[c,i]=b.useState(!1),d=(g,m)=>{g?.preventDefault(),g?.stopPropagation(),a(m)},l=async g=>{try{g?.stopPropagation(),i(!0),await n?.(t),a(!1)}catch(m){console.error(m),B.error(`${s("storage.space.gateway.delete.failed")}: ${Q(m)}`)}finally{a(!1),i(!1)}},x=g=>{d(g,!1),o?.(g)};return e.jsxs(e.Fragment,{children:[e.jsxs(F,{color:"red",onClick:g=>d(g,!0),children:[e.jsx(Y,{style:{minWidth:24,color:"red"},children:e.jsx($e,{fontSize:"small"})}),e.jsx($,{style:{color:"red"},children:s("common.disconnect")})]}),e.jsx(it,{title:s("storage.spaces.gateway.delete.title"),open:r,confirmButton:{text:s("common.confirm"),props:{size:"small",variant:"contained",color:"error",loading:c}},cancelButton:{text:s("common.cancel"),props:{size:"small",variant:"outlined",disabled:c}},onConfirm:l,onCancel:x,children:e.jsx(j,{sx:{wordWrap:"break-word"},children:s("storage.spaces.gateway.delete.descForBackup",{name:`${t?.name}`})})})]})}Le.propTypes={spaceGateway:u.shape({name:u.string.isRequired,url:u.string.isRequired,protected:u.bool}).isRequired,onConfirm:u.func,onCancel:u.func};function Ue({spaceGateway:t,selected:n,onDelete:o=()=>{},onConnect:s=()=>{},enableSwitchToSpace:r=!0,backupInProgress:a=!1,...c}){const{abortBlockletBackup:i}=U(),[d,l]=b.useState(null),{t:x}=D(),[g,m]=b.useState(!1),p=(S,y)=>{S.stopPropagation(),S.preventDefault(),l(y&&S.currentTarget)},k=async S=>{try{m(!0),p(S,!1),await s(t)}catch(y){console.error(y),B.error(y.message)}finally{m(!1)}},w=async S=>{try{m(!0),p(S,!1),await i()}catch(y){console.error(y),B.error(y.message)}finally{m(!1)}};return e.jsxs(e.Fragment,{children:[g||t?.loading?e.jsx(z,{sx:{ml:1},size:"24px"}):e.jsx(qe,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions",variant:"outlined",size:"small",onClick:S=>p(S,!0),...c,children:e.jsx(He,{})}),e.jsxs(Qe,{id:"simple-menu",anchorEl:d,keepMounted:!0,open:!!d,onClose:S=>p(S,!1),children:[e.jsxs(F,{onClick:S=>{p(S,!1),window.open(Se(t.endpoint?Ct(t.endpoint):t.url,{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Xe,{fontSize:"small"})}),e.jsx($,{children:x("common.open")})]}),e.jsxs(F,{onClick:S=>{p(S,!1),window.open(Se(wt(t.endpoint),{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Ve,{fontSize:"small"})}),e.jsx($,{children:x("storage.spaces.strategy.viewBackupFiles")})]}),!n&&r&&e.jsxs(F,{onClick:k,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Je,{fontSize:"small"})}),e.jsx($,{children:x("storage.spaces.connect.switchToSpace")})]}),a&&e.jsxs(F,{onClick:w,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Ze,{fontSize:"small"})}),e.jsx($,{children:x("storage.spaces.connect.abortBlockletBackup")})]}),!a&&e.jsx(Le,{spaceGateway:t,onConfirm:async()=>{l(null),await o?.(t)},onCancel:()=>l(null)})]})]})}Ue.propTypes={spaceGateway:u.shape({name:u.string.isRequired,url:u.string.isRequired,protected:u.bool,endpoint:u.string.isRequired,loading:u.bool}).isRequired,selected:u.bool.isRequired,enableSwitchToSpace:u.bool,onDelete:u.func,onConnect:u.func,backupInProgress:u.bool};const Wt=fe(({className:t,...n})=>e.jsx(ge,{...n,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function Me({spaceGateway:t,spaceStatus:n,selected:o,onConnected:s=()=>{},onDeleted:r=()=>{},onBackedUp:a=()=>{}}){const{t:c,locale:i}=D(),{blocklet:d}=O(),{api:l,info:{did:x}}=L(),{appDid:g,appName:m,appDescription:p,scopes:k,appUrl:w,referrer:S}=De({blocklet:d}),{backupProgress:y,updateSpaceGateway:Z,deleteSpaceGateway:ee,refreshBackupSummary:te,refreshBackups:se}=U(),[_,M]=b.useState(!1),[I,P]=b.useState({open:!1,action:"one-click-authorization",checkTimeout:1e3*300,messages:{title:c("storage.spaces.authorize.title",{appName:m},i),scan:c("storage.spaces.authorize.scan",{appName:m},i),confirm:"",success:e.jsx(j,{gutterBottom:!0,children:c("storage.spaces.authorize.success")})},onClose:()=>{P(C=>({...C,open:!1}))}}),ne=o&&!_&&n===de.DISCONNECTED,oe=o&&!_&&!t.loading&&n===de.CONNECTED,G=o&&_&&n===de.CONNECTED&&y?.progress>=0,X=async()=>{try{if(await Bt(t?.endpoint)){await l.configBlocklet({input:{did:[d.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:t.endpoint}]}}),B.success(c("storage.spaces.connect.switchToSpaceSucceeded",{name:t.name?`(${t.name})`:""})),s?.(null,t);return}}catch(C){console.error(C),s?.(C,t);return}P(C=>({...C,open:!0,prefix:me(t.url,"space/api/did"),baseUrl:new URL(t.url).origin,checkFn:we.create({baseURL:me(t.url,"space")}).get,extraParams:{appDid:g,appName:m,appDescription:p,scopes:k,appUrl:w,referrer:S,nodeDid:x,spaceDid:t.did}}))},ae=async(C,f)=>{const A=f(C.endpoint),R=xe(A),v=C.space?f(C.space):{};if(t.did&&R!==t.did){P(Ne=>({...Ne,open:!1}));const W=c("storage.spaces.gateway.switch.failedForMismatchSpace",{name:v?.name?v.name:""});B.error(W),s?.(new Error(W),t);return}const ce={...t,name:v.name??"DID Space",did:v.did??xe(A),endpoint:A};await Z(ce),P(W=>({...W,open:!1})),s?.(null,ce)},re=async()=>{try{if(_)return;M(!0),await l.backupBlocklet({input:{appDid:d.appDid,to:"spaces"}})}catch(C){console.error(C),B.error(C.message),a?.(C,t)}finally{M(!0)}},ie=async()=>{try{await ee(t),B.success(c("storage.spaces.gateway.delete.succeeded",{name:t.name?`(${t.name})`:""})),r?.(null,t)}catch(C){console.error(C),r?.(C,t)}};return b.useEffect(()=>{y?.completed?(o&&(y?.progress===100?(B.success(c("storage.spaces.backupSuccessfully")),a?.(null,t)):y.message&&a?.(new Error(y?.message),t),y.progress=0,y.message=""),M(!1),te(),se()):y.progress&&M(!0)},[y]),e.jsxs(e.Fragment,{children:[e.jsxs(h,{sx:{display:"flex",alignItems:"center",".action-btn":{borderRadius:1,marginLeft:1}},children:[oe&&e.jsx(le,{className:"action-btn",variant:"outlined",size:"small",onClick:re,children:c("storage.spaces.strategy.backupNow")}),ne&&e.jsx(le,{className:"action-btn",variant:"outlined",size:"small",onClick:X,children:c("storage.spaces.disconnected.reconnectNow")}),G&&e.jsx(Wt,{title:y?.message&&e.jsx(h,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:e.jsx(j,{variant:"body2",children:y.message})}),children:e.jsxs(le,{className:"action-btn",variant:"outlined",size:"small",sx:{minWidth:70},children:[e.jsx(z,{variant:"determinate",value:y?.progress,size:14,sx:{mr:1}}),y?.progress,"%"]})}),e.jsx(ot,{forceConnected:!1,saveConnect:!1,prefix:I.prefix,open:I.open,popup:!0,action:I.action,baseUrl:I.baseUrl,checkFn:I.checkFn,onSuccess:ae,onClose:I.onClose,checkTimeout:I.checkTimeout,extraParams:I.extraParams,messages:I.messages,locale:i},"get-endpoint")]}),e.jsx(Ue,{sx:{minWidth:32,padding:"2px 4px",ml:1},spaceGateway:t,selected:o,onDelete:ie,onConnect:X,enableSwitchToSpace:y?.completed||H(y?.message),backupInProgress:G})]})}Me.propTypes={spaceGateway:u.shape({did:u.string.isRequired,name:u.string.isRequired,url:u.string.isRequired,endpoint:u.string.isRequired,protected:u.bool,loading:u.bool}).isRequired,spaceStatus:u.string.isRequired,selected:u.bool.isRequired,onConnected:u.func,onDeleted:u.func,onBackedUp:u.func};function Kt({...t}){const{t:n}=D();return e.jsxs(h,{...t,children:[e.jsx(h,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:n("storage.spaces.backup.records")})}),e.jsx(ve,{}),e.jsx(Oe,{})]})}function Gt({...t}){const{t:n}=D(),{autoBackup:o,updateAutoBackup:s}=U(),r=async()=>{try{const a=!o?.enabled;await s({enabled:a}),B.success(n(a?"storage.spaces.autoBackup.enabled":"storage.spaces.autoBackup.disabled"))}catch(a){B.error(a.message)}};return e.jsx(Tt,{checked:!!o?.enabled,onChange:r,name:"enableWelcomePage",labelProps:{label:e.jsx(j,{sx:{marginRight:"8px"},children:e.jsx("span",{children:n("storage.spaces.autoBackup.title")})})},style:{...t.style}})}function Ft(){const{t}=D(),{spaceGateways:n,spaceGatewaysLoading:o,spaceGatewayIsSelected:s}=U(),r=o&&!n?.length,a=({spaceGateway:c,spaceStatus:i,selected:d,refresh:l})=>e.jsx(Me,{spaceGateway:c,spaceStatus:i,selected:d,onConnected:()=>l(),onBackedUp:x=>x&&l()});return e.jsxs(h,{sx:{display:"flex",flexDirection:"column"},children:[e.jsxs(h,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},gap:{xs:1,md:2},justifyContent:{xs:"center",md:"flex-start"},alignItems:{xs:"flex-start",md:"center"}},children:[e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",flexGrow:1},children:t("storage.spaces.connected.title")}),e.jsx(Gt,{}),e.jsx(Re,{})]}),e.jsx(h,{sx:{mt:2},children:r?e.jsx(h,{sx:{display:"flex",justifyContent:"center"},children:e.jsx(z,{})}):e.jsx(he,{container:!0,spacing:2,children:e.jsx(e.Fragment,{children:n.map(c=>e.jsx(he,{size:{xs:12,md:6},children:e.jsx(ft,{endpoint:c.endpoint,selected:s(c),action:a},c.endpoint)},c.endpoint))})})}),e.jsx(Kt,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2},children:t("common.dataStorage")}),e.jsx(Pe,{})]})}function Yt(){const{spaceGatewaysFirstLoading:t,spaceGateways:n}=U();return t?e.jsx(Be,{relative:"parent",children:e.jsx(z,{})}):H(n)?e.jsx(_t,{}):e.jsx(Ft,{})}function $t(){return e.jsx(Te,{children:e.jsx(Yt,{})})}function qt(){const{spaceGateway:t,settingStorageEndpoint:n,updateSpaceGateway:o,hasStorageEndpoint:s,loading:r,storageEndpoint:a}=Pt(),c=ue(()=>({display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"16px"}));return r?e.jsx(Be,{relative:"parent",children:e.jsx(z,{})}):e.jsxs(h,{sx:{maxWidth:"md",position:"relative"},children:[s?e.jsx(gt,{spaceGateway:t,settingStorageEndpoint:n}):e.jsx(ht,{}),e.jsx(h,{sx:c,children:e.jsx(St,{onConnect:o,storageEndpoint:a})})]})}function Ht(){const{t}=D();return e.jsxs(Rt,{children:[e.jsxs(K,{spacing:1,sx:{marginBottom:2},children:[e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:t("storage.appLevel.title")}),e.jsx(j,{sx:{color:"text.secondary"},children:t("storage.appLevel.description")})]}),e.jsx(qt,{})]})}function Qt({navOrientation:t="vertical",...n}){const{t:o,locale:s}=D(),{blocklet:r}=O(),a=lt({key:"md"}),[c,i]=et(),d=c.get("tab")||"backup",l=a?"horizontal":t,x=ue(()=>{const w=[{label:o("common.backup"),value:"backup"}],S=r?.capabilities?.didSpace;return(S===N.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED||S===N.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP)&&w.push({label:o("common.storage"),value:"storage"}),w},[s,l]),m=ue(()=>({backup:e.jsx($t,{}),storage:e.jsx(Ht,{})}))[d],p=w=>{i(S=>(w==="backup"?S.delete("tab"):S.set("tab",w),S))};if(x.length<=1)return e.jsx(pe,{children:m});const k=e.jsx(ct,{tabs:x,current:d,orientation:l,onChange:p,sx:[{borderRight:1,height:"100%",borderColor:"divider"},l==="horizontal"&&{borderRight:0}]});if(l==="vertical")return e.jsx(h,{...n,children:e.jsxs(K,{direction:{md:"column",lg:"row"},sx:{gap:2},children:[e.jsx(h,{sx:{flexShrink:0},children:e.jsx(ye,{left:k})}),e.jsx(h,{sx:{flexGrow:1,minWidth:0},children:e.jsx(pe,{sx:{mt:1},children:m})})]})});if(l==="horizontal")return e.jsxs(h,{...n,children:[e.jsx(ye,{left:k}),e.jsx(pe,{sx:{mt:2},children:m})]})}Qt.propTypes={navOrientation:u.oneOf(["vertical","horizontal"])};const pe=fe(h)`
|
|
1
|
+
import{j as e,W as u,a6 as z,T as j,at as _e,D as We,cH as V,ao as J,cI as Ke,ak as h,b1 as K,a$ as Ge,s as fe,cJ as be,co as Fe,am as ge,cq as Ye,M as F,aO as Y,bX as $e,aP as $,Q as qe,be as He,aR as Qe,cK as Xe,cL as Ve,cM as Je,cN as Ze,c2 as he}from"./vendor-mui-core-BPcN1m8_.js";import{k as ke,j as je,a as ue}from"./vendor-hooks-iFsOjihK.js";import{r as b,u as et}from"./vendor-react-Dvs43sk9.js";import{ac as O,_ as L,a1 as E,Y as N,aQ as tt,aR as st,aI as nt,c as T,v as ot}from"./index-Bero09ZY.js";import{H as B,V as D,q as at,a2 as q,x as rt,a4 as it,n as le,A as ct}from"./vendor-ux-CheVAuK7.js";import{u as lt}from"./use-mobile-Bjbo_Gou.js";import{a as H,d as Ce,a0 as dt,c as pt,D as we,C as me}from"./vendor-utils-D6HS5QsS.js";import{o as Be}from"./vendor-arcblock-B0VYnHWE.js";import{b as ut,u as mt,D as xt,c as de,a as ft}from"./index-DUiyqDLR.js";import"./index-PwQ2doS3.js";import"./index-BojVbZw0.js";import"./api-VWP7Oo6L.js";import{u as De,C as gt,D as ht,a as St}from"./connect-to-BrFtlkBE.js";import{b as yt,c as bt,d as kt,i as jt,e as xe,f as Ct,h as wt,j as Bt}from"./spaces-V5-JD9i7.js";import{f as Q}from"./index-DBs9Ljax.js";import{v as Dt}from"./index-DlPcYWy3.js";import{E as Et}from"./index-WzLE1u-g.js";import{x as It}from"./index-DRYJ0xIl.js";import{g as Se}from"./get-safe-url-DEmvtN3J.js";import{S as Tt}from"./switch-control-CG7qdize.js";import{C as Rt,u as Pt}from"./config-space-k6_NPjjD.js";import{L as ye}from"./list-header-BNFs7V0b.js";import"./lottie-web-4koyQiv_.js";import"./index-BTBrooUu.js";async function At({blockletDid:t,nodeApi:n,spaceGateways:o}){let s=!1;const r=await Promise.all(o.map(async a=>{let{name:c}=a;const i=await yt(a.endpoint);return!H(i)&&i!==c&&(c=i,s=!0),{...a,name:c}}));return s&&await Promise.all(r.filter(a=>a.did).map(a=>n.updateBlockletSpaceGateway({input:{did:t,where:{did:a.did},spaceGateway:{...a}}}))),r}function vt({refresh:t}={}){const{blocklet:n}=O(),o=n?.meta?.did,{api:s}=L();return ke(async()=>{if(!o)return[];const{spaceGateways:r}=await s.getBlockletSpaceGateways({input:{did:o}});return await At({blockletDid:o,nodeApi:s,spaceGateways:r})??[]},{refreshDeps:[o,t],onError(r){r?.message?.includes("not logged")?console.warn(r):(console.error(r),B.error(Q(r)))}})}function Ee({deps:t,setLoading:n,backupDate:o}={deps:[],setLoading:()=>{},backupDate:new Date}){const{blocklet:s}=O(),[r,a]=b.useState([]),{api:c}=L(),[i,d]=b.useMemo(()=>o?[E(o).startOf("day").toISOString(),E(o).endOf("day").toISOString()]:[E().startOf("year").toISOString(),E().endOf("day").toISOString()],[o]),l=Ce(async()=>{try{if(n(!0),!s){a([]);return}const{backups:x}=await c.getBlockletBackups({input:{did:s.meta.did,startTime:i,endTime:d}});a(x??[])}catch(x){console.error(x),B.error(Q(x))}finally{n(!1)}},1e3);return je(async()=>{l()},[s?.meta?.did].concat(t)),{backups:r}}function zt({appDid:t}){const{backups:n}=Ee(),[o,s]=b.useState({message:"",progress:0,completed:!1}),r=L(),{ws:{useSubscription:a}}=r;return a(N.BlockletEvents.backupProgress,c=>{t===c?.appDid&&s(()=>({...c}))},[t]),b.useEffect(()=>{if(n?.length&&dt(n[0]?.status)){const[c]=n;s(()=>({message:c.message,progress:c.progress,completed:c.progress>=100}))}},[n]),o}function Ot({deps:t=[],setLoading:n=()=>{}}={}){const{blocklet:o}=O(),[s,r]=b.useState([]),{api:a}=L(),c=b.useCallback(Ce(async()=>{if(!a||!o?.meta?.did){r([]);return}try{n(!0);const i=E(),d=i.subtract(1,"year"),{summary:l}=await a.getBlockletBackupSummary({input:{did:o.meta.did,startTime:d.toISOString(),endTime:i.toISOString()}});r(Array.isArray(l)?l:[])}catch(i){console.error("Failed to fetch backup summary:",i),B.error(Q(i)),r([])}finally{n(!1)}},1e3),[]);return je(async()=>(await c(),()=>{c.cancel()}),[o?.meta?.did].concat(t)),{backupSummary:s}}const Ie=b.createContext({}),{Provider:Lt,Consumer:bs}=Ie;function Te({children:t}){const{t:n}=D(),{api:o}=L(),{blocklet:s}=O(),[r,a]=b.useState(null),[c,i]=b.useState(!1),{data:d,loading:l,mutate:x}=vt({refresh:c}),g=pt(d),m=zt({appDid:s?.appDid}),p=b.useMemo(()=>bt(s?.environments),[s?.environments]),[k,w]=b.useState(!1),[S,y]=b.useState(0),{backups:Z}=Ee({deps:[S,r],setLoading:w,backupDate:r}),[ee,te]=b.useState(0),{backupSummary:se}=Ot({deps:[ee]}),[_,M]=b.useState(d?.find(f=>f.endpoint===p)),I=s?.settings?.autoBackup,P=()=>{i(f=>!f)},ne=()=>{te(f=>f+1)},oe=()=>{y(f=>f+1)},G=async f=>{await o.updateAutoBackup({input:{did:s.meta.did,autoBackup:f}})},X=async()=>{await o.abortBlockletBackup({input:{appPid:s.meta.did}})},ae=async(f,v)=>{try{x(R=>{const A=[...R];return A.push({...f,loading:!0}),A}),await o.addBlockletSpaceGateway({input:{did:s.meta.did,spaceGateway:f}}),p!==v&&await o.configBlocklet({input:{did:[s.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:v}]}}),M(f),P(),B.success(n("storage.spaces.connectedWithName",{name:f?.name??"DID Spaces"}))}catch(R){throw console.error(R),x(A=>[...A].filter(W=>W.did!==f.did)),R}},re=async f=>{f&&(f.endpoint===p&&(await o.configBlocklet({input:{did:[s.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),I?.enabled&&await G({enabled:!1})),await o.deleteBlockletSpaceGateway({input:{did:s.meta.did,spaceGatewayDid:f?.did}}),x(v=>{const R=[...v];return R.splice(R.indexOf(f),1),R}),M(f),P())},ie=async f=>{await Promise.all([o.updateBlockletSpaceGateway({input:{did:s.meta.did,where:{did:f.did},spaceGateway:f}}),p!==f.endpoint&&o.configBlocklet({input:{did:[s.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:f.endpoint}]}})]),B.success(n("storage.spaces.connectedWithName",{name:f?.name??"DID Spaces"})),P()},C=f=>f?.endpoint===p;return e.jsx(Lt,{value:{spaceGateways:d||[],selectedSpaceGateway:_,addSpaceGateway:ae,deleteSpaceGateway:re,updateSpaceGateway:ie,refreshSpaceGateways:P,spaceGatewaysLoading:l,spaceGatewaysFirstLoading:g,spaceGatewayIsSelected:C,updateAutoBackup:G,abortBlockletBackup:X,backupEndpoint:p,backupProgress:m,backups:Z,backupSummary:se,refreshBackupSummary:ne,refreshBackups:oe,setBackupDate:a,backupsLoading:k,autoBackup:I},children:t})}Te.propTypes={children:u.any.isRequired};function U(){return b.useContext(Ie)}function Re({...t}){const{blocklet:n}=O(),{info:o}=L(),{t:s}=D(),r=De({blocklet:n}),a=tt(o),{spaceGateways:c,addSpaceGateway:i}=U(),d={checkFn:we.create({baseURL:me(window.location.origin,st())}).get,webWalletUrl:a,extraParams:{appPid:n.appPid,appDid:r.appDid,appName:r.appName,appDescription:r.appDescription,appUrl:r.appUrl,referrer:r.referrer,scopes:r.scopes,nodeDid:o.did}},l=async({endpoint:g,name:m,did:p})=>{const k=await kt(g);if(!await jt(k)){B.error(s("storage.spaces.gateway.add.invalidUrl"));return}if(c.some(y=>y.endpoint===g)){B.error(s("storage.spaces.gateway.add.duplicate",{name:m}));return}await i({name:m,did:p,url:k,endpoint:g},g)},x=async({spaceGateway:g})=>{try{await l(g)}catch(m){console.error(m),B.error(Q(m))}};return e.jsx(ut,{...t,connectScope:"app",options:d,onSuccess:x})}function Ut(){const{api:t}=L(),{blocklet:n}=O(),{data:o,loading:s}=ke(()=>t.getBlocklet({input:{did:n?.meta?.did,attachDiskInfo:!0,attachRuntimeInfo:!0}}),{ready:!!n?.meta?.did,refreshDeps:[n?.meta?.did]});return{blocklet:o?.blocklet??null,loading:s}}function Pe({...t}){const{t:n}=b.useContext(at),{blocklet:o,loading:s}=Ut();if(o?.diskInfo){const r=(i,d,l)=>e.jsxs(j,{children:[i," ",e.jsx("strong",{children:d?nt(d):"empty"})]}),a=o.environments.reduce((i,d)=>(i[d.key]=d.value,i),{}),c=[{key:"appDir",name:n("blocklet.diskInfo.appDir"),value:r(a.BLOCKLET_APP_DIR,o.diskInfo.app)},{key:"dataDir",name:n("blocklet.diskInfo.dataDir"),value:r(a.BLOCKLET_DATA_DIR,o.diskInfo.data)},{key:"logDir",name:n("blocklet.diskInfo.logDir"),value:r(a.BLOCKLET_LOG_DIR,o.diskInfo.log)},{key:"cacheDir",name:n("blocklet.diskInfo.cacheDir"),value:r(a.BLOCKLET_CACHE_DIR,o.diskInfo.cache)}];return e.jsx(Mt,{component:"div",...t,children:c.map(i=>e.jsx(Dt,{valueComponent:"div",nameWidth:120,name:i.name,children:i.value},i.key))})}return s?e.jsx(z,{}):e.jsx(j,{children:n("blocklet.diskInfo.empty")})}const Mt=_e(j)``;function Ae(){const{t}=D(),{setBackupDate:n,backupSummary:o}=U(),s=mt({key:"lg"}),r=b.useRef(null),a=We(),c=b.useCallback(l=>{n(l)},[n]),i=b.useMemo(()=>{const l=E().add(1,"day"),x=l.subtract(1,"year"),g=new Map(o.map(p=>[p.date,{date:p.date,successCount:p.successCount,errorCount:p.errorCount}])),m=[];for(let p=x.clone();E(p).isBefore(l);p=p.add(1,"day")){const k=p.format("YYYY-MM-DD");m.push(g.get(k)||{date:k,successCount:0,errorCount:0})}return m},[o]),d=b.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:12},tooltip:{formatter:k=>{const{date:w,successCount:S,errorCount:y}=i[k.dataIndex]||{date:k.data[0],successCount:0,errorCount:0};return[`<div>${t("common.time")}: ${w}</div>`,`<div>${t("common.succeeded")}: ${S}</div>`,`<div>${t("common.failed")}: ${y}</div>`].join(`
|
|
2
|
+
`)},backgroundColor:a.palette.background.paper,borderColor:a.palette.divider,textStyle:{color:a.palette.text.primary,fontSize:14},extraCssText:`box-shadow: ${a.shadows[2]}; border-radius: 4px;`,padding:[8,10]},visualMap:{show:!1,min:-12,max:12,pieces:[{min:Number.MIN_SAFE_INTEGER,max:-9,color:V[600]},{min:-9,max:-6,color:V[500]},{min:-6,max:-3,color:V[400]},{min:-3,max:-1,color:V[300]},{min:0,max:0,color:a.palette.grey[200]},{min:1,max:3,color:J[300]},{min:3,max:6,color:J[400]},{min:6,max:9,color:J[500]},{min:9,max:Number.MAX_SAFE_INTEGER,color:J[600]}],orient:"horizontal",left:"center",bottom:12,itemWidth:12,itemHeight:12,textStyle:{color:a.palette.text.secondary,fontSize:12}},calendar:{top:30,left:50,right:10,bottom:4,cellSize:[8,8],splitLine:{show:!1},itemStyle:{borderWidth:2,borderColor:a.palette.background.default,color:a.palette.background.default},dayLabel:{show:!0,firstDay:0,nameMap:["","Mon","","Wed","","Fri",""],position:"start",margin:4,fontSize:10,color:a.palette.text.primary,fontWeight:"400",width:20},monthLabel:{show:!0,nameMap:"cn",align:"left",color:a.palette.text.primary,fontWeight:"400",fontSize:12,position:"start",margin:4,width:30,padding:[0,2]},yearLabel:{show:!1},range:[E().subtract(11,"month").startOf("month").format("YYYY-MM-DD"),E().endOf("month").format("YYYY-MM-DD")],orient:"horizontal"},series:{type:"heatmap",coordinateSystem:"calendar",data:i.map(k=>[k.date,k.errorCount?-k.errorCount:k.successCount]),label:{show:!1},itemStyle:{borderWidth:2,borderColor:a.palette.background.default,borderRadius:4},emphasis:{itemStyle:{borderWidth:2,borderColor:Ke[200],color:"inherit"}}}}),[i,t,a]);return e.jsxs(e.Fragment,{children:[e.jsx(h,{ref:r,sx:{maxWidth:"1280px",border:"1px solid",borderColor:"divider",padding:"8px",overflowX:"auto"},children:e.jsx(h,{sx:{width:"1200px",height:"180px",position:"relative"},children:e.jsx(Et,{option:d,style:{height:"100%",width:"100%"},notMerge:!0,lazyUpdate:!1,opts:{renderer:"canvas"},onEvents:{click:l=>{l.componentType==="series"&&l.data&&c(l.data[0])}}})})}),e.jsx(h,{sx:{display:"flex",justifyContent:"flex-end",mt:1,mr:s?2:5,mb:2},children:e.jsxs(K,{direction:s?"column":"row",spacing:s?2:1,sx:{width:"100%",justifyContent:"flex-start",alignItems:s?"flex-start":"center"},children:[e.jsxs(K,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(h,{sx:{width:32,height:12,borderRadius:.5,background:"linear-gradient(90deg, #8B5000 0%, #A36200 33%, #C17700 66%, #E29000 100%)"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.failed")})]}),e.jsxs(K,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(h,{sx:{width:32,height:12,borderRadius:.5,bgcolor:"grey.200",border:"1px solid",borderColor:"grey.200"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.without")})]}),e.jsxs(K,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(h,{sx:{width:32,height:12,borderRadius:.5,background:"linear-gradient(90deg, #9be9a8 0%, #40c463 33%, #30a14e 66%, #216e39 100%)"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.succeeded")})]})]})})]})}const Nt=fe(({className:t,...n})=>e.jsx(ge,{...n,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function ve({status:t,message:n="",createdAt:o}){const{t:s}=D(),r=t===T.BACKUPS.STATUS.PROGRESS&&E().diff(o,"hours")>=T.BACKUPS.TIMEOUT_HOURS,a=r&&s("common.timeoutError"),c=t===T.BACKUPS.STATUS.PROGRESS&&!r,i=t===T.BACKUPS.STATUS.SUCCEEDED&&!r;return c?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(z,{sx:{marginRight:"4px"},size:"12px"}),s("common.progress")]}):i?e.jsx(q,{type:"success",children:s("common.succeeded")}):e.jsxs(h,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(q,{type:"error",children:s("common.failed")}),e.jsx(ge,{style:{display:"flex",alignItems:"center",flexShrink:0},title:n||a,children:e.jsx(be,{children:e.jsx(Ye,{style:{width:"24px",height:"24px"},color:"error"})})})]})}ve.propTypes={status:u.string.isRequired,message:u.string,createdAt:u.string.isRequired};function ze({metadata:t={}}){const{t:n}=D();if(H(t))return e.jsx(q,{type:"success",children:n("common.succeeded")});const o=t.count||0,s=t.size||0,r=It(s,{iec:!0}),a=e.jsxs(h,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:[e.jsxs(j,{variant:"body2",children:[n("common.fileCount"),": ",o]}),e.jsxs(j,{variant:"body2",children:[n("common.fileSize"),": ",r]})]});return e.jsxs(h,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(q,{type:"success",children:n("common.succeeded")}),e.jsx(Nt,{title:a,style:{display:"flex",alignItems:"center",flexShrink:0},placement:"left",children:e.jsx(be,{children:e.jsx(Fe,{style:{width:"24px",height:"24px"},color:"primary"})})})]})}ze.propTypes={metadata:u.object};function Oe(){const{t,locale:n}=D(),{spaceGateways:o,backups:s,backupsLoading:r}=U(),a=b.useMemo(()=>[{label:"DID Space",name:"target",options:{customBodyRenderLite:i=>{const{targetUrl:d,targetName:l,status:x,createdAt:g}=s[i],m=x===T.BACKUPS.STATUS.PROGRESS&&E().diff(g,"hours")>=T.BACKUPS.TIMEOUT_HOURS,p=x===T.BACKUPS.STATUS.SUCCEEDED&&!m,k=l||o.find(w=>d?.includes(xe(w?.endpoint)))?.name||"Unknown DID Space";return p?e.jsx(Ge,{href:d,target:"_blank",sx:{fontSize:"16px"},children:k}):e.jsx(j,{variant:"body1",sx:{fontSize:"16px"},children:k})}}},{label:t("common.strategy"),name:"strategy",options:{customBodyRender:i=>{const d=t(i===0?"common.auto":"common.manual");return e.jsx(q,{children:d})}}},{label:t("common.startTime"),name:"createdAt",options:{customBodyRender:i=>E(i).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.endTime"),name:"updatedAt",options:{customBodyRender:i=>H(i)?"":E(i).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.status"),name:"status",options:{customBodyRenderLite:i=>{const d=s?.[i]??{},{status:l,message:x,createdAt:g,metadata:m}=d,p=l===T.BACKUPS.STATUS.PROGRESS&&E().diff(g,"hours")>=T.BACKUPS.TIMEOUT_HOURS,k=l===T.BACKUPS.STATUS.PROGRESS&&!p,w=l===T.BACKUPS.STATUS.SUCCEEDED&&!p;return k?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(z,{sx:{marginRight:"4px"},size:"12px"}),t("common.progress")]}):w?e.jsx(ze,{metadata:m}):e.jsx(ve,{status:l,message:x,createdAt:g})}}}],[s,o,t]),c=b.useMemo(()=>!s?.length,[s]);return e.jsx(e.Fragment,{children:c?e.jsx(h,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100px",color:"#9397A1",marginTop:"16px",marginBottom:"24px"},children:t("storage.spaces.record.emptyData")}):e.jsx(rt,{title:"",loading:r,data:s,columns:a,emptyNode:t("storage.spaces.record.emptyData",n),options:{download:!1,filter:!1,print:!1,search:!1,viewColumns:!1}})})}function _t(){const{t}=D();return e.jsxs(h,{children:[e.jsxs(h,{sx:{display:"flex",gap:3,flexDirection:{xs:"column",md:"row"}},children:[e.jsxs(h,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",alignContent:"center",minWidth:240},children:[e.jsx(xt,{style:{cursor:"pointer",width:"150px",height:"100%",maxHeight:160}}),e.jsx(j,{sx:{my:2,textAlign:"center",color:"text.secondary"},children:t("storage.spaces.connect.provider")}),e.jsx(Re,{})]}),e.jsxs(h,{sx:{flexGrow:1,minWidth:0},children:[e.jsx(h,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:t("storage.spaces.backup.records")})}),e.jsx(Ae,{})]})]}),e.jsx(Oe,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2,mt:2},children:t("common.dataStorage")}),e.jsx(Pe,{})]})}function Le({spaceGateway:t,onConfirm:n=()=>{},onCancel:o=()=>{}}){const{t:s}=D(),[r,a]=b.useState(!1),[c,i]=b.useState(!1),d=(g,m)=>{g?.preventDefault(),g?.stopPropagation(),a(m)},l=async g=>{try{g?.stopPropagation(),i(!0),await n?.(t),a(!1)}catch(m){console.error(m),B.error(`${s("storage.space.gateway.delete.failed")}: ${Q(m)}`)}finally{a(!1),i(!1)}},x=g=>{d(g,!1),o?.(g)};return e.jsxs(e.Fragment,{children:[e.jsxs(F,{color:"red",onClick:g=>d(g,!0),children:[e.jsx(Y,{style:{minWidth:24,color:"red"},children:e.jsx($e,{fontSize:"small"})}),e.jsx($,{style:{color:"red"},children:s("common.disconnect")})]}),e.jsx(it,{title:s("storage.spaces.gateway.delete.title"),open:r,confirmButton:{text:s("common.confirm"),props:{size:"small",variant:"contained",color:"error",loading:c}},cancelButton:{text:s("common.cancel"),props:{size:"small",variant:"outlined",disabled:c}},onConfirm:l,onCancel:x,children:e.jsx(j,{sx:{wordWrap:"break-word"},children:s("storage.spaces.gateway.delete.descForBackup",{name:`${t?.name}`})})})]})}Le.propTypes={spaceGateway:u.shape({name:u.string.isRequired,url:u.string.isRequired,protected:u.bool}).isRequired,onConfirm:u.func,onCancel:u.func};function Ue({spaceGateway:t,selected:n,onDelete:o=()=>{},onConnect:s=()=>{},enableSwitchToSpace:r=!0,backupInProgress:a=!1,...c}){const{abortBlockletBackup:i}=U(),[d,l]=b.useState(null),{t:x}=D(),[g,m]=b.useState(!1),p=(S,y)=>{S.stopPropagation(),S.preventDefault(),l(y&&S.currentTarget)},k=async S=>{try{m(!0),p(S,!1),await s(t)}catch(y){console.error(y),B.error(y.message)}finally{m(!1)}},w=async S=>{try{m(!0),p(S,!1),await i()}catch(y){console.error(y),B.error(y.message)}finally{m(!1)}};return e.jsxs(e.Fragment,{children:[g||t?.loading?e.jsx(z,{sx:{ml:1},size:"24px"}):e.jsx(qe,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions",variant:"outlined",size:"small",onClick:S=>p(S,!0),...c,children:e.jsx(He,{})}),e.jsxs(Qe,{id:"simple-menu",anchorEl:d,keepMounted:!0,open:!!d,onClose:S=>p(S,!1),children:[e.jsxs(F,{onClick:S=>{p(S,!1),window.open(Se(t.endpoint?Ct(t.endpoint):t.url,{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Xe,{fontSize:"small"})}),e.jsx($,{children:x("common.open")})]}),e.jsxs(F,{onClick:S=>{p(S,!1),window.open(Se(wt(t.endpoint),{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Ve,{fontSize:"small"})}),e.jsx($,{children:x("storage.spaces.strategy.viewBackupFiles")})]}),!n&&r&&e.jsxs(F,{onClick:k,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Je,{fontSize:"small"})}),e.jsx($,{children:x("storage.spaces.connect.switchToSpace")})]}),a&&e.jsxs(F,{onClick:w,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Ze,{fontSize:"small"})}),e.jsx($,{children:x("storage.spaces.connect.abortBlockletBackup")})]}),!a&&e.jsx(Le,{spaceGateway:t,onConfirm:async()=>{l(null),await o?.(t)},onCancel:()=>l(null)})]})]})}Ue.propTypes={spaceGateway:u.shape({name:u.string.isRequired,url:u.string.isRequired,protected:u.bool,endpoint:u.string.isRequired,loading:u.bool}).isRequired,selected:u.bool.isRequired,enableSwitchToSpace:u.bool,onDelete:u.func,onConnect:u.func,backupInProgress:u.bool};const Wt=fe(({className:t,...n})=>e.jsx(ge,{...n,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function Me({spaceGateway:t,spaceStatus:n,selected:o,onConnected:s=()=>{},onDeleted:r=()=>{},onBackedUp:a=()=>{}}){const{t:c,locale:i}=D(),{blocklet:d}=O(),{api:l,info:{did:x}}=L(),{appDid:g,appName:m,appDescription:p,scopes:k,appUrl:w,referrer:S}=De({blocklet:d}),{backupProgress:y,updateSpaceGateway:Z,deleteSpaceGateway:ee,refreshBackupSummary:te,refreshBackups:se}=U(),[_,M]=b.useState(!1),[I,P]=b.useState({open:!1,action:"one-click-authorization",checkTimeout:1e3*300,messages:{title:c("storage.spaces.authorize.title",{appName:m},i),scan:c("storage.spaces.authorize.scan",{appName:m},i),confirm:"",success:e.jsx(j,{gutterBottom:!0,children:c("storage.spaces.authorize.success")})},onClose:()=>{P(C=>({...C,open:!1}))}}),ne=o&&!_&&n===de.DISCONNECTED,oe=o&&!_&&!t.loading&&n===de.CONNECTED,G=o&&_&&n===de.CONNECTED&&y?.progress>=0,X=async()=>{try{if(await Bt(t?.endpoint)){await l.configBlocklet({input:{did:[d.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:t.endpoint}]}}),B.success(c("storage.spaces.connect.switchToSpaceSucceeded",{name:t.name?`(${t.name})`:""})),s?.(null,t);return}}catch(C){console.error(C),s?.(C,t);return}P(C=>({...C,open:!0,prefix:me(t.url,"space/api/did"),baseUrl:new URL(t.url).origin,checkFn:we.create({baseURL:me(t.url,"space")}).get,extraParams:{appDid:g,appName:m,appDescription:p,scopes:k,appUrl:w,referrer:S,nodeDid:x,spaceDid:t.did}}))},ae=async(C,f)=>{const v=f(C.endpoint),R=xe(v),A=C.space?f(C.space):{};if(t.did&&R!==t.did){P(Ne=>({...Ne,open:!1}));const W=c("storage.spaces.gateway.switch.failedForMismatchSpace",{name:A?.name?A.name:""});B.error(W),s?.(new Error(W),t);return}const ce={...t,name:A.name??"DID Space",did:A.did??xe(v),endpoint:v};await Z(ce),P(W=>({...W,open:!1})),s?.(null,ce)},re=async()=>{try{if(_)return;M(!0),await l.backupBlocklet({input:{appDid:d.appDid,to:"spaces"}})}catch(C){console.error(C),B.error(C.message),a?.(C,t)}finally{M(!0)}},ie=async()=>{try{await ee(t),B.success(c("storage.spaces.gateway.delete.succeeded",{name:t.name?`(${t.name})`:""})),r?.(null,t)}catch(C){console.error(C),r?.(C,t)}};return b.useEffect(()=>{y?.completed?(o&&(y?.progress===100?(B.success(c("storage.spaces.backupSuccessfully")),a?.(null,t)):y.message&&a?.(new Error(y?.message),t),y.progress=0,y.message=""),M(!1),te(),se()):y.progress&&M(!0)},[y]),e.jsxs(e.Fragment,{children:[e.jsxs(h,{sx:{display:"flex",alignItems:"center",".action-btn":{borderRadius:1,marginLeft:1}},children:[oe&&e.jsx(le,{className:"action-btn",variant:"outlined",size:"small",onClick:re,children:c("storage.spaces.strategy.backupNow")}),ne&&e.jsx(le,{className:"action-btn",variant:"outlined",size:"small",onClick:X,children:c("storage.spaces.disconnected.reconnectNow")}),G&&e.jsx(Wt,{title:y?.message&&e.jsx(h,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:e.jsx(j,{variant:"body2",children:y.message})}),children:e.jsxs(le,{className:"action-btn",variant:"outlined",size:"small",sx:{minWidth:70},children:[e.jsx(z,{variant:"determinate",value:y?.progress,size:14,sx:{mr:1}}),y?.progress,"%"]})}),e.jsx(ot,{forceConnected:!1,saveConnect:!1,prefix:I.prefix,open:I.open,popup:!0,action:I.action,baseUrl:I.baseUrl,checkFn:I.checkFn,onSuccess:ae,onClose:I.onClose,checkTimeout:I.checkTimeout,extraParams:I.extraParams,messages:I.messages,locale:i},"get-endpoint")]}),e.jsx(Ue,{sx:{minWidth:32,padding:"2px 4px",ml:1},spaceGateway:t,selected:o,onDelete:ie,onConnect:X,enableSwitchToSpace:y?.completed||H(y?.message),backupInProgress:G})]})}Me.propTypes={spaceGateway:u.shape({did:u.string.isRequired,name:u.string.isRequired,url:u.string.isRequired,endpoint:u.string.isRequired,protected:u.bool,loading:u.bool}).isRequired,spaceStatus:u.string.isRequired,selected:u.bool.isRequired,onConnected:u.func,onDeleted:u.func,onBackedUp:u.func};function Kt({...t}){const{t:n}=D();return e.jsxs(h,{...t,children:[e.jsx(h,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:n("storage.spaces.backup.records")})}),e.jsx(Ae,{}),e.jsx(Oe,{})]})}function Gt({...t}){const{t:n}=D(),{autoBackup:o,updateAutoBackup:s}=U(),r=async()=>{try{const a=!o?.enabled;await s({enabled:a}),B.success(n(a?"storage.spaces.autoBackup.enabled":"storage.spaces.autoBackup.disabled"))}catch(a){B.error(a.message)}};return e.jsx(Tt,{checked:!!o?.enabled,onChange:r,name:"enableWelcomePage",labelProps:{label:e.jsx(j,{sx:{marginRight:"8px"},children:e.jsx("span",{children:n("storage.spaces.autoBackup.title")})})},style:{...t.style}})}function Ft(){const{t}=D(),{spaceGateways:n,spaceGatewaysLoading:o,spaceGatewayIsSelected:s}=U(),r=o&&!n?.length,a=({spaceGateway:c,spaceStatus:i,selected:d,refresh:l})=>e.jsx(Me,{spaceGateway:c,spaceStatus:i,selected:d,onConnected:()=>l(),onBackedUp:x=>x&&l()});return e.jsxs(h,{sx:{display:"flex",flexDirection:"column"},children:[e.jsxs(h,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},gap:{xs:1,md:2},justifyContent:{xs:"center",md:"flex-start"},alignItems:{xs:"flex-start",md:"center"}},children:[e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",flexGrow:1},children:t("storage.spaces.connected.title")}),e.jsx(Gt,{}),e.jsx(Re,{})]}),e.jsx(h,{sx:{mt:2},children:r?e.jsx(h,{sx:{display:"flex",justifyContent:"center"},children:e.jsx(z,{})}):e.jsx(he,{container:!0,spacing:2,children:e.jsx(e.Fragment,{children:n.map(c=>e.jsx(he,{size:{xs:12,md:6},children:e.jsx(ft,{endpoint:c.endpoint,selected:s(c),action:a},c.endpoint)},c.endpoint))})})}),e.jsx(Kt,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2},children:t("common.dataStorage")}),e.jsx(Pe,{})]})}function Yt(){const{spaceGatewaysFirstLoading:t,spaceGateways:n}=U();return t?e.jsx(Be,{relative:"parent",children:e.jsx(z,{})}):H(n)?e.jsx(_t,{}):e.jsx(Ft,{})}function $t(){return e.jsx(Te,{children:e.jsx(Yt,{})})}function qt(){const{spaceGateway:t,settingStorageEndpoint:n,updateSpaceGateway:o,hasStorageEndpoint:s,loading:r,storageEndpoint:a}=Pt(),c=ue(()=>({display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"16px"}));return r?e.jsx(Be,{relative:"parent",children:e.jsx(z,{})}):e.jsxs(h,{sx:{maxWidth:"md",position:"relative"},children:[s?e.jsx(gt,{spaceGateway:t,settingStorageEndpoint:n}):e.jsx(ht,{}),e.jsx(h,{sx:c,children:e.jsx(St,{onConnect:o,storageEndpoint:a})})]})}function Ht(){const{t}=D();return e.jsxs(Rt,{children:[e.jsxs(K,{spacing:1,sx:{marginBottom:2},children:[e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:t("storage.appLevel.title")}),e.jsx(j,{sx:{color:"text.secondary"},children:t("storage.appLevel.description")})]}),e.jsx(qt,{})]})}function Qt({navOrientation:t="vertical",...n}){const{t:o,locale:s}=D(),{blocklet:r}=O(),a=lt({key:"md"}),[c,i]=et(),d=c.get("tab")||"backup",l=a?"horizontal":t,x=ue(()=>{const w=[{label:o("common.backup"),value:"backup"}],S=r?.capabilities?.didSpace;return(S===N.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED||S===N.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP)&&w.push({label:o("common.storage"),value:"storage"}),w},[s,l]),m=ue(()=>({backup:e.jsx($t,{}),storage:e.jsx(Ht,{})}))[d],p=w=>{i(S=>(w==="backup"?S.delete("tab"):S.set("tab",w),S))};if(x.length<=1)return e.jsx(pe,{children:m});const k=e.jsx(ct,{tabs:x,current:d,orientation:l,onChange:p,sx:[{borderRight:1,height:"100%",borderColor:"divider"},l==="horizontal"&&{borderRight:0}]});if(l==="vertical")return e.jsx(h,{...n,children:e.jsxs(K,{direction:{md:"column",lg:"row"},sx:{gap:2},children:[e.jsx(h,{sx:{flexShrink:0},children:e.jsx(ye,{left:k})}),e.jsx(h,{sx:{flexGrow:1,minWidth:0},children:e.jsx(pe,{sx:{mt:1},children:m})})]})});if(l==="horizontal")return e.jsxs(h,{...n,children:[e.jsx(ye,{left:k}),e.jsx(pe,{sx:{mt:2},children:m})]})}Qt.propTypes={navOrientation:u.oneOf(["vertical","horizontal"])};const pe=fe(h)`
|
|
3
3
|
position: relative;
|
|
4
4
|
min-height: 66vh;
|
|
5
5
|
overflow: hidden;
|