@abtnode/webapp 1.16.54-beta-20251016-050817-2fc632b8 → 1.16.54-beta-20251017-133309-7d40faa6
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/blocklet.js +1 -1
- package/blocklet.yml +1 -1
- package/dist/assets/{AdapterDayjs-NScUj50m.js → AdapterDayjs-Dmdo2xWr.js} +1 -1
- package/dist/assets/{Add-D4EYSG3K.js → Add-BtxJ9S0c.js} +1 -1
- package/dist/assets/ArrowDropDown-CXhfj4YR.js +1 -0
- package/dist/assets/{Autocomplete-Dy_zZ4Oc.js → Autocomplete-BSxdbGZ9.js} +1 -1
- package/dist/assets/{Breadcrumbs-C8gaKT3g.js → Breadcrumbs-BQIMaSsB.js} +1 -1
- package/dist/assets/{ButtonGroup-DcZ0ug1l.js → ButtonGroup-zxfGLX1y.js} +1 -1
- package/dist/assets/{CSSTransition-V4R7ZcvS.js → CSSTransition-BHFpNneQ.js} +1 -1
- package/dist/assets/{CallMerge-KoAXFCaW.js → CallMerge-B1sQW0-H.js} +1 -1
- package/dist/assets/{CardContent-W_hyQjAD.js → CardContent-BQOX_LLY.js} +1 -1
- package/dist/assets/{ChevronLeft-CKiAYw9j.js → ChevronLeft-CjfV9O7Y.js} +1 -1
- package/dist/assets/{ChevronRight-DZiek3NZ.js → ChevronRight-Cq74y-86.js} +1 -1
- package/dist/assets/{Clear---RPVeR7.js → Clear-CmclKblN.js} +1 -1
- package/dist/assets/{DeleteOutline-GpuLmtYQ.js → DeleteOutline-DeY1XytP.js} +1 -1
- package/dist/assets/{Done-DzMcAgjX.js → Done-otpI656Q.js} +1 -1
- package/dist/assets/{Edit-DCJEwDTg.js → Edit-BLOnay32.js} +1 -1
- package/dist/assets/{ErrorOutline-B9LgxSpq.js → ErrorOutline-C62Ptpls.js} +1 -1
- package/dist/assets/{FilterList-CNYUVm5S.js → FilterList-5aPzs6zd.js} +1 -1
- package/dist/assets/{Google-DR320mb8.js → Google-B6ijzIon.js} +1 -1
- package/dist/assets/{HelpOutline-USuznZgn.js → HelpOutline-OM9v4KDS.js} +1 -1
- package/dist/assets/{KeyboardArrowDown-rbx_AuZr.js → KeyboardArrowDown-CKtrlyfg.js} +1 -1
- package/dist/assets/{Launch-DkmyUeYd.js → Launch-BfuKeW3b.js} +1 -1
- package/dist/assets/{Link-CgW5geY5.js → Link-BD8pu5K0.js} +1 -1
- package/dist/assets/{ListItemButton-BhvWhm3n.js → ListItemButton-cn3fH9TW.js} +1 -1
- package/dist/assets/{ListSubheader-BlgmemtO.js → ListSubheader-Ch1RovVQ.js} +1 -1
- package/dist/assets/{LoadingButton-DpbZOfZH.js → LoadingButton-iO4mS6KL.js} +1 -1
- package/dist/assets/{MoreVert-wWXtgLji.js → MoreVert-CdXWMKz-.js} +1 -1
- package/dist/assets/{OpenInNew-B8ApQgxt.js → OpenInNew-BZCBTL61.js} +1 -1
- package/dist/assets/{Refresh-nk8BSp_h.js → Refresh-BLPv71Iw.js} +1 -1
- package/dist/assets/{Search-DV5vJN1H.js → Search-CbRhrT-l.js} +1 -1
- package/dist/assets/{Stepper-Dm3PYaFi.js → Stepper-JXr6cJC3.js} +1 -1
- package/dist/assets/{Switch-czLKbhPZ.js → Switch-D12CiGzx.js} +1 -1
- package/dist/assets/{TableSearch-CAf-ESr9.js → TableSearch-DsuiCyEx.js} +1 -1
- package/dist/assets/{ToggleButtonGroup-Csc72nBu.js → ToggleButtonGroup-CoPX4ob9.js} +1 -1
- package/dist/assets/{UnfoldMore-BQzQy89p.js → UnfoldMore-DoB8mcpO.js} +1 -1
- package/dist/assets/{Verified-CF2yeqGT.js → Verified-CHH9KCap.js} +1 -1
- package/dist/assets/{VerifiedUser-C1tgCpCB.js → VerifiedUser-Brzhri9f.js} +1 -1
- package/dist/assets/{ViewList-CE_c5qLh.js → ViewList-CfykWbFF.js} +1 -1
- package/dist/assets/{_createAggregator-Bnob81wI.js → _createAggregator-DrGf--g5.js} +1 -1
- package/dist/assets/{actions-Cpb8n0Yw.js → actions-BU7VBlNr.js} +1 -1
- package/dist/assets/{actions-DtMFbSMo.js → actions-Dq4cTCeJ.js} +1 -1
- package/dist/assets/{agreement-D_SlINnK.js → agreement-BbZCQgd_.js} +1 -1
- package/dist/assets/api-DAWWUzPu.js +1 -0
- package/dist/assets/{appearance-buyEW0Iv.js → appearance-xpsoTzJy.js} +1 -1
- package/dist/assets/{ar-Ge3t6oI2.js → ar-BQm9lQ4M.js} +1 -1
- package/dist/assets/audit-logs-DXKfeYbe.js +35 -0
- package/dist/assets/{base-chart-E6uEbiC0.js → base-chart-C2185-Xr.js} +1 -1
- package/dist/assets/{blocklet-BSWtuwnH.js → blocklet--AI07_i0.js} +1 -1
- package/dist/assets/{chain-Cxmkzj72.js → chain-Dk4xAHS8.js} +1 -1
- package/dist/assets/{click-to-copy-C5l1aVBQ.js → click-to-copy-BCe_knva.js} +1 -1
- package/dist/assets/cloneDeep-CAK0LBhz.js +1 -0
- package/dist/assets/{collapse-D-q9UEjV.js → collapse-zs9NkhVG.js} +1 -1
- package/dist/assets/{config-navigation-Ck-BfL0o.js → config-navigation-D_6fIzEw.js} +31 -31
- package/dist/assets/{connect-to-sME9XFIO.js → connect-to-DP2mM_22.js} +3 -3
- package/dist/assets/{cssMode-CwQeOUoG.js → cssMode-B399Q_Au.js} +1 -1
- package/dist/assets/{de-CbARTvf4.js → de-D0uPENSq.js} +1 -1
- package/dist/assets/{delete-confirm-CiFwBlNG.js → delete-confirm-Bow13LE9.js} +1 -1
- package/dist/assets/{depsEqual-BHCVOuWA.js → depsEqual-DM_xCHol.js} +1 -1
- package/dist/assets/{detail-u9DgWb-d.js → detail-IWNgMo9A.js} +3 -3
- package/dist/assets/{domains-CuwWHtSp.js → domains-DKCOiTCg.js} +1 -1
- package/dist/assets/{download-B1XuXwBn.js → download-CZMq1lWW.js} +1 -1
- package/dist/assets/{edit.svg-BT2rpJxW.js → edit.svg-MBsEEqxw.js} +1 -1
- package/dist/assets/emotion-cache.browser.esm-89zxT23k.js +1 -0
- package/dist/assets/engine-DjXhikKJ.js +1 -0
- package/dist/assets/{es-CaCbzATO.js → es-Dh4_UfCu.js} +1 -1
- package/dist/assets/{fr-B3yjKUFH.js → fr-CzZWQkiT.js} +1 -1
- package/dist/assets/{freemarker2-B3dcQl4s.js → freemarker2-Bo8Dkz0i.js} +1 -1
- package/dist/assets/{get-safe-url-DfDeYxPo.js → get-safe-url-CWx4sAFH.js} +1 -1
- package/dist/assets/getValidReactChildren-Cg2u2AWU.js +1 -0
- package/dist/assets/{graphqlMode-gWZ1xdel.js → graphqlMode-C-1GELPv.js} +2 -2
- package/dist/assets/{handlebars-DLMgXH9N.js → handlebars-CmlxliCw.js} +1 -1
- package/dist/assets/{hi-q4mhHiIl.js → hi-Do9VCuRi.js} +1 -1
- package/dist/assets/{html-DmYIunqS.js → html-YsXSD8TZ.js} +1 -1
- package/dist/assets/{html-title-B42L4vHs.js → html-title-DV29cJ5k.js} +1 -1
- package/dist/assets/{htmlMode-CyuA6nxS.js → htmlMode-zogUHMrG.js} +1 -1
- package/dist/assets/{id-DTf7aVH8.js → id-Dhhrveu9.js} +1 -1
- package/dist/assets/{iframe-B-84ZVfc.js → iframe-CJvRag0f.js} +1 -1
- package/dist/assets/{index-jC9YQw2A.js → index-1qcmbchL.js} +1 -1
- package/dist/assets/{index-CT-cKo4l.js → index-2sz7KBve.js} +4 -4
- package/dist/assets/index-5gnDPlCv.js +375 -0
- package/dist/assets/{index-tXfQSlPx.js → index-B5lqoaM2.js} +3 -3
- package/dist/assets/index-B7g5Nk1d.js +292 -0
- package/dist/assets/{index-BcBcDLRF.js → index-B8b0rEFF.js} +14 -14
- package/dist/assets/{index-B6fuqqYD.js → index-B9ak8YbX.js} +1 -1
- package/dist/assets/{index-CbD2HRHU.js → index-BAu_h5OW.js} +1 -1
- package/dist/assets/index-BCTcUJyy.js +1 -0
- package/dist/assets/{index-D-dEXSR3.js → index-BFaz_KJO.js} +3 -3
- package/dist/assets/{index-Ca41Albz.js → index-BGcTTdNv.js} +1 -1
- package/dist/assets/{index-DfxHc659.js → index-BN9KmbYU.js} +2 -2
- package/dist/assets/{index-km_8frCh.js → index-BNAHYHIB.js} +1 -1
- package/dist/assets/{index-DaNXTl0n.js → index-BS8Zd79a.js} +1 -1
- package/dist/assets/{index-BkFC8ho3.js → index-BTzUdfyO.js} +3 -3
- package/dist/assets/{index-BHuxYJ36.js → index-BZKNVbcu.js} +1 -1
- package/dist/assets/{index-CHZXKvDD.js → index-BhRJ8iUw.js} +1 -1
- package/dist/assets/{index-m-5ZFaj3.js → index-Biom0VRc.js} +1 -1
- package/dist/assets/{index-E2RuVge2.js → index-Bk3_p0ot.js} +8 -8
- package/dist/assets/{index-DM9vqLT9.js → index-BlU4tJOu.js} +1 -1
- package/dist/assets/{index-DuS26oUH.js → index-BsODnAIr.js} +1 -1
- package/dist/assets/{index-D_ED6Nk7.js → index-Bsb50zao.js} +1 -1
- package/dist/assets/{index-CQ3QiuQQ.js → index-BszCp5iq.js} +1 -1
- package/dist/assets/{index-CGwvwEUr.js → index-BwAtwN98.js} +3 -10
- package/dist/assets/{index-haFP5Loj.js → index-C88zwj1F.js} +1 -1
- package/dist/assets/{index-DgKqbN5Y.js → index-CEVcCpp0.js} +1 -1
- package/dist/assets/{index-CnMT0fo1.js → index-CO6atVP1.js} +1 -1
- package/dist/assets/{index-M4yiF52E.js → index-CQwHcXdR.js} +1 -1
- package/dist/assets/{index-Bb-RBdu9.js → index-Cc5co79B.js} +1 -1
- package/dist/assets/{index-nUrxOkOM.js → index-CeeztwBq.js} +1 -1
- package/dist/assets/{index-D63ritT-.js → index-Cklq_snV.js} +1 -1
- package/dist/assets/{index-BIGgo0dk.js → index-CsAuzX0k.js} +1 -1
- package/dist/assets/{index-DXF1RiG0.js → index-Ctq71AUP.js} +1 -1
- package/dist/assets/{index-DBd6awj_.js → index-CwgLMaiR.js} +1 -1
- package/dist/assets/{index-DxZUfBpk.js → index-Cx0-cDmo.js} +1 -1
- package/dist/assets/index-DPsTv0RC.js +120 -0
- package/dist/assets/{index-CAMlpQ47.js → index-DQDQvvOo.js} +2 -2
- package/dist/assets/{index-B-KmoBb-.js → index-DaWRYFXy.js} +1 -1
- package/dist/assets/{index-BKJPtvsM.js → index-DnFU3fjE.js} +1 -1
- package/dist/assets/{index-D4PsRecd.js → index-DnGfacYV.js} +1 -1
- package/dist/assets/{index-CdnTrItd.js → index-DyqQGUXg.js} +1 -1
- package/dist/assets/{index-B4IIU09Y.js → index-QQLsDnxc.js} +3 -3
- package/dist/assets/{index-Dd5Oo0tk.js → index-_TZ0HsEX.js} +1 -1
- package/dist/assets/{index-u7lHFbWg.js → index-f461L7cH.js} +9 -9
- package/dist/assets/{index-F3HbHSYi.js → index-oppNoNvH.js} +57 -57
- package/dist/assets/{index-Cu6PRXBT.js → index-rDK2F6ft.js} +1 -1
- package/dist/assets/index-t2qXqnLl.js +1 -0
- package/dist/assets/{index.esm-CG55Fmct.js → index.esm-Cc-rWUer.js} +1 -1
- package/dist/assets/{install-from-url-DL-3oQMI.js → install-from-url-Byfhqhtx.js} +1 -1
- package/dist/assets/{invitation-C464OqTr.js → invitation-C7URd--D.js} +1 -1
- package/dist/assets/{is-path-prefix-equal-DCicTZ8d.js → is-path-prefix-equal-DRcxtSPQ.js} +1 -1
- package/dist/assets/{item-DkbrJM2U.js → item-Dad5StUY.js} +1 -1
- package/dist/assets/{ja-Csh_XwzF.js → ja-B70UYq5X.js} +1 -1
- package/dist/assets/{javascript-B0hI_Eyo.js → javascript-CoBTz2gd.js} +1 -1
- package/dist/assets/{jsonMode--kCoJBFT.js → jsonMode-CVMee1RD.js} +1 -1
- package/dist/assets/{ko-xiNTwgO9.js → ko-C7TZwmXC.js} +1 -1
- package/dist/assets/{liquid-BVzOkmM1.js → liquid-D6EIo1wL.js} +1 -1
- package/dist/assets/{list-header-CnD8v8jR.js → list-header-xkh_uL_h.js} +1 -1
- package/dist/assets/{lock.svg-DWUrJ_5S.js → lock.svg-CkFKYDxX.js} +1 -1
- package/dist/assets/{log-CjBZbQrr.js → log-BYawti0X.js} +1 -1
- package/dist/assets/{lottie-react.esm-CcRYYgsR.js → lottie-react.esm-CySu6b9e.js} +1 -1
- package/dist/assets/{mdx-DOswkMzX.js → mdx-BEdivZjl.js} +1 -1
- package/dist/assets/{memory-BkrGYits.js → memory-Badimsp_.js} +1 -1
- package/dist/assets/{metric-CNxVptGa.js → metric-CtFXUNX3.js} +1 -1
- package/dist/assets/omit-D0KFhbLk.js +1 -0
- package/dist/assets/{overview-BWjjo7YM.js → overview-K7CavXZw.js} +1 -1
- package/dist/assets/{permission-caYaN7o4.js → permission-DZytcuWC.js} +1 -1
- package/dist/assets/{preference-D-1nO1Na.js → preference-CrZ37X3N.js} +3 -3
- package/dist/assets/{pt-BvcG4R7B.js → pt-DObJ_ADK.js} +1 -1
- package/dist/assets/{python-BJ2CXy2e.js → python-czQLPXp8.js} +1 -1
- package/dist/assets/{raf-schd.esm-BdLRNFZe.js → raf-schd.esm-PMp87DFK.js} +1 -1
- package/dist/assets/{razor-DdMOGESa.js → razor-Bgg3hEgt.js} +1 -1
- package/dist/assets/{rotate-session-key-D_YTGNN-.js → rotate-session-key-Dtz9D1ow.js} +1 -1
- package/dist/assets/{ru-DzUPRLmr.js → ru-nYDmEUmY.js} +1 -1
- package/dist/assets/{runtime-B1ybPRbq.js → runtime-BSvs2J54.js} +1 -1
- package/dist/assets/schema-DmifXwDr.js +1 -0
- package/dist/assets/sdk-VJ878dD0.js +1 -0
- package/dist/assets/{service-pByff5wa.js → service-BlUOvgta.js} +1 -1
- package/dist/assets/{shorten-label-DxKgpegt.js → shorten-label-BZLeEmnh.js} +1 -1
- package/dist/assets/simple-select-CDiD7EVt.js +1 -0
- package/dist/assets/{spaces-DnqeOj51.js → spaces-B91L1fYZ.js} +1 -1
- package/dist/assets/{status-iJzbVxRo.js → status-DEKm_VSq.js} +1 -1
- package/dist/assets/{status-BGeIvK1l.js → status-DIBvqycZ.js} +1 -1
- package/dist/assets/{switch-control-B_J8lGBy.js → switch-control-C9oMQ7W-.js} +1 -1
- package/dist/assets/{table-icons-CoOahY2H.js → table-icons-EhFLZCZI.js} +1 -1
- package/dist/assets/{team-NpjMEHti.js → team-fAqBHfRA.js} +1 -1
- package/dist/assets/{th-BmW1qKpZ.js → th-DMcUw_9_.js} +1 -1
- package/dist/assets/{toLower-Dx_gZ85b.js → toLower-CTl5GR-_.js} +1 -1
- package/dist/assets/toUpper-CjPgxX5u.js +1 -0
- package/dist/assets/{traffic-BiqnglqJ.js → traffic-BQ2LFr05.js} +1 -1
- package/dist/assets/{tsMode-CNfoaBo0.js → tsMode-BC6Utk6Q.js} +1 -1
- package/dist/assets/{typescript-CYiGFg4j.js → typescript-DA3LEYkV.js} +1 -1
- package/dist/assets/ua-parser-DP5omx3I.js +1 -0
- package/dist/assets/{url-evaluation-Bm9OWnaf.js → url-evaluation-QeH6FlO4.js} +1 -1
- package/dist/assets/{url-join-B07GNSp-.js → url-join-BL6fN34c.js} +1 -1
- package/dist/assets/{use-mobile-D5fNICVu.js → use-mobile-B3ZO2ENR.js} +1 -1
- package/dist/assets/{use-mobile-Dm-drtZi.js → use-mobile-CC5e6Q7A.js} +1 -1
- package/dist/assets/{useAsync-2o_4QDVN.js → useAsync-C4TyOh-5.js} +1 -1
- package/dist/assets/{useAsyncRetry-CSZJdZ2s.js → useAsyncRetry-nX6HpPsm.js} +1 -1
- package/dist/assets/{useLocalStorage-xEKVgwM3.js → useLocalStorage-CZNQlTk5.js} +1 -1
- package/dist/assets/{useThemeProps-BhYWaPDm.js → useThemeProps-BleY03wL.js} +1 -1
- package/dist/assets/{util-DhYg_WLh.js → util-DBPmcEMD.js} +1 -1
- package/dist/assets/{vi-BPU54RQW.js → vi-B73oWQBC.js} +1 -1
- package/dist/assets/{wait-container-HwFE2vqS.js → wait-container-DFnbvnlK.js} +1 -1
- package/dist/assets/{without-wallet-Dbr3bl6I.js → without-wallet-BEHqWwMH.js} +1 -1
- package/dist/assets/wrap-locale-D0QYhzyI.js +1 -0
- package/dist/assets/{xml-C13TFHPP.js → xml-D8pQLiZC.js} +1 -1
- package/dist/assets/{yaml-TMDBP8Bi.js → yaml-BSxlt5hf.js} +1 -1
- package/dist/assets/{zh-WrFfMVyM.js → zh-DCABA61W.js} +1 -1
- package/dist/assets/{zh-tw-DjWFpq-W.js → zh-tw-M_0Y4wmR.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/service-worker.js +1 -1
- package/package.json +1 -1
- package/dist/assets/ArrowDropDown-DonW35Zx.js +0 -1
- package/dist/assets/api-OdGoHXe4.js +0 -1
- package/dist/assets/audit-logs-CLj12YBu.js +0 -35
- package/dist/assets/client-BaEuKBw8.js +0 -1
- package/dist/assets/cloneDeep-CPQcx7Qa.js +0 -1
- package/dist/assets/emotion-cache.browser.esm-CQ2-5c4_.js +0 -1
- package/dist/assets/engine-wH21TR28.js +0 -1
- package/dist/assets/getValidReactChildren-DECNQV_G.js +0 -1
- package/dist/assets/index-CAUKXdVD.js +0 -1
- package/dist/assets/index-DpTrAVde.js +0 -1
- package/dist/assets/index-DwEuapzX.js +0 -292
- package/dist/assets/index-DwfORIGZ.js +0 -113
- package/dist/assets/index-hPXA34zh.js +0 -375
- package/dist/assets/omit-B8xv_k3Z.js +0 -1
- package/dist/assets/schema-BKs0S9Ju.js +0 -1
- package/dist/assets/sdk-WWYom8eN.js +0 -1
- package/dist/assets/simple-select-DFmJjQqW.js +0 -1
- package/dist/assets/toUpper-28qo31SR.js +0 -1
- package/dist/assets/wrap-locale-BQVWlKMF.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{bF as r,f9 as _,gZ as e}from"./index-oppNoNvH.js";const i={en:_(e),ar:()=>r(()=>import("./ar-BQm9lQ4M.js"),[],import.meta.url).then(t=>_(t.default)),de:()=>r(()=>import("./de-D0uPENSq.js"),[],import.meta.url).then(t=>_(t.default)),es:()=>r(()=>import("./es-Dh4_UfCu.js"),[],import.meta.url).then(t=>_(t.default)),fr:()=>r(()=>import("./fr-CzZWQkiT.js"),[],import.meta.url).then(t=>_(t.default)),hi:()=>r(()=>import("./hi-Do9VCuRi.js"),[],import.meta.url).then(t=>_(t.default)),id:()=>r(()=>import("./id-Dhhrveu9.js"),[],import.meta.url).then(t=>_(t.default)),ja:()=>r(()=>import("./ja-B70UYq5X.js"),[],import.meta.url).then(t=>_(t.default)),ko:()=>r(()=>import("./ko-C7TZwmXC.js"),[],import.meta.url).then(t=>_(t.default)),pt:()=>r(()=>import("./pt-DObJ_ADK.js"),[],import.meta.url).then(t=>_(t.default)),ru:()=>r(()=>import("./ru-nYDmEUmY.js"),[],import.meta.url).then(t=>_(t.default)),th:()=>r(()=>import("./th-DMcUw_9_.js"),[],import.meta.url).then(t=>_(t.default)),vi:()=>r(()=>import("./vi-B73oWQBC.js"),[],import.meta.url).then(t=>_(t.default)),"zh-TW":()=>r(()=>import("./zh-tw-M_0Y4wmR.js"),[],import.meta.url).then(t=>_(t.default)),zh:()=>r(()=>import("./zh-DCABA61W.js"),[],import.meta.url).then(t=>_(t.default))};export{i as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{aH as L,bn as I,bo as Ke,V as S,j as e,N as B,r as h,O as X,P as G,S as Q,Q as J,K as p,bp as ce,o as x,n as Re,v as U,C as Se,ac as le,aV as Y,t as H,p as De,y as _,$ as de,aU as Ie,R as $e,s as P,at as Be,H as Pe,m as Ne,bq as W,W as Ee,br as pe,bs as me,bt as ue,bu as _e,i as ze,T as $,bv as Le,ay as ie,a3 as ae,aR as re,bk as We,bw as Me,U as qe,X as Ue,A as He,u as Fe,bm as Oe,d as Ve,bx as Xe}from"./index-
|
|
1
|
+
import{aH as L,bn as I,bo as Ke,V as S,j as e,N as B,r as h,O as X,P as G,S as Q,Q as J,K as p,bp as ce,o as x,n as Re,v as U,C as Se,ac as le,aV as Y,t as H,p as De,y as _,$ as de,aU as Ie,R as $e,s as P,at as Be,H as Pe,m as Ne,bq as W,W as Ee,br as pe,bs as me,bt as ue,bu as _e,i as ze,T as $,bv as Le,ay as ie,a3 as ae,aR as re,bk as We,bw as Me,U as qe,X as Ue,A as He,u as Fe,bm as Oe,d as Ve,bx as Xe}from"./index-oppNoNvH.js";import{u as Ge,T as Qe}from"./html-title-DV29cJ5k.js";import Je from"./audit-logs-DXKfeYbe.js";import{T as xe,M as Ye}from"./index-5gnDPlCv.js";import{r as he,P as Ze}from"./index-B7g5Nk1d.js";import{u as z,T as et}from"./team-fAqBHfRA.js";import{g as tt,H as st}from"./index-BwAtwN98.js";import{D as nt}from"./url-evaluation-QeH6FlO4.js";import{E as ot}from"./Edit-BLOnay32.js";import{y as it}from"./index-1qcmbchL.js";import{A as at}from"./Add-BtxJ9S0c.js";import{l as F}from"./index-DnFU3fjE.js";import{C as O}from"./click-to-copy-BCe_knva.js";import{f as rt}from"./index-BojVbZw0.js";import{D as ct}from"./delete-confirm-Bow13LE9.js";import{P as lt}from"./permission-DZytcuWC.js";import{u as dt}from"./blocklet--AI07_i0.js";import{u as Z}from"./use-mobile-B3ZO2ENR.js";import{A as pt}from"./actions-Dq4cTCeJ.js";import{u as mt}from"./useAsyncRetry-nX6HpPsm.js";import"./TableSearch-DsuiCyEx.js";import"./Search-CbRhrT-l.js";import"./Clear-CmclKblN.js";import"./useLocalStorage-CZNQlTk5.js";import"./index-BAu_h5OW.js";import"./decode-DPztD6kB.js";import"./UnfoldMore-DoB8mcpO.js";import"./shorten-label-BZLeEmnh.js";import"./ViewList-CfykWbFF.js";import"./index-DnGfacYV.js";import"./ButtonGroup-zxfGLX1y.js";import"./getValidReactChildren-Cg2u2AWU.js";import"./index.esm-Cc-rWUer.js";import"./Google-B6ijzIon.js";import"./cloneDeep-CAK0LBhz.js";import"./Autocomplete-BSxdbGZ9.js";import"./ListSubheader-Ch1RovVQ.js";import"./AdapterDayjs-Dmdo2xWr.js";import"./useThemeProps-BleY03wL.js";import"./CSSTransition-BHFpNneQ.js";import"./visuallyHidden-Dan1xhjv.js";import"./index-CQwHcXdR.js";import"./Verified-CHH9KCap.js";import"./DeleteOutline-DeY1XytP.js";import"./ErrorOutline-C62Ptpls.js";import"./index-2sz7KBve.js";import"./emotion-cache.browser.esm-89zxT23k.js";import"./sdk-VJ878dD0.js";import"./index-BS8Zd79a.js";import"./ua-parser-DP5omx3I.js";import"./edit.svg-MBsEEqxw.js";import"./list-header-xkh_uL_h.js";import"./chain-Dk4xAHS8.js";import"./ToggleButtonGroup-CoPX4ob9.js";import"./lock.svg-CkFKYDxX.js";import"./FilterList-5aPzs6zd.js";import"./index-CsAuzX0k.js";import"./redux-DfszZyTl.js";import"./typeof-QjJsDpFa.js";import"./depsEqual-DM_xCHol.js";import"./MoreVert-CdXWMKz-.js";import"./useAsync-C4TyOh-5.js";function ee({value:s}){const{t,locale:n}=S(),i=new Date;return new Date(s)<i?e.jsxs("span",{style:{color:"red"},children:[e.jsx(B,{value:s,locale:n}),`${t("setting.accessKey.expired",{time:""})}`]}):e.jsx(B,{mode:"daysLeft",value:s,locale:n,type:"all"})}ee.propTypes={value:x.string.isRequired};function te({value:s,onChange:t,...n}){const{t:i}=S(),a=h.useMemo(()=>[{value:"signature",title:i("setting.accessKey.signature"),description:i("setting.accessKey.signatureDesc")},{value:"simple",title:i("setting.accessKey.simple"),description:i("setting.accessKey.simpleDesc")}],[i]);return e.jsxs(X,{style:{width:"100%"},variant:"outlined",...n,children:[e.jsx(G,{children:i("setting.accessKey.authType")}),e.jsx(Q,{value:s,onChange:t,fullWidth:!0,label:i("setting.accessKey.authType"),IconComponent:r=>e.jsx(ce,{...r,width:20,height:20}),children:a.map(r=>e.jsx(J,{value:r.value,children:e.jsxs(p,{children:[e.jsx("span",{children:r.title}),e.jsx(p,{sx:{maxWidth:510,fontSize:12,color:"#999",whiteSpace:"normal"},children:r.description})]})},r.value))})]})}te.propTypes={value:x.string.isRequired,onChange:x.func.isRequired};const se=()=>{const s=L.RBAC_CONFIG.roles.filter(a=>a.passport),{inService:t}=I(),{roles:n}=z(),i=[...s,...t?n:[]];return Ke(i,"name").filter(a=>a.name!==L.ROLES.OWNER)};function fe(){const{session:s}=Re(),t=se();return h.useMemo(()=>{if(!s?.user?.role)return[];if(["owner","admin"].includes(s.user.role))return t;const i=t.filter(r=>r.name==="guest");return[...t.filter(r=>r.name!=="guest").filter(r=>s.user.passports.find(f=>f.role===r.name)),...i]},[t,s?.user?.passports,s?.user?.role])}function ge({onCreate:s=()=>{},remark:t=""}){const{api:n}=I(),{teamDid:i}=z(),{t:a}=S(),[r,f]=h.useState(!1),[m,b]=h.useState(null),u=fe(),T=()=>{f(!1),b(null)},v=async l=>{const{remark:k,passport:g,authType:o}=l;f(!0);const j=await n.createAccessKey({input:{teamDid:i,remark:k.trim(),passport:g,expireAt:l.expireAt?new Date(l.expireAt).getTime():null,authType:o}}),{data:A}=j;s(A),b(null),f(!1)},c={title:`${a("common.create")} ${a("accessKey")}`,description:(l,k,g)=>e.jsxs(Y,{sx:{gap:3},children:[e.jsx(H,{label:a("setting.accessKey.tip"),autoComplete:"off",variant:"outlined",name:"remark",fullWidth:!0,autoFocus:!0,margin:"dense",value:l.remark,onChange:o=>{k({...l,remark:o.target.value,__disableConfirm:!l.passport||!o.target.value.trim()}),o.target.value.trim()?g(""):g(a("setting.accessKey.remarkInvalid"))},slotProps:{htmlInput:{"data-cy":"remark-input"}}}),e.jsxs(X,{style:{width:"100%"},variant:"outlined",children:[e.jsx(G,{sx:{width:"calc(100% - 46px)"},children:a("setting.accessKey.passport")}),e.jsx(Q,{"data-cy":"create-access-key-select-passport",value:l.passport,onChange:o=>{const j=o.target.value;g(null),k({...l,passport:j,__disableConfirm:!l.remark||!j})},fullWidth:!0,label:a("setting.accessKey.passport"),disabled:r,IconComponent:o=>e.jsx(ce,{...o,width:20,height:20}),children:u.map(o=>e.jsx(J,{value:o.name,"data-cy":`create-access-key-passport-option-${o.name}`,children:e.jsxs(p,{children:[e.jsx("span",{children:o.title||o.name}),e.jsx(p,{sx:{maxWidth:440,fontSize:12,color:"#999",whiteSpace:"normal",textAlign:"justify"},children:o.description})]})},o.name))})]}),e.jsx(te,{value:l.authType,onChange:o=>{k({...l,authType:o.target.value})}}),e.jsx(xe,{placeholder:a("setting.accessKey.expireTime"),value:l.expireAt,onChange:o=>{k({...l,expireAt:o,__disableConfirm:!l.passport||!l.remark||!o})}})]}),confirm:a("common.confirm"),cancel:a("common.cancel"),color:"primary",params:{remark:t,authType:"signature",__disableConfirm:!t.trim()},onConfirm:v,onCancel:T};return e.jsxs(e.Fragment,{children:[e.jsxs(U,{sx:{color:"common.white"},edge:"end",variant:"contained",color:"primary","data-cy":"add-access-key-btn",onClick:()=>b(c),className:"rule-action",children:[r?e.jsx(Se,{size:16}):e.jsx(at,{style:{fontSize:16}}),a("common.create")]}),m&&e.jsx(le,{title:m.title,description:m.description,confirm:m.confirm,color:m.color,cancel:m.cancel,params:m.params,onConfirm:m.onConfirm,onCancel:m.onCancel})]})}ge.propTypes={remark:x.string,onCreate:x.func};function ye({onConfirm:s=()=>{},accessKeyId:t,accessKeySecret:n,hideSecret:i=!0}){const{t:a}=h.useContext(De),[r,f]=h.useState(!1),[m,b]=h.useState(()=>i),u=I(),T=()=>{b(!m)},v=g=>{f(g.target.checked)},c=_(window.location.origin,u?.info?.routing?.adminPath),l=h.useMemo(()=>i?`const Client = require('@blocklet/server-js');
|
|
2
2
|
const ensureServerEndpoint = require('@abtnode/util/lib/ensure-server-endpoint');
|
|
3
3
|
const { joinURL } = require('ufo');
|
|
4
4
|
|
|
@@ -147,7 +147,7 @@ const result = await client.getBlocklet(
|
|
|
147
147
|
margin: 0;
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
|
-
`;function V({title:s,tooltipTitle:t,link:n}){const{t:i}=S(),a=Z(),[r,f]=h.useState(!1),m=()=>f(u=>!u),b=()=>f(!1);return a?e.jsxs(p,{sx:{color:"text.secondary",fontSize:"14px",lineHeight:1.5},children:[s,e.jsx(Le,{onClickAway:b,children:e.jsx("span",{children:e.jsx(ie,{open:r,onClose:b,disableFocusListener:!0,disableHoverListener:!0,disableTouchListener:!0,title:e.jsxs(p,{sx:{fontSize:"14px",lineHeight:1.5},children:[t,e.jsx(p,{sx:{color:"primary.main",ml:.5},component:"a",href:n,target:"_blank",rel:"noopener noreferrer",children:i("dashboard.document")})]}),children:e.jsx(ae,{size:"small",onClick:m,sx:{ml:.5},children:e.jsx(re,{fontSize:"14"})})})})})]}):e.jsxs(p,{sx:{color:"text.secondary",fontSize:"14px",lineHeight:1.5},children:[s,e.jsx(ie,{enterTouchDelay:0,leaveTouchDelay:3e3,title:e.jsxs(p,{sx:{fontSize:"14px",lineHeight:1.5},children:[t,e.jsx(p,{sx:{color:"primary.main",ml:.5},component:"a",href:n,target:"_blank",rel:"noopener noreferrer",children:i("dashboard.document")})]}),children:e.jsx(ae,{size:"small",sx:{ml:.5},children:e.jsx(re,{fontSize:"14"})})})]})}V.propTypes={title:x.string.isRequired,tooltipTitle:x.string.isRequired,link:x.string.isRequired};function ke({isSelf:s=!1,columnSx:t={}}){const{t:n,locale:i}=S(),{api:a,inService:r}=I(),{teamDid:f}=z(),[m,b]=h.useState({}),[u,T]=h.useState(null),[v,c]=h.useState(null),[l,k]=h.useState(null),g=Z(),o=se(),j=h.useRef(null),A=`access-keys-${f}`,y=tt(A),[C,N]=h.useState({searchText:y.searchText||"",pageSize:y.rowsPerPage||10,page:1}),D=mt(async()=>{const d={teamDid:f,paging:{page:C.page,pageSize:C.pageSize}};return C.searchText&&(d.remark=C.searchText),await a.getAccessKeys({input:d})},[C.page,C.pageSize,C.searchText]),{loading:we,error:ne}=D,E=h.useMemo(()=>D.value?.list||[],[D.value?.list]),oe=h.useMemo(()=>s?["accessKeyId","createdVia","createdBy","createdBy"]:[],[s]),Te=h.useMemo(()=>[{label:n("common.name"),name:"remark",options:{customBodyRender:(d,{rowIndex:K})=>{const R=E[K];return e.jsx(p,{className:"remark",sx:We({display:"flex",alignItems:"center",gap:2},t),children:e.jsx($,{children:R.remark||"N/A"})})}}},{label:"Access Key ID",name:"accessKeyId",options:{customBodyRender:d=>e.jsx(p,{sx:t,children:e.jsx(Me,{showDidLogo:!1,children:d})})}},{label:n("common.role"),name:"passport",options:{customBodyRender:d=>{const K=o.find(w=>w.name===d),R=K?K.title:d;return e.jsx(p,{sx:t,children:he(R,d)})}}},{label:n("common.createdVia"),name:"createdVia",options:{customBodyRender:d=>e.jsx($,{sx:t,children:d})}},{label:n("setting.accessKey.authType"),name:"authType",options:{customBodyRender:d=>e.jsx($,{sx:t,children:n(`setting.accessKey.${d}`)})}},{label:n("common.createdAt"),name:"createdAt",options:{customBodyRender:d=>e.jsx(p,{sx:t,children:d?e.jsx(B,{value:d,locale:i}):"-"})}},{label:n("common.lastUsedAt"),name:"lastUsedAt",options:{customBodyRender:d=>e.jsx(p,{sx:t,children:d?e.jsx(B,{value:d,locale:i}):"-"})}},{label:n("common.expiredAt"),name:"expireAt",options:{customBodyRender:d=>e.jsx(p,{className:"expired-at",sx:t,children:d?e.jsx(ee,{value:d}):n("common.neverExpired")})}},{label:n("common.createdBy"),name:"createdBy",width:100,options:{customBodyRender:d=>e.jsx(p,{sx:t,children:d?e.jsx(pe,{showDid:!0,did:d,cardType:ue.Detailed,infoType:me.Minimal,sx:{border:0,padding:0,...g&&{minWidth:"unset"}}}):"-"})}},{label:n("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRender:(d,{rowIndex:K})=>{const R=E[K];return e.jsx(p,{sx:t,children:e.jsx(pt,{"data-cy":"access-key-actions",actions:[{icon:e.jsx(ot,{}),text:n("common.edit"),onClick:w=>{w.stopPropagation(),k(R)}},{icon:e.jsx(nt,{}),text:n("common.delete"),onClick:w=>{w.stopPropagation(),c(R)}}]})})}}}].filter(d=>!oe.includes(d.name)),[E,i,n,o,c,k,t,g,oe]),Ae=({page:d,rowsPerPage:K,searchText:R})=>{C.pageSize!==K?N(w=>({...w,pageSize:K,page:1})):C.page!==d+1?N(w=>({...w,searchText:R,page:d+1})):C.searchText!==R&&N(w=>({...w,searchText:R,page:1}))};return ne?e.jsx(qe,{severity:"error",children:Ue(ne)}):e.jsxs(p,{ref:j,sx:{".custom-toobar-btns":{gap:"8px"},".custom-toobar-title .custom-toobar-title-inner>span":{display:"flex",alignItems:"center","white-space":"inherit",height:"100%"}},children:[g?e.jsx(V,{title:n("setting.accessKey.listTitle"),tooltipTitle:n("setting.accessKey.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${i}/access-key`}):null,e.jsx(st,{durable:A,durableKeys:["page","rowsPerPage","searchText"],data:E,locale:i,columns:Te,className:"pc-access-key-table",options:{sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,page:C.page-1,rowsPerPage:C.pageSize,count:D.value?.paging?.total||0,searchText:C.searchText,searchDebounceTime:600,onRowClick(d,{dataIndex:K},R){if(j.current?.contains(R.target)){const w=E[K];T(w)}}},loading:we,onChange:Ae,title:g?null:e.jsx(V,{title:n("setting.accessKey.listTitle"),tooltipTitle:n("setting.accessKey.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${i}/access-key`}),customButtons:[e.jsx(lt,{permission:r?"":"mutate_accessKey",children:e.jsx(ge,{onCreate:d=>{const{accessKeyId:K,accessKeySecret:R,authType:w}=d;b({show:!0,accessKeyId:K,accessKeySecret:R,authType:w})}})})],emptyNode:e.jsx(it,{children:n("oauth.client.empty")})}),m.show&&e.jsx(ye,{hideSecret:m.authType==="signature",onConfirm:()=>{D.retry(),b({show:!1})},...m}),u&&e.jsx(Ce,{onCancel:()=>T(null),accessKey:u}),v&&e.jsx(be,{accessKeyId:v.accessKeyId,time:v.lastUsedAt,remark:v.remark||"N/A",onDelete:D.retry,onClose:()=>c(null)}),l&&e.jsx(je,{...l,onUpdate:D.retry,onClose:()=>k(null)})]})}ke.propTypes={isSelf:x.bool,columnSx:x.object};function ft(){return e.jsx(ke,{})}function
|
|
150
|
+
`;function V({title:s,tooltipTitle:t,link:n}){const{t:i}=S(),a=Z(),[r,f]=h.useState(!1),m=()=>f(u=>!u),b=()=>f(!1);return a?e.jsxs(p,{sx:{color:"text.secondary",fontSize:"14px",lineHeight:1.5},children:[s,e.jsx(Le,{onClickAway:b,children:e.jsx("span",{children:e.jsx(ie,{open:r,onClose:b,disableFocusListener:!0,disableHoverListener:!0,disableTouchListener:!0,title:e.jsxs(p,{sx:{fontSize:"14px",lineHeight:1.5},children:[t,e.jsx(p,{sx:{color:"primary.main",ml:.5},component:"a",href:n,target:"_blank",rel:"noopener noreferrer",children:i("dashboard.document")})]}),children:e.jsx(ae,{size:"small",onClick:m,sx:{ml:.5},children:e.jsx(re,{fontSize:"14"})})})})})]}):e.jsxs(p,{sx:{color:"text.secondary",fontSize:"14px",lineHeight:1.5},children:[s,e.jsx(ie,{enterTouchDelay:0,leaveTouchDelay:3e3,title:e.jsxs(p,{sx:{fontSize:"14px",lineHeight:1.5},children:[t,e.jsx(p,{sx:{color:"primary.main",ml:.5},component:"a",href:n,target:"_blank",rel:"noopener noreferrer",children:i("dashboard.document")})]}),children:e.jsx(ae,{size:"small",sx:{ml:.5},children:e.jsx(re,{fontSize:"14"})})})]})}V.propTypes={title:x.string.isRequired,tooltipTitle:x.string.isRequired,link:x.string.isRequired};function ke({isSelf:s=!1,columnSx:t={}}){const{t:n,locale:i}=S(),{api:a,inService:r}=I(),{teamDid:f}=z(),[m,b]=h.useState({}),[u,T]=h.useState(null),[v,c]=h.useState(null),[l,k]=h.useState(null),g=Z(),o=se(),j=h.useRef(null),A=`access-keys-${f}`,y=tt(A),[C,N]=h.useState({searchText:y.searchText||"",pageSize:y.rowsPerPage||10,page:1}),D=mt(async()=>{const d={teamDid:f,paging:{page:C.page,pageSize:C.pageSize}};return C.searchText&&(d.remark=C.searchText),await a.getAccessKeys({input:d})},[C.page,C.pageSize,C.searchText]),{loading:we,error:ne}=D,E=h.useMemo(()=>D.value?.list||[],[D.value?.list]),oe=h.useMemo(()=>s?["accessKeyId","createdVia","createdBy","createdBy"]:[],[s]),Te=h.useMemo(()=>[{label:n("common.name"),name:"remark",options:{customBodyRender:(d,{rowIndex:K})=>{const R=E[K];return e.jsx(p,{className:"remark",sx:We({display:"flex",alignItems:"center",gap:2},t),children:e.jsx($,{children:R.remark||"N/A"})})}}},{label:"Access Key ID",name:"accessKeyId",options:{customBodyRender:d=>e.jsx(p,{sx:t,children:e.jsx(Me,{showDidLogo:!1,children:d})})}},{label:n("common.role"),name:"passport",options:{customBodyRender:d=>{const K=o.find(w=>w.name===d),R=K?K.title:d;return e.jsx(p,{sx:t,children:he(R,d)})}}},{label:n("common.createdVia"),name:"createdVia",options:{customBodyRender:d=>e.jsx($,{sx:t,children:d})}},{label:n("setting.accessKey.authType"),name:"authType",options:{customBodyRender:d=>e.jsx($,{sx:t,children:n(`setting.accessKey.${d}`)})}},{label:n("common.createdAt"),name:"createdAt",options:{customBodyRender:d=>e.jsx(p,{sx:t,children:d?e.jsx(B,{value:d,locale:i}):"-"})}},{label:n("common.lastUsedAt"),name:"lastUsedAt",options:{customBodyRender:d=>e.jsx(p,{sx:t,children:d?e.jsx(B,{value:d,locale:i}):"-"})}},{label:n("common.expiredAt"),name:"expireAt",options:{customBodyRender:d=>e.jsx(p,{className:"expired-at",sx:t,children:d?e.jsx(ee,{value:d}):n("common.neverExpired")})}},{label:n("common.createdBy"),name:"createdBy",width:100,options:{customBodyRender:d=>e.jsx(p,{sx:t,children:d?e.jsx(pe,{showDid:!0,did:d,cardType:ue.Detailed,infoType:me.Minimal,sx:{border:0,padding:0,...g&&{minWidth:"unset"}}}):"-"})}},{label:n("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRender:(d,{rowIndex:K})=>{const R=E[K];return e.jsx(p,{sx:t,children:e.jsx(pt,{"data-cy":"access-key-actions",actions:[{icon:e.jsx(ot,{}),text:n("common.edit"),onClick:w=>{w.stopPropagation(),k(R)}},{icon:e.jsx(nt,{}),text:n("common.delete"),onClick:w=>{w.stopPropagation(),c(R)}}]})})}}}].filter(d=>!oe.includes(d.name)),[E,i,n,o,c,k,t,g,oe]),Ae=({page:d,rowsPerPage:K,searchText:R})=>{C.pageSize!==K?N(w=>({...w,pageSize:K,page:1})):C.page!==d+1?N(w=>({...w,searchText:R,page:d+1})):C.searchText!==R&&N(w=>({...w,searchText:R,page:1}))};return ne?e.jsx(qe,{severity:"error",children:Ue(ne)}):e.jsxs(p,{ref:j,sx:{".custom-toobar-btns":{gap:"8px"},".custom-toobar-title .custom-toobar-title-inner>span":{display:"flex",alignItems:"center","white-space":"inherit",height:"100%"}},children:[g?e.jsx(V,{title:n("setting.accessKey.listTitle"),tooltipTitle:n("setting.accessKey.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${i}/access-key`}):null,e.jsx(st,{durable:A,durableKeys:["page","rowsPerPage","searchText"],data:E,locale:i,columns:Te,className:"pc-access-key-table",options:{sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,page:C.page-1,rowsPerPage:C.pageSize,count:D.value?.paging?.total||0,searchText:C.searchText,searchDebounceTime:600,onRowClick(d,{dataIndex:K},R){if(j.current?.contains(R.target)){const w=E[K];T(w)}}},loading:we,onChange:Ae,title:g?null:e.jsx(V,{title:n("setting.accessKey.listTitle"),tooltipTitle:n("setting.accessKey.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${i}/access-key`}),customButtons:[e.jsx(lt,{permission:r?"":"mutate_accessKey",children:e.jsx(ge,{onCreate:d=>{const{accessKeyId:K,accessKeySecret:R,authType:w}=d;b({show:!0,accessKeyId:K,accessKeySecret:R,authType:w})}})})],emptyNode:e.jsx(it,{children:n("oauth.client.empty")})}),m.show&&e.jsx(ye,{hideSecret:m.authType==="signature",onConfirm:()=>{D.retry(),b({show:!1})},...m}),u&&e.jsx(Ce,{onCancel:()=>T(null),accessKey:u}),v&&e.jsx(be,{accessKeyId:v.accessKeyId,time:v.lastUsedAt,remark:v.remark||"N/A",onDelete:D.retry,onClose:()=>c(null)}),l&&e.jsx(je,{...l,onUpdate:D.retry,onClose:()=>k(null)})]})}ke.propTypes={isSelf:x.bool,columnSx:x.object};function ft(){return e.jsx(ke,{})}function As(){const s=He(),{t}=S(),{info:n}=Fe(),{tab:i="members"}=Oe(),a=o=>Xe(o,n),{data:r}=Ve(),f=h.useCallback(o=>{const j=r.find(A=>[A.meta.did,A.appDid,A.appPid].includes(o));return j?j.meta.title:"Server"},[r]),m=h.useRef(null);m.current=f;const b=h.useCallback(()=>e.jsx(Je,{showScope:!0,scopeFormatter:m.current,blocklets:r}),[r]),u=h.useCallback(()=>e.jsx(Ye,{type:"server",createPassportSvg:a}),[]),T=n.did,v=o=>{s(`/team/${o}`)},c={members:{label:t("common.members"),value:"members",component:u},passports:{label:t("team.member.passports"),value:"passports",component:Ze},"access-keys":{label:t("common.accessKey"),value:"access-keys",component:ft},"audit-logs":{label:t("common.auditLogs"),value:"audit-logs",component:b}},l=Ge(c[i],t("common.team")),k=Object.values(c).map(({label:o,value:j})=>({label:o,value:j})),g=c[i]||c.member;return e.jsxs(et,{teamDid:T,children:[l,e.jsxs(gt,{children:[e.jsx($,{component:"h2",variant:"h4",className:"page-header",color:"textPrimary",children:t("common.team")}),e.jsx(Qe,{tabs:k,current:i,onChange:v,scrollButtons:"auto"}),e.jsx("div",{className:"page-content",children:e.jsx(g.component,{createPassportSvg:a})})]})]})}const gt=P.main`
|
|
151
151
|
.page-header {
|
|
152
152
|
display: flex;
|
|
153
153
|
justify-content: space-between;
|
|
@@ -157,4 +157,4 @@ const result = await client.getBlocklet(
|
|
|
157
157
|
.page-content {
|
|
158
158
|
margin-top: 24px;
|
|
159
159
|
}
|
|
160
|
-
`;export{
|
|
160
|
+
`;export{As as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aF as le,j as e,hA as ce,bd as ue,bn as Z,V as G,fO as ee,f7 as te,aP as re,cs as u,H as S,hB as B,K as R,t as p,hC as V,aU as H,O as x,ay as de,v as A,s as ie,aV as ne,z as me,y as fe,aH as he,r as M,p as pe,bz as xe}from"./index-F3HbHSYi.js";import{T as ve}from"./html-title-B42L4vHs.js";import{u as se,C as m}from"./index.esm-CG55Fmct.js";import{S as h,A as je,a as be,b as ge,c as ye}from"./collapse-D-q9UEjV.js";import{u as ae}from"./blocklet-BSWtuwnH.js";import{S as $}from"./Switch-czLKbhPZ.js";const Re=le(e.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 17h-2v-2h2zm2.07-7.75-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25"}));var K={exports:{}},O={exports:{}},z={exports:{}},J;function ke(){return J||(J=1,function(c,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=t;function t(d){return d==null}c.exports=s.default,c.exports.default=s.default}(z,z.exports)),z.exports}var Q;function we(){return Q||(Q=1,function(c,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=E;var t=b(ce()),d=b(ke());function b(n){return n&&n.__esModule?n:{default:n}}var f=/^(?:[-+]?(?:0|[1-9][0-9]*))$/,P=/^[-+]?[0-9]+$/;function E(n,i){(0,t.default)(n),i=i||{};var _=i.allow_leading_zeroes===!1?f:P,q=!i.hasOwnProperty("min")||(0,d.default)(i.min)||n>=i.min,l=!i.hasOwnProperty("max")||(0,d.default)(i.max)||n<=i.max,a=!i.hasOwnProperty("lt")||(0,d.default)(i.lt)||n<i.lt,C=!i.hasOwnProperty("gt")||(0,d.default)(i.gt)||n>i.gt;return _.test(n)&&q&&l&&a&&C}c.exports=s.default,c.exports.default=s.default}(O,O.exports)),O.exports}var X;function Te(){return X||(X=1,function(c,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=b;var t=d(we());function d(f){return f&&f.__esModule?f:{default:f}}function b(f){return(0,t.default)(f,{allow_leading_zeroes:!1,min:0,max:65535})}c.exports=s.default,c.exports.default=s.default}(K,K.exports)),K.exports}var Se=Te();const Ee=ue(Se),U={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:"",companyName:"",companyLink:"",companyAddress:"",supportEmail:""};function Ce(){const{api:c}=Z(),{blocklet:s}=ae(),{t}=G(),{confirmApi:d,confirmHolder:b}=ee(),f=s?.meta?.did,P=Object.assign({...U},s?.settings?.notification?.email||{}),{handleSubmit:E,control:n,formState:i,watch:_,reset:q}=se({defaultValues:te(P,Object.keys(U))}),l=re({testReceiver:"",testReceiverError:""}),a=_("enabled"),C=u(async(r,g,T=!0)=>{try{const{blocklet:y}=await c.configNotification({input:{did:f,notification:JSON.stringify({email:r})}}),oe=Object.assign({...U},y?.settings?.notification?.email||{});q(oe),T&&S.success(t("oauth.saveSuccess"))}catch(y){if(T)S.error(y.message||t("oauth.saveFailed"));else throw y}}),N=u(async(r,g,T)=>{try{i.isDirty&&await C(r,g,!1),await c.sendEmail({input:{did:f,receiver:T,email:JSON.stringify({body:"Your SMTP configuration is correct!",title:"Test email",type:"notification",attachments:[{type:"link",data:{url:"https://community.arcblock.io",title:"Community",image:"https://community.arcblock.io/.well-known/service/blocklet/logo-rect-dark",utm:{campaign:"test-campaign"}}}],utm:{content:"test-email-button"}})}}),S.success(t("notification.email.testSuccess"))}catch(y){S.error(y.message||t("notification.email.testfailed"))}}),W=u((r,g)=>{l.testReceiver=localStorage.getItem("test-receiver")||"",l.testReceiverError="",d.open({title:t("notification.email.testSendEmail"),content:()=>e.jsx(R,{sx:{width:"300px"},children:e.jsx(p,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:t("notification.email.inputTestReceiver"),value:l.testReceiver,onChange:T=>{l.testReceiver=T.target.value},error:!!l.testReceiverError,helperText:l.testReceiverError||" "})}),confirmButtonText:t("common.confirm"),cancelButtonText:t("common.cancel"),async onConfirm(T){const y=l.testReceiver?.trim();if(!y){l.testReceiverError=t("notification.email.receiverRequired");return}if(!B(y)){l.testReceiverError=t("notification.email.receiverInvalid");return}l.testReceiverError="",await N(r,g,y),T()}})}),F=u(r=>{const g=r?.trim();return g?B(g)?!0:t("notification.email.fromInvalid"):t("notification.email.fromRequired")}),L=u(r=>{const g=r?.trim();return g?V(g,{require_host:!1,protocols:[]})?!0:t("notification.email.hostInvalid"):t("notification.email.hostRequired")}),o=u(r=>r?Ee(r)?!0:t("notification.email.portInvalid"):t("notification.email.portRequired")),k=u(r=>r?.trim()?!0:t("notification.email.userRequired")),v=u(r=>r?.trim()?!0:t("notification.email.passwordRequired")),w=u(r=>r?.trim()&&!V(r,{protocols:["http","https"],require_protocol:!0})?t("notification.email.linkInvalid"):!0),I=u(r=>r?.trim()&&!B(r)?t("notification.email.emailInvalid"):!0),j=u(()=>!0);return e.jsxs(R,{children:[e.jsxs(Pe,{component:"form",onSubmit:E(C),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(h,{title:t("notification.email.enable"),my:2.5,children:e.jsx(m,{name:"enabled",control:n,render:({field:r})=>e.jsx(H,{control:e.jsx($,{checked:r.value,...r})})})}),e.jsx(h,{title:t("notification.email.from"),children:e.jsx(m,{name:"from",control:n,rules:{validate:a?F:j},render:({field:r})=>e.jsx(x,{fullWidth:!0,children:e.jsx(p,{...r,size:"small",required:!0,label:t("notification.email.from"),error:!!i.errors[r.name],helperText:i.errors[r.name]?.message||" ",disabled:!a})})})}),e.jsx(h,{title:t("notification.email.host"),children:e.jsx(m,{name:"host",control:n,rules:{validate:a?L:j},render:({field:r})=>e.jsx(x,{fullWidth:!0,children:e.jsx(p,{...r,size:"small",required:!0,error:!!i.errors[r.name],label:t("notification.email.host"),helperText:i.errors[r.name]?.message||" ",disabled:!a})})})}),e.jsx(h,{title:t("notification.email.port"),children:e.jsx(m,{name:"port",control:n,rules:{validate:a?o:j},render:({field:r})=>e.jsx(x,{fullWidth:!0,children:e.jsx(p,{...r,size:"small",required:!0,type:"number",error:!!i.errors[r.name],label:t("notification.email.port"),helperText:i.errors[r.name]?.message||" ",disabled:!a})})})}),e.jsx(h,{title:t("notification.email.user"),children:e.jsx(m,{name:"user",control:n,rules:{validate:a?k:j},render:({field:r})=>e.jsx(x,{fullWidth:!0,children:e.jsx(p,{...r,size:"small",required:!0,error:!!i.errors[r.name],label:t("notification.email.user"),helperText:i.errors[r.name]?.message||" ",disabled:!a})})})}),e.jsx(h,{title:t("notification.email.password"),children:e.jsx(m,{name:"password",control:n,rules:{validate:a?v:j},render:({field:r})=>e.jsx(x,{fullWidth:!0,children:e.jsx(p,{...r,size:"small",required:!0,type:"password",error:!!i.errors[r.name],label:t("notification.email.password"),helperText:i.errors[r.name]?.message||" ",disabled:!a})})})}),e.jsx(h,{title:t("notification.email.secure"),children:e.jsx(m,{name:"secure",control:n,rules:{validate:j},render:({field:r})=>e.jsx(x,{fullWidth:!0,children:e.jsx(H,{control:e.jsx($,{checked:r.value,...r,disabled:!a})})})})}),e.jsxs(je,{children:[e.jsxs(be,{expandIcon:e.jsx(ge,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:[t("notification.email.signature"),e.jsx(de,{title:t("notification.email.signatureTooltip"),children:e.jsx(Re,{fontSize:"small",sx:{ml:1,cursor:"help"}})})]}),e.jsxs(ye,{children:[e.jsx(h,{title:t("notification.email.companyName"),children:e.jsx(m,{name:"companyName",control:n,rules:{validate:j},render:({field:r})=>e.jsx(x,{fullWidth:!0,children:e.jsx(p,{...r,size:"small",error:!!i.errors[r.name],label:t("notification.email.companyName"),helperText:i.errors[r.name]?.message||" ",disabled:!a})})})}),e.jsx(h,{title:t("notification.email.companyLink"),children:e.jsx(m,{name:"companyLink",control:n,rules:{validate:a?w:j},render:({field:r})=>e.jsx(x,{fullWidth:!0,children:e.jsx(p,{...r,size:"small",error:!!i.errors[r.name],label:t("notification.email.companyLink"),helperText:i.errors[r.name]?.message||" ",disabled:!a})})})}),e.jsx(h,{title:t("notification.email.companyAddress"),children:e.jsx(m,{name:"companyAddress",control:n,rules:{validate:j},render:({field:r})=>e.jsx(x,{fullWidth:!0,children:e.jsx(p,{...r,size:"small",error:!!i.errors[r.name],label:t("notification.email.companyAddress"),helperText:i.errors[r.name]?.message||" ",disabled:!a})})})}),e.jsx(h,{title:t("notification.email.supportEmail"),children:e.jsx(m,{name:"supportEmail",control:n,rules:{validate:a?I:j},render:({field:r})=>e.jsx(x,{fullWidth:!0,children:e.jsx(p,{...r,size:"small",type:"email",error:!!i.errors[r.name],label:t("notification.email.supportEmail"),helperText:i.errors[r.name]?.message||" ",disabled:!a})})})})]})]}),e.jsxs(R,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(A,{variant:"outlined",color:"warning",onClick:E(W),disabled:!a,children:t("oauth.runTest")}),e.jsx(A,{type:"submit",variant:"contained",disabled:!i.isDirty,children:t("oauth.save")})]})]}),b]})}const Pe=ie(ne)``,D={enabled:!1,endpoint:"",did:void 0,pushPath:void 0};function _e(){const{api:c}=Z(),{blocklet:s}=ae(),{t}=G(),{confirmApi:d,confirmHolder:b}=ee(),f=s?.meta?.did,P=Object.assign({...D},s?.settings?.notification?.pushKit||{}),{handleSubmit:E,control:n,formState:i,watch:_,reset:q}=se({defaultValues:te(P,Object.keys(D))}),l=re({testReceiver:"",testReceiverError:""}),a=_("enabled"),C=u(async(o,k,v=!0)=>{try{const{blocklet:w}=await c.configNotification({input:{did:f,notification:JSON.stringify({pushKit:o})}}),I=Object.assign({...D},w?.settings?.notification?.pushKit||{});q(I),v&&S.success(t("oauth.saveSuccess"))}catch(w){if(v)S.error(w.message||t("oauth.saveFailed"));else throw w}}),N=u(async(o,k)=>{try{i.isDirty&&await C(o,k,!1);const v=(s?.configs||[]).find(j=>j.key==="BLOCKLET_APP_URL")?.value,w=me(fe(v,he.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo"),{v:s?.meta?.version,t:new Date(s?.updatedAt||0).getTime()}),I={type:"passthrough",passthroughType:"messageStatus",data:{message:{title:"Test push-kit notification",body:"This is message from push-kit config test",sender:{did:s?.appDid,fullName:s?.meta?.title,avatar:w}}}};await c.sendPush({input:{did:f,receiver:l.testReceiver,notification:JSON.stringify(I)}}),S.success(t("notification.pushKit.testSuccess"))}catch(v){S.error(v.message||t("notification.pushKit.testfailed"))}}),W=u((o,k)=>{l.testReceiverError="",d.open({title:t("notification.pushKit.testSend"),content:()=>e.jsx(R,{sx:{width:"450px",maxWidth:"100%"},children:e.jsx(p,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:t("notification.pushKit.inputTestReceiver"),value:l.testReceiver,onChange:v=>{l.testReceiver=v.target.value},error:!!l.testReceiverError,helperText:l.testReceiverError||" "})}),confirmButtonText:t("common.confirm"),cancelButtonText:t("common.cancel"),async onConfirm(v){if(!l.testReceiver?.trim()){l.testReceiverError=t("notification.pushKit.receiverRequired");return}l.testReceiverError="",await N(o,k),v()}})}),F=u(o=>{const k=o?.trim();return k?V(k)?!0:t("notification.pushKit.endpointInvalid"):t("notification.pushKit.endpointRequired")}),L=u(()=>!0);return e.jsxs(R,{children:[e.jsxs(qe,{component:"form",onSubmit:E(C),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(h,{title:t("notification.pushKit.enable"),my:2.5,children:e.jsx(m,{name:"enabled",control:n,render:({field:o})=>e.jsx(H,{control:e.jsx($,{checked:o.value,...o})})})}),e.jsx(h,{title:t("notification.pushKit.endpoint"),children:e.jsx(m,{name:"endpoint",control:n,rules:{validate:a?F:L},render:({field:o})=>e.jsx(x,{fullWidth:!0,children:e.jsx(p,{...o,size:"small",required:!0,label:t("notification.pushKit.endpoint"),error:!!i.errors[o.name],helperText:i.errors[o.name]?.message||" ",disabled:!a})})})}),e.jsxs(h,{title:t("notification.pushKit.customOptions"),children:[e.jsx(m,{name:"did",control:n,render:({field:o})=>e.jsx(x,{fullWidth:!0,children:e.jsx(p,{...o,size:"small",label:t("notification.pushKit.did"),error:!!i.errors[o.name],helperText:i.errors[o.name]?.message||" ",disabled:!a})})}),e.jsx(m,{name:"pushPath",control:n,render:({field:o})=>e.jsx(x,{fullWidth:!0,children:e.jsx(p,{...o,size:"small",label:t("notification.pushKit.pushPath"),error:!!i.errors[o.name],helperText:i.errors[o.name]?.message||" ",disabled:!a})})})]}),e.jsxs(R,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(A,{variant:"outlined",color:"warning",onClick:E(W),disabled:!a,children:t("oauth.runTest")}),e.jsx(A,{type:"submit",variant:"contained",disabled:!i.isDirty,children:t("oauth.save")})]})]}),b]})}const qe=ie(ne)``,Y=[{label:e.jsx(R,{sx:{textAlign:"center",width:"100%"},children:"Email"}),value:"email"},{label:e.jsx(R,{sx:{textAlign:"center",width:"100%"},children:"Push Kit"}),value:"pushKit"}];function We(){const[c,s]=M.useState(Y[0].value),{locale:t}=M.useContext(pe),d=xe(()=>({email:e.jsx(Ce,{}),pushKit:e.jsx(_e,{})}),[t]),b=M.useMemo(()=>({padding:"10px 0"}),[]);return e.jsxs(R,{children:[e.jsx(ve,{tabs:Y,current:c,onChange:s}),e.jsx(R,{style:b,children:d[c]})]})}export{We as B};
|
|
1
|
+
import{aF as le,j as e,hy as ce,bd as ue,bn as Z,V as G,gj as ee,f7 as te,aP as re,cs as u,H as S,hz as M,K as R,t as p,hA as V,aU as H,O as x,ay as de,v as A,s as ie,aV as ne,z as me,y as fe,aH as he,r as U,p as pe,bz as xe}from"./index-oppNoNvH.js";import{T as ve}from"./html-title-DV29cJ5k.js";import{u as se,C as m}from"./index.esm-Cc-rWUer.js";import{S as h,A as je,a as be,b as ge,c as ye}from"./collapse-zs9NkhVG.js";import{u as ae}from"./blocklet--AI07_i0.js";import{S as $}from"./Switch-D12CiGzx.js";const Re=le(e.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 17h-2v-2h2zm2.07-7.75-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25"}));var K={exports:{}},O={exports:{}},z={exports:{}},J;function ke(){return J||(J=1,function(c,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=t;function t(d){return d==null}c.exports=s.default,c.exports.default=s.default}(z,z.exports)),z.exports}var Q;function we(){return Q||(Q=1,function(c,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=E;var t=b(ce()),d=b(ke());function b(n){return n&&n.__esModule?n:{default:n}}var f=/^(?:[-+]?(?:0|[1-9][0-9]*))$/,P=/^[-+]?[0-9]+$/;function E(n,i){(0,t.default)(n),i=i||{};var _=i.allow_leading_zeroes===!1?f:P,q=!i.hasOwnProperty("min")||(0,d.default)(i.min)||n>=i.min,l=!i.hasOwnProperty("max")||(0,d.default)(i.max)||n<=i.max,a=!i.hasOwnProperty("lt")||(0,d.default)(i.lt)||n<i.lt,C=!i.hasOwnProperty("gt")||(0,d.default)(i.gt)||n>i.gt;return _.test(n)&&q&&l&&a&&C}c.exports=s.default,c.exports.default=s.default}(O,O.exports)),O.exports}var X;function Te(){return X||(X=1,function(c,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=b;var t=d(we());function d(f){return f&&f.__esModule?f:{default:f}}function b(f){return(0,t.default)(f,{allow_leading_zeroes:!1,min:0,max:65535})}c.exports=s.default,c.exports.default=s.default}(K,K.exports)),K.exports}var Se=Te();const Ee=ue(Se),B={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:"",companyName:"",companyLink:"",companyAddress:"",supportEmail:""};function Ce(){const{api:c}=Z(),{blocklet:s}=ae(),{t}=G(),{confirmApi:d,confirmHolder:b}=ee(),f=s?.meta?.did,P=Object.assign({...B},s?.settings?.notification?.email||{}),{handleSubmit:E,control:n,formState:i,watch:_,reset:q}=se({defaultValues:te(P,Object.keys(B))}),l=re({testReceiver:"",testReceiverError:""}),a=_("enabled"),C=u(async(r,g,T=!0)=>{try{const{blocklet:y}=await c.configNotification({input:{did:f,notification:JSON.stringify({email:r})}}),oe=Object.assign({...B},y?.settings?.notification?.email||{});q(oe),T&&S.success(t("oauth.saveSuccess"))}catch(y){if(T)S.error(y.message||t("oauth.saveFailed"));else throw y}}),N=u(async(r,g,T)=>{try{i.isDirty&&await C(r,g,!1),await c.sendEmail({input:{did:f,receiver:T,email:JSON.stringify({body:"Your SMTP configuration is correct!",title:"Test email",type:"notification",attachments:[{type:"link",data:{url:"https://community.arcblock.io",title:"Community",image:"https://community.arcblock.io/.well-known/service/blocklet/logo-rect-dark",utm:{campaign:"test-campaign"}}}],utm:{content:"test-email-button"}})}}),S.success(t("notification.email.testSuccess"))}catch(y){S.error(y.message||t("notification.email.testfailed"))}}),W=u((r,g)=>{l.testReceiver=localStorage.getItem("test-receiver")||"",l.testReceiverError="",d.open({title:t("notification.email.testSendEmail"),content:()=>e.jsx(R,{sx:{width:"300px"},children:e.jsx(p,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:t("notification.email.inputTestReceiver"),value:l.testReceiver,onChange:T=>{l.testReceiver=T.target.value},error:!!l.testReceiverError,helperText:l.testReceiverError||" "})}),confirmButtonText:t("common.confirm"),cancelButtonText:t("common.cancel"),async onConfirm(T){const y=l.testReceiver?.trim();if(!y){l.testReceiverError=t("notification.email.receiverRequired");return}if(!M(y)){l.testReceiverError=t("notification.email.receiverInvalid");return}l.testReceiverError="",await N(r,g,y),T()}})}),F=u(r=>{const g=r?.trim();return g?M(g)?!0:t("notification.email.fromInvalid"):t("notification.email.fromRequired")}),L=u(r=>{const g=r?.trim();return g?V(g,{require_host:!1,protocols:[]})?!0:t("notification.email.hostInvalid"):t("notification.email.hostRequired")}),o=u(r=>r?Ee(r)?!0:t("notification.email.portInvalid"):t("notification.email.portRequired")),k=u(r=>r?.trim()?!0:t("notification.email.userRequired")),v=u(r=>r?.trim()?!0:t("notification.email.passwordRequired")),w=u(r=>r?.trim()&&!V(r,{protocols:["http","https"],require_protocol:!0})?t("notification.email.linkInvalid"):!0),I=u(r=>r?.trim()&&!M(r)?t("notification.email.emailInvalid"):!0),j=u(()=>!0);return e.jsxs(R,{children:[e.jsxs(Pe,{component:"form",onSubmit:E(C),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(h,{title:t("notification.email.enable"),my:2.5,children:e.jsx(m,{name:"enabled",control:n,render:({field:r})=>e.jsx(H,{control:e.jsx($,{checked:r.value,...r})})})}),e.jsx(h,{title:t("notification.email.from"),children:e.jsx(m,{name:"from",control:n,rules:{validate:a?F:j},render:({field:r})=>e.jsx(x,{fullWidth:!0,children:e.jsx(p,{...r,size:"small",required:!0,label:t("notification.email.from"),error:!!i.errors[r.name],helperText:i.errors[r.name]?.message||" ",disabled:!a})})})}),e.jsx(h,{title:t("notification.email.host"),children:e.jsx(m,{name:"host",control:n,rules:{validate:a?L:j},render:({field:r})=>e.jsx(x,{fullWidth:!0,children:e.jsx(p,{...r,size:"small",required:!0,error:!!i.errors[r.name],label:t("notification.email.host"),helperText:i.errors[r.name]?.message||" ",disabled:!a})})})}),e.jsx(h,{title:t("notification.email.port"),children:e.jsx(m,{name:"port",control:n,rules:{validate:a?o:j},render:({field:r})=>e.jsx(x,{fullWidth:!0,children:e.jsx(p,{...r,size:"small",required:!0,type:"number",error:!!i.errors[r.name],label:t("notification.email.port"),helperText:i.errors[r.name]?.message||" ",disabled:!a})})})}),e.jsx(h,{title:t("notification.email.user"),children:e.jsx(m,{name:"user",control:n,rules:{validate:a?k:j},render:({field:r})=>e.jsx(x,{fullWidth:!0,children:e.jsx(p,{...r,size:"small",required:!0,error:!!i.errors[r.name],label:t("notification.email.user"),helperText:i.errors[r.name]?.message||" ",disabled:!a})})})}),e.jsx(h,{title:t("notification.email.password"),children:e.jsx(m,{name:"password",control:n,rules:{validate:a?v:j},render:({field:r})=>e.jsx(x,{fullWidth:!0,children:e.jsx(p,{...r,size:"small",required:!0,type:"password",error:!!i.errors[r.name],label:t("notification.email.password"),helperText:i.errors[r.name]?.message||" ",disabled:!a})})})}),e.jsx(h,{title:t("notification.email.secure"),children:e.jsx(m,{name:"secure",control:n,rules:{validate:j},render:({field:r})=>e.jsx(x,{fullWidth:!0,children:e.jsx(H,{control:e.jsx($,{checked:r.value,...r,disabled:!a})})})})}),e.jsxs(je,{children:[e.jsxs(be,{expandIcon:e.jsx(ge,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:[t("notification.email.signature"),e.jsx(de,{title:t("notification.email.signatureTooltip"),children:e.jsx(Re,{fontSize:"small",sx:{ml:1,cursor:"help"}})})]}),e.jsxs(ye,{children:[e.jsx(h,{title:t("notification.email.companyName"),children:e.jsx(m,{name:"companyName",control:n,rules:{validate:j},render:({field:r})=>e.jsx(x,{fullWidth:!0,children:e.jsx(p,{...r,size:"small",error:!!i.errors[r.name],label:t("notification.email.companyName"),helperText:i.errors[r.name]?.message||" ",disabled:!a})})})}),e.jsx(h,{title:t("notification.email.companyLink"),children:e.jsx(m,{name:"companyLink",control:n,rules:{validate:a?w:j},render:({field:r})=>e.jsx(x,{fullWidth:!0,children:e.jsx(p,{...r,size:"small",error:!!i.errors[r.name],label:t("notification.email.companyLink"),helperText:i.errors[r.name]?.message||" ",disabled:!a})})})}),e.jsx(h,{title:t("notification.email.companyAddress"),children:e.jsx(m,{name:"companyAddress",control:n,rules:{validate:j},render:({field:r})=>e.jsx(x,{fullWidth:!0,children:e.jsx(p,{...r,size:"small",error:!!i.errors[r.name],label:t("notification.email.companyAddress"),helperText:i.errors[r.name]?.message||" ",disabled:!a})})})}),e.jsx(h,{title:t("notification.email.supportEmail"),children:e.jsx(m,{name:"supportEmail",control:n,rules:{validate:a?I:j},render:({field:r})=>e.jsx(x,{fullWidth:!0,children:e.jsx(p,{...r,size:"small",type:"email",error:!!i.errors[r.name],label:t("notification.email.supportEmail"),helperText:i.errors[r.name]?.message||" ",disabled:!a})})})})]})]}),e.jsxs(R,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(A,{variant:"outlined",color:"warning",onClick:E(W),disabled:!a,children:t("oauth.runTest")}),e.jsx(A,{type:"submit",variant:"contained",disabled:!i.isDirty,children:t("oauth.save")})]})]}),b]})}const Pe=ie(ne)``,D={enabled:!1,endpoint:"",did:void 0,pushPath:void 0};function _e(){const{api:c}=Z(),{blocklet:s}=ae(),{t}=G(),{confirmApi:d,confirmHolder:b}=ee(),f=s?.meta?.did,P=Object.assign({...D},s?.settings?.notification?.pushKit||{}),{handleSubmit:E,control:n,formState:i,watch:_,reset:q}=se({defaultValues:te(P,Object.keys(D))}),l=re({testReceiver:"",testReceiverError:""}),a=_("enabled"),C=u(async(o,k,v=!0)=>{try{const{blocklet:w}=await c.configNotification({input:{did:f,notification:JSON.stringify({pushKit:o})}}),I=Object.assign({...D},w?.settings?.notification?.pushKit||{});q(I),v&&S.success(t("oauth.saveSuccess"))}catch(w){if(v)S.error(w.message||t("oauth.saveFailed"));else throw w}}),N=u(async(o,k)=>{try{i.isDirty&&await C(o,k,!1);const v=(s?.configs||[]).find(j=>j.key==="BLOCKLET_APP_URL")?.value,w=me(fe(v,he.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo"),{v:s?.meta?.version,t:new Date(s?.updatedAt||0).getTime()}),I={type:"passthrough",passthroughType:"messageStatus",data:{message:{title:"Test push-kit notification",body:"This is message from push-kit config test",sender:{did:s?.appDid,fullName:s?.meta?.title,avatar:w}}}};await c.sendPush({input:{did:f,receiver:l.testReceiver,notification:JSON.stringify(I)}}),S.success(t("notification.pushKit.testSuccess"))}catch(v){S.error(v.message||t("notification.pushKit.testfailed"))}}),W=u((o,k)=>{l.testReceiverError="",d.open({title:t("notification.pushKit.testSend"),content:()=>e.jsx(R,{sx:{width:"450px",maxWidth:"100%"},children:e.jsx(p,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:t("notification.pushKit.inputTestReceiver"),value:l.testReceiver,onChange:v=>{l.testReceiver=v.target.value},error:!!l.testReceiverError,helperText:l.testReceiverError||" "})}),confirmButtonText:t("common.confirm"),cancelButtonText:t("common.cancel"),async onConfirm(v){if(!l.testReceiver?.trim()){l.testReceiverError=t("notification.pushKit.receiverRequired");return}l.testReceiverError="",await N(o,k),v()}})}),F=u(o=>{const k=o?.trim();return k?V(k)?!0:t("notification.pushKit.endpointInvalid"):t("notification.pushKit.endpointRequired")}),L=u(()=>!0);return e.jsxs(R,{children:[e.jsxs(qe,{component:"form",onSubmit:E(C),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(h,{title:t("notification.pushKit.enable"),my:2.5,children:e.jsx(m,{name:"enabled",control:n,render:({field:o})=>e.jsx(H,{control:e.jsx($,{checked:o.value,...o})})})}),e.jsx(h,{title:t("notification.pushKit.endpoint"),children:e.jsx(m,{name:"endpoint",control:n,rules:{validate:a?F:L},render:({field:o})=>e.jsx(x,{fullWidth:!0,children:e.jsx(p,{...o,size:"small",required:!0,label:t("notification.pushKit.endpoint"),error:!!i.errors[o.name],helperText:i.errors[o.name]?.message||" ",disabled:!a})})})}),e.jsxs(h,{title:t("notification.pushKit.customOptions"),children:[e.jsx(m,{name:"did",control:n,render:({field:o})=>e.jsx(x,{fullWidth:!0,children:e.jsx(p,{...o,size:"small",label:t("notification.pushKit.did"),error:!!i.errors[o.name],helperText:i.errors[o.name]?.message||" ",disabled:!a})})}),e.jsx(m,{name:"pushPath",control:n,render:({field:o})=>e.jsx(x,{fullWidth:!0,children:e.jsx(p,{...o,size:"small",label:t("notification.pushKit.pushPath"),error:!!i.errors[o.name],helperText:i.errors[o.name]?.message||" ",disabled:!a})})})]}),e.jsxs(R,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(A,{variant:"outlined",color:"warning",onClick:E(W),disabled:!a,children:t("oauth.runTest")}),e.jsx(A,{type:"submit",variant:"contained",disabled:!i.isDirty,children:t("oauth.save")})]})]}),b]})}const qe=ie(ne)``,Y=[{label:e.jsx(R,{sx:{textAlign:"center",width:"100%"},children:"Email"}),value:"email"},{label:e.jsx(R,{sx:{textAlign:"center",width:"100%"},children:"Push Kit"}),value:"pushKit"}];function We(){const[c,s]=U.useState(Y[0].value),{locale:t}=U.useContext(pe),d=xe(()=>({email:e.jsx(Ce,{}),pushKit:e.jsx(_e,{})}),[t]),b=U.useMemo(()=>({padding:"10px 0"}),[]);return e.jsxs(R,{children:[e.jsx(ve,{tabs:Y,current:c,onChange:s}),e.jsx(R,{style:b,children:d[c]})]})}export{We as B};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{bY as Fe,bX as Ge,r as h,bZ as Ke,j as e,b8 as ee,b$ as $e,cc as J,c0 as Ye,bV as He,ce as qe,aF as he,M as q,bn as A,cr as Ce,H as B,X as V,bf as E,fB as we,aQ as Be,b as N,iY as Ve,V as D,gF as Qe,o as m,x as Xe,aw as De,y as fe,ak as Ze,p as Je,C as L,T as j,k as et,s as tt,f as ot,iZ as X,h$ as Z,i_ as st,K as S,aV as F,aH as T,L as nt,g as H,dj as at,ay as Se,Q as K,aE as $,a8 as Y,a4 as rt,dG as it,gv as ct,a$ as lt,v as pe,w as dt,G as be,Y as Ee,bz as xe,B as pt}from"./index-F3HbHSYi.js";import{T as ut}from"./html-title-B42L4vHs.js";import{u as U}from"./blocklet-BSWtuwnH.js";import{u as mt}from"./use-mobile-D5fNICVu.js";import{c as Ie,d as ft,e as xt,f as gt,g as ue,h as ht,b as St,u as yt,C as bt,D as kt,a as jt}from"./connect-to-sME9XFIO.js";import"./index-D4PsRecd.js";import"./index-BojVbZw0.js";import"./api-OdGoHXe4.js";import{d as Ct,a as wt,g as Bt,i as Dt,e as ge,f as Et,h as It,j as Tt}from"./spaces-DnqeOj51.js";import{v as Rt}from"./index-M4yiF52E.js";import{E as zt}from"./index-nUrxOkOM.js";import{H as vt}from"./HelpOutline-USuznZgn.js";import{H as Pt}from"./index-CGwvwEUr.js";import{x as At}from"./index-DRYJ0xIl.js";import{c as Lt}from"./actions-Cpb8n0Yw.js";import{D as Ut}from"./DeleteOutline-GpuLmtYQ.js";import{g as ke}from"./get-safe-url-DfDeYxPo.js";import{S as Ot}from"./switch-control-B_J8lGBy.js";import{L as je}from"./list-header-CnD8v8jR.js";import"./OpenInNew-B8ApQgxt.js";import"./ButtonGroup-DcZ0ug1l.js";import"./getValidReactChildren-DECNQV_G.js";import"./FilterList-CNYUVm5S.js";import"./CSSTransition-V4R7ZcvS.js";import"./emotion-cache.browser.esm-CQ2-5c4_.js";import"./index-BIGgo0dk.js";import"./redux-DfszZyTl.js";import"./typeof-QjJsDpFa.js";import"./depsEqual-BHCVOuWA.js";import"./index-jC9YQw2A.js";import"./TableSearch-CAf-ESr9.js";import"./Search-DV5vJN1H.js";import"./Clear---RPVeR7.js";import"./MoreVert-wWXtgLji.js";import"./useLocalStorage-xEKVgwM3.js";import"./url-evaluation-Bm9OWnaf.js";import"./permission-caYaN7o4.js";import"./Switch-czLKbhPZ.js";function Mt(t){return Fe("MuiIcon",t)}Ge("MuiIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const Nt=t=>{const{color:o,fontSize:n,classes:s}=t,r={root:["root",o!=="inherit"&&`color${J(o)}`,`fontSize${J(n)}`]};return Ye(r,Mt,s)},_t=ee("span",{name:"MuiIcon",slot:"Root",overridesResolver:(t,o)=>{const{ownerState:n}=t;return[o.root,n.color!=="inherit"&&o[`color${J(n.color)}`],o[`fontSize${J(n.fontSize)}`]]}})(He(({theme:t})=>({userSelect:"none",width:"1em",height:"1em",overflow:"hidden",display:"inline-block",textAlign:"center",flexShrink:0,variants:[{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:t.typography.pxToRem(20)}},{props:{fontSize:"medium"},style:{fontSize:t.typography.pxToRem(24)}},{props:{fontSize:"large"},style:{fontSize:t.typography.pxToRem(36)}},{props:{color:"action"},style:{color:(t.vars||t).palette.action.active}},{props:{color:"disabled"},style:{color:(t.vars||t).palette.action.disabled}},{props:{color:"inherit"},style:{color:void 0}},...Object.entries(t.palette).filter(qe()).map(([o])=>({props:{color:o},style:{color:(t.vars||t).palette[o].main}}))]}))),ye=h.forwardRef(function(o,n){const s=Ke({props:o,name:"MuiIcon"}),{baseClassName:r="material-icons",className:a,color:c="inherit",component:i="span",fontSize:d="medium",...l}=s,p={...s,baseClassName:r,color:c,component:i,fontSize:d},f=Nt(p);return e.jsx(_t,{as:i,className:$e(r,"notranslate",f.root,a),ownerState:p,"aria-hidden":!0,ref:n,...l})});ye.muiName="Icon";const Wt=he(e.jsx("path",{d:"M6 6v2h8.59L5 17.59 6.41 19 16 9.41V18h2V6z"})),Ft=he(e.jsx("path",{d:"M14.69 2.21 4.33 11.49c-.64.58-.28 1.65.58 1.73L13 14l-4.85 6.76c-.22.31-.19.74.08 1.01.3.3.77.31 1.08.02l10.36-9.28c.64-.58.28-1.65-.58-1.73L11 10l4.85-6.76c.22-.31.19-.74-.08-1.01-.3-.3-.77-.31-1.08-.02"})),Gt=he(e.jsx("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"}));async function Kt({blockletDid:t,nodeApi:o,spaceGateways:n}){let s=!1;const r=await Promise.all(n.map(async a=>{let{name:c}=a;const i=await Ct(a.endpoint);return!q(i)&&i!==c&&(c=i,s=!0),{...a,name:c}}));return s&&await Promise.all(r.filter(a=>a.did).map(a=>o.updateBlockletSpaceGateway({input:{did:t,where:{did:a.did},spaceGateway:{...a}}}))),r}function $t({refresh:t}={}){const{blocklet:o}=U(),n=o?.meta?.did,{api:s}=A();return Ce(async()=>{if(!n)return[];const{spaceGateways:r}=await s.getBlockletSpaceGateways({input:{did:n}});return await Kt({blockletDid:n,nodeApi:s,spaceGateways:r})??[]},{refreshDeps:[n,t],onError(r){r?.message?.includes("not logged")?console.warn(r):(console.error(r),B.error(V(r)))}})}function Te({deps:t,setLoading:o,backupDate:n}={deps:[],setLoading:()=>{},backupDate:new Date}){const{blocklet:s}=U(),[r,a]=h.useState([]),{api:c}=A(),[i,d]=h.useMemo(()=>n?[E(n).startOf("day").toISOString(),E(n).endOf("day").toISOString()]:[E().startOf("year").toISOString(),E().endOf("day").toISOString()],[n]),l=we(async()=>{try{if(o(!0),!s){a([]);return}const{backups:p}=await c.getBlockletBackups({input:{did:s.meta.did,startTime:i,endTime:d}});a(p??[])}catch(p){console.error(p),B.error(V(p))}finally{o(!1)}},1e3);return Be(async()=>{l()},[s?.meta?.did].concat(t)),{backups:r}}function Yt({appDid:t}){const{backups:o}=Te(),[n,s]=h.useState({message:"",progress:0,completed:!1}),r=A(),{ws:{useSubscription:a}}=r;return a(N.BlockletEvents.backupProgress,c=>{t===c?.appDid&&s(()=>({...c}))},[t]),h.useEffect(()=>{if(o?.length&&Ve(o[0]?.status)){const[c]=o;s(()=>({message:c.message,progress:c.progress,completed:c.progress>=100}))}},[o]),n}function Ht({deps:t=[],setLoading:o=()=>{}}={}){const{blocklet:n}=U(),[s,r]=h.useState([]),{api:a}=A(),c=h.useCallback(we(async()=>{if(!a||!n?.meta?.did){r([]);return}try{o(!0);const i=E(),d=i.subtract(1,"year"),{summary:l}=await a.getBlockletBackupSummary({input:{did:n.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(V(i)),r([])}finally{o(!1)}},1e3),[]);return Be(async()=>(await c(),()=>{c.cancel()}),[n?.meta?.did].concat(t)),{backupSummary:s}}const Re=h.createContext({}),{Provider:qt,Consumer:Ho}=Re;function ze({children:t}){const{t:o}=D(),{api:n}=A(),{blocklet:s}=U(),[r,a]=h.useState(null),[c,i]=h.useState(!1),{data:d,loading:l,mutate:p}=$t({refresh:c}),f=Qe(d),x=Yt({appDid:s?.appDid}),u=h.useMemo(()=>wt(s?.environments),[s?.environments]),[k,w]=h.useState(!1),[y,b]=h.useState(0),{backups:te}=Te({deps:[y,r],setLoading:w,backupDate:r}),[oe,se]=h.useState(0),{backupSummary:ne}=Ht({deps:[oe]}),[_,M]=h.useState(d?.find(g=>g.endpoint===u)),I=s?.settings?.autoBackup,z=()=>{i(g=>!g)},ae=()=>{se(g=>g+1)},re=()=>{b(g=>g+1)},G=async g=>{await n.updateAutoBackup({input:{did:s.meta.did,autoBackup:g}})},Q=async()=>{await n.abortBlockletBackup({input:{appPid:s.meta.did}})},ie=async(g,P)=>{try{p(R=>{const v=[...R];return v.push({...g,loading:!0}),v}),await n.addBlockletSpaceGateway({input:{did:s.meta.did,spaceGateway:g}}),u!==P&&await n.configBlocklet({input:{did:[s.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:P}]}}),M(g),z(),B.success(o("storage.spaces.connectedWithName",{name:g?.name??"DID Spaces"}))}catch(R){throw console.error(R),p(v=>[...v].filter(W=>W.did!==g.did)),R}},ce=async g=>{g&&(g.endpoint===u&&(await n.configBlocklet({input:{did:[s.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),I?.enabled&&await G({enabled:!1})),await n.deleteBlockletSpaceGateway({input:{did:s.meta.did,spaceGatewayDid:g?.did}}),p(P=>{const R=[...P];return R.splice(R.indexOf(g),1),R}),M(g),z())},le=async g=>{await Promise.all([n.updateBlockletSpaceGateway({input:{did:s.meta.did,where:{did:g.did},spaceGateway:g}}),u!==g.endpoint&&n.configBlocklet({input:{did:[s.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:g.endpoint}]}})]),B.success(o("storage.spaces.connectedWithName",{name:g?.name??"DID Spaces"})),z()},C=g=>g?.endpoint===u;return e.jsx(qt,{value:{spaceGateways:d||[],selectedSpaceGateway:_,addSpaceGateway:ie,deleteSpaceGateway:ce,updateSpaceGateway:le,refreshSpaceGateways:z,spaceGatewaysLoading:l,spaceGatewaysFirstLoading:f,spaceGatewayIsSelected:C,updateAutoBackup:G,abortBlockletBackup:Q,backupEndpoint:u,backupProgress:x,backups:te,backupSummary:ne,refreshBackupSummary:ae,refreshBackups:re,setBackupDate:a,backupsLoading:k,autoBackup:I},children:t})}ze.propTypes={children:m.any.isRequired};function O(){return h.useContext(Re)}function ve({...t}){const{blocklet:o}=U(),{info:n}=A(),{t:s}=D(),r=Ie({blocklet:o}),a=Xe(n),{spaceGateways:c,addSpaceGateway:i}=O(),d={checkFn:De.create({baseURL:fe(window.location.origin,Ze())}).get,webWalletUrl:a,extraParams:{appPid:o.appPid,appDid:r.appDid,appName:r.appName,appDescription:r.appDescription,appUrl:r.appUrl,referrer:r.referrer,scopes:r.scopes,nodeDid:n.did}},l=async({endpoint:f,name:x,did:u})=>{const k=await Bt(f);if(!await Dt(k)){B.error(s("storage.spaces.gateway.add.invalidUrl"));return}if(c.some(b=>b.endpoint===f)){B.error(s("storage.spaces.gateway.add.duplicate",{name:x}));return}await i({name:x,did:u,url:k,endpoint:f},f)},p=async({spaceGateway:f})=>{try{await l(f)}catch(x){console.error(x),B.error(V(x))}};return e.jsx(ft,{...t,connectScope:"app",options:d,onSuccess:p})}function Vt(){const{api:t}=A(),{blocklet:o}=U(),{data:n,loading:s}=Ce(()=>t.getBlocklet({input:{did:o?.meta?.did,attachDiskInfo:!0,attachRuntimeInfo:!0}}),{ready:!!o?.meta?.did,refreshDeps:[o?.meta?.did]});return{blocklet:n?.blocklet??null,loading:s}}function Pe({...t}){const{t:o}=h.useContext(Je),{blocklet:n,loading:s}=Vt();if(n?.diskInfo){const r=(i,d,l)=>e.jsxs(j,{children:[i," ",e.jsx("strong",{children:d?et(d):"empty"})]}),a=n.environments.reduce((i,d)=>(i[d.key]=d.value,i),{}),c=[{key:"appDir",name:o("blocklet.diskInfo.appDir"),value:r(a.BLOCKLET_APP_DIR,n.diskInfo.app)},{key:"dataDir",name:o("blocklet.diskInfo.dataDir"),value:r(a.BLOCKLET_DATA_DIR,n.diskInfo.data)},{key:"logDir",name:o("blocklet.diskInfo.logDir"),value:r(a.BLOCKLET_LOG_DIR,n.diskInfo.log)},{key:"cacheDir",name:o("blocklet.diskInfo.cacheDir"),value:r(a.BLOCKLET_CACHE_DIR,n.diskInfo.cache)}];return e.jsx(Qt,{component:"div",...t,children:c.map(i=>e.jsx(Rt,{valueComponent:"div",nameWidth:120,name:i.name,children:i.value},i.key))})}return s?e.jsx(L,{}):e.jsx(j,{children:o("blocklet.diskInfo.empty")})}const Qt=tt(j)``;function Ae(){const{t}=D(),{setBackupDate:o,backupSummary:n}=O(),s=xt({key:"lg"}),r=h.useRef(null),a=ot(),c=h.useCallback(l=>{o(l)},[o]),i=h.useMemo(()=>{const l=E().add(1,"day"),p=l.subtract(1,"year"),f=new Map(n.map(u=>[u.date,{date:u.date,successCount:u.successCount,errorCount:u.errorCount}])),x=[];for(let u=p.clone();E(u).isBefore(l);u=u.add(1,"day")){const k=u.format("YYYY-MM-DD");x.push(f.get(k)||{date:k,successCount:0,errorCount:0})}return x},[n]),d=h.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:12},tooltip:{formatter:k=>{const{date:w,successCount:y,errorCount:b}=i[k.dataIndex]||{date:k.data[0],successCount:0,errorCount:0};return[`<div>${t("common.time")}: ${w}</div>`,`<div>${t("common.succeeded")}: ${y}</div>`,`<div>${t("common.failed")}: ${b}</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:X[600]},{min:-9,max:-6,color:X[500]},{min:-6,max:-3,color:X[400]},{min:-3,max:-1,color:X[300]},{min:0,max:0,color:a.palette.grey[200]},{min:1,max:3,color:Z[300]},{min:3,max:6,color:Z[400]},{min:6,max:9,color:Z[500]},{min:9,max:Number.MAX_SAFE_INTEGER,color:Z[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:st[200],color:"inherit"}}}}),[i,t,a]);return e.jsxs(e.Fragment,{children:[e.jsx(S,{ref:r,sx:{maxWidth:"1280px",border:"1px solid",borderColor:"divider",padding:"8px",overflowX:"auto"},children:e.jsx(S,{sx:{width:"1200px",height:"180px",position:"relative"},children:e.jsx(zt,{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(S,{sx:{display:"flex",justifyContent:"flex-end",mt:1,mr:s?2:5,mb:2},children:e.jsxs(F,{direction:s?"column":"row",spacing:s?2:1,sx:{width:"100%",justifyContent:"flex-start",alignItems:s?"flex-start":"center"},children:[e.jsxs(F,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(S,{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(F,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(S,{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(F,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(S,{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 Xt=ee(({className:t,...o})=>e.jsx(Se,{...o,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function Le({status:t,message:o="",createdAt:n}){const{t:s}=D(),r=t===T.BACKUPS.STATUS.PROGRESS&&E().diff(n,"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(L,{sx:{marginRight:"4px"},size:"12px"}),s("common.progress")]}):i?e.jsx(H,{type:"success",children:s("common.succeeded")}):e.jsxs(S,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(H,{type:"error",children:s("common.failed")}),e.jsx(Se,{style:{display:"flex",alignItems:"center",flexShrink:0},title:o||a,children:e.jsx(ye,{children:e.jsx(vt,{style:{width:"24px",height:"24px"},color:"error"})})})]})}Le.propTypes={status:m.string.isRequired,message:m.string,createdAt:m.string.isRequired};function Ue({metadata:t={}}){const{t:o}=D();if(q(t))return e.jsx(H,{type:"success",children:o("common.succeeded")});const n=t.count||0,s=t.size||0,r=At(s,{iec:!0}),a=e.jsxs(S,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:[e.jsxs(j,{variant:"body2",children:[o("common.fileCount"),": ",n]}),e.jsxs(j,{variant:"body2",children:[o("common.fileSize"),": ",r]})]});return e.jsxs(S,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(H,{type:"success",children:o("common.succeeded")}),e.jsx(Xt,{title:a,style:{display:"flex",alignItems:"center",flexShrink:0},placement:"left",children:e.jsx(ye,{children:e.jsx(at,{style:{width:"24px",height:"24px"},color:"primary"})})})]})}Ue.propTypes={metadata:m.object};function Oe(){const{t,locale:o}=D(),{spaceGateways:n,backups:s,backupsLoading:r}=O(),a=h.useMemo(()=>[{label:"DID Space",name:"target",options:{customBodyRenderLite:i=>{const{targetUrl:d,targetName:l,status:p,createdAt:f}=s[i],x=p===T.BACKUPS.STATUS.PROGRESS&&E().diff(f,"hours")>=T.BACKUPS.TIMEOUT_HOURS,u=p===T.BACKUPS.STATUS.SUCCEEDED&&!x,k=l||n.find(w=>d?.includes(ge(w?.endpoint)))?.name||"Unknown DID Space";return u?e.jsx(nt,{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(H,{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=>q(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:p,createdAt:f,metadata:x}=d,u=l===T.BACKUPS.STATUS.PROGRESS&&E().diff(f,"hours")>=T.BACKUPS.TIMEOUT_HOURS,k=l===T.BACKUPS.STATUS.PROGRESS&&!u,w=l===T.BACKUPS.STATUS.SUCCEEDED&&!u;return k?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(L,{sx:{marginRight:"4px"},size:"12px"}),t("common.progress")]}):w?e.jsx(Ue,{metadata:x}):e.jsx(Le,{status:l,message:p,createdAt:f})}}}],[s,n,t]),c=h.useMemo(()=>!s?.length,[s]);return e.jsx(e.Fragment,{children:c?e.jsx(S,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100px",color:"#9397A1",marginTop:"16px",marginBottom:"24px"},children:t("storage.spaces.record.emptyData")}):e.jsx(Pt,{title:"",loading:r,data:s,columns:a,emptyNode:t("storage.spaces.record.emptyData",o),options:{download:!1,filter:!1,print:!1,search:!1,viewColumns:!1}})})}function Zt(){const{t}=D();return e.jsxs(S,{children:[e.jsxs(S,{sx:{display:"flex",gap:3,flexDirection:{xs:"column",md:"row"}},children:[e.jsxs(S,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",alignContent:"center",minWidth:240},children:[e.jsx(gt,{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(ve,{})]}),e.jsxs(S,{sx:{flexGrow:1,minWidth:0},children:[e.jsx(S,{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 Me({spaceGateway:t,onConfirm:o=()=>{},onCancel:n=()=>{}}){const{t:s}=D(),[r,a]=h.useState(!1),[c,i]=h.useState(!1),d=(f,x)=>{f?.preventDefault(),f?.stopPropagation(),a(x)},l=async f=>{try{f?.stopPropagation(),i(!0),await o?.(t),a(!1)}catch(x){console.error(x),B.error(`${s("storage.space.gateway.delete.failed")}: ${V(x)}`)}finally{a(!1),i(!1)}},p=f=>{d(f,!1),n?.(f)};return e.jsxs(e.Fragment,{children:[e.jsxs(K,{color:"red",onClick:f=>d(f,!0),children:[e.jsx($,{style:{minWidth:24,color:"red"},children:e.jsx(Ut,{fontSize:"small"})}),e.jsx(Y,{style:{color:"red"},children:s("common.disconnect")})]}),e.jsx(rt,{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:p,children:e.jsx(j,{sx:{wordWrap:"break-word"},children:s("storage.spaces.gateway.delete.descForBackup",{name:`${t?.name}`})})})]})}Me.propTypes={spaceGateway:m.shape({name:m.string.isRequired,url:m.string.isRequired,protected:m.bool}).isRequired,onConfirm:m.func,onCancel:m.func};function Ne({spaceGateway:t,selected:o,onDelete:n=()=>{},onConnect:s=()=>{},enableSwitchToSpace:r=!0,backupInProgress:a=!1,...c}){const{abortBlockletBackup:i}=O(),[d,l]=h.useState(null),{t:p}=D(),[f,x]=h.useState(!1),u=(y,b)=>{y.stopPropagation(),y.preventDefault(),l(b&&y.currentTarget)},k=async y=>{try{x(!0),u(y,!1),await s(t)}catch(b){console.error(b),B.error(b.message)}finally{x(!1)}},w=async y=>{try{x(!0),u(y,!1),await i()}catch(b){console.error(b),B.error(b.message)}finally{x(!1)}};return e.jsxs(e.Fragment,{children:[f||t?.loading?e.jsx(L,{sx:{ml:1},size:"24px"}):e.jsx(it,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions",variant:"outlined",size:"small",onClick:y=>u(y,!0),...c,children:e.jsx(ct,{})}),e.jsxs(lt,{id:"simple-menu",anchorEl:d,keepMounted:!0,open:!!d,onClose:y=>u(y,!1),children:[e.jsxs(K,{onClick:y=>{u(y,!1),window.open(ke(t.endpoint?Et(t.endpoint):t.url,{allowDomains:null}))},children:[e.jsx($,{style:{minWidth:24},children:e.jsx(Wt,{fontSize:"small"})}),e.jsx(Y,{children:p("common.open")})]}),e.jsxs(K,{onClick:y=>{u(y,!1),window.open(ke(It(t.endpoint),{allowDomains:null}))},children:[e.jsx($,{style:{minWidth:24},children:e.jsx(Gt,{fontSize:"small"})}),e.jsx(Y,{children:p("storage.spaces.strategy.viewBackupFiles")})]}),!o&&r&&e.jsxs(K,{onClick:k,children:[e.jsx($,{style:{minWidth:24},children:e.jsx(Ft,{fontSize:"small"})}),e.jsx(Y,{children:p("storage.spaces.connect.switchToSpace")})]}),a&&e.jsxs(K,{onClick:w,children:[e.jsx($,{style:{minWidth:24},children:e.jsx(Lt,{fontSize:"small"})}),e.jsx(Y,{children:p("storage.spaces.connect.abortBlockletBackup")})]}),!a&&e.jsx(Me,{spaceGateway:t,onConfirm:async()=>{l(null),await n?.(t)},onCancel:()=>l(null)})]})]})}Ne.propTypes={spaceGateway:m.shape({name:m.string.isRequired,url:m.string.isRequired,protected:m.bool,endpoint:m.string.isRequired,loading:m.bool}).isRequired,selected:m.bool.isRequired,enableSwitchToSpace:m.bool,onDelete:m.func,onConnect:m.func,backupInProgress:m.bool};const Jt=ee(({className:t,...o})=>e.jsx(Se,{...o,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function _e({spaceGateway:t,spaceStatus:o,selected:n,onConnected:s=()=>{},onDeleted:r=()=>{},onBackedUp:a=()=>{}}){const{t:c,locale:i}=D(),{blocklet:d}=U(),{api:l,info:{did:p}}=A(),{appDid:f,appName:x,appDescription:u,scopes:k,appUrl:w,referrer:y}=Ie({blocklet:d}),{backupProgress:b,updateSpaceGateway:te,deleteSpaceGateway:oe,refreshBackupSummary:se,refreshBackups:ne}=O(),[_,M]=h.useState(!1),[I,z]=h.useState({open:!1,action:"one-click-authorization",checkTimeout:1e3*300,messages:{title:c("storage.spaces.authorize.title",{appName:x},i),scan:c("storage.spaces.authorize.scan",{appName:x},i),confirm:"",success:e.jsx(j,{gutterBottom:!0,children:c("storage.spaces.authorize.success")})},onClose:()=>{z(C=>({...C,open:!1}))}}),ae=n&&!_&&o===ue.DISCONNECTED,re=n&&!_&&!t.loading&&o===ue.CONNECTED,G=n&&_&&o===ue.CONNECTED&&b?.progress>=0,Q=async()=>{try{if(await Tt(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}z(C=>({...C,open:!0,prefix:fe(t.url,"space/api/did"),baseUrl:new URL(t.url).origin,checkFn:De.create({baseURL:fe(t.url,"space")}).get,extraParams:{appDid:f,appName:x,appDescription:u,scopes:k,appUrl:w,referrer:y,nodeDid:p,spaceDid:t.did}}))},ie=async(C,g)=>{const P=g(C.endpoint),R=ge(P),v=C.space?g(C.space):{};if(t.did&&R!==t.did){z(We=>({...We,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 de={...t,name:v.name??"DID Space",did:v.did??ge(P),endpoint:P};await te(de),z(W=>({...W,open:!1})),s?.(null,de)},ce=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)}},le=async()=>{try{await oe(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 h.useEffect(()=>{b?.completed?(n&&(b?.progress===100?(B.success(c("storage.spaces.backupSuccessfully")),a?.(null,t)):b.message&&a?.(new Error(b?.message),t),b.progress=0,b.message=""),M(!1),se(),ne()):b.progress&&M(!0)},[b]),e.jsxs(e.Fragment,{children:[e.jsxs(S,{sx:{display:"flex",alignItems:"center",".action-btn":{borderRadius:1,marginLeft:1}},children:[re&&e.jsx(pe,{className:"action-btn",variant:"outlined",size:"small",onClick:ce,children:c("storage.spaces.strategy.backupNow")}),ae&&e.jsx(pe,{className:"action-btn",variant:"outlined",size:"small",onClick:Q,children:c("storage.spaces.disconnected.reconnectNow")}),G&&e.jsx(Jt,{title:b?.message&&e.jsx(S,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:e.jsx(j,{variant:"body2",children:b.message})}),children:e.jsxs(pe,{className:"action-btn",variant:"outlined",size:"small",sx:{minWidth:70},children:[e.jsx(L,{variant:"determinate",value:b?.progress,size:14,sx:{mr:1}}),b?.progress,"%"]})}),e.jsx(dt,{forceConnected:!1,saveConnect:!1,prefix:I.prefix,open:I.open,popup:!0,action:I.action,baseUrl:I.baseUrl,checkFn:I.checkFn,onSuccess:ie,onClose:I.onClose,checkTimeout:I.checkTimeout,extraParams:I.extraParams,messages:I.messages,locale:i},"get-endpoint")]}),e.jsx(Ne,{sx:{minWidth:32,padding:"2px 4px",ml:1},spaceGateway:t,selected:n,onDelete:le,onConnect:Q,enableSwitchToSpace:b?.completed||q(b?.message),backupInProgress:G})]})}_e.propTypes={spaceGateway:m.shape({did:m.string.isRequired,name:m.string.isRequired,url:m.string.isRequired,endpoint:m.string.isRequired,protected:m.bool,loading:m.bool}).isRequired,spaceStatus:m.string.isRequired,selected:m.bool.isRequired,onConnected:m.func,onDeleted:m.func,onBackedUp:m.func};function eo({...t}){const{t:o}=D();return e.jsxs(S,{...t,children:[e.jsx(S,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:o("storage.spaces.backup.records")})}),e.jsx(Ae,{}),e.jsx(Oe,{})]})}function to({...t}){const{t:o}=D(),{autoBackup:n,updateAutoBackup:s}=O(),r=async()=>{try{const a=!n?.enabled;await s({enabled:a}),B.success(o(a?"storage.spaces.autoBackup.enabled":"storage.spaces.autoBackup.disabled"))}catch(a){B.error(a.message)}};return e.jsx(Ot,{checked:!!n?.enabled,onChange:r,name:"enableWelcomePage",labelProps:{label:e.jsx(j,{sx:{marginRight:"8px"},children:e.jsx("span",{children:o("storage.spaces.autoBackup.title")})})},style:{...t.style}})}function oo(){const{t}=D(),{spaceGateways:o,spaceGatewaysLoading:n,spaceGatewayIsSelected:s}=O(),r=n&&!o?.length,a=({spaceGateway:c,spaceStatus:i,selected:d,refresh:l})=>e.jsx(_e,{spaceGateway:c,spaceStatus:i,selected:d,onConnected:()=>l(),onBackedUp:p=>p&&l()});return e.jsxs(S,{sx:{display:"flex",flexDirection:"column"},children:[e.jsxs(S,{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(to,{}),e.jsx(ve,{})]}),e.jsx(S,{sx:{mt:2},children:r?e.jsx(S,{sx:{display:"flex",justifyContent:"center"},children:e.jsx(L,{})}):e.jsx(be,{container:!0,spacing:2,children:e.jsx(e.Fragment,{children:o.map(c=>e.jsx(be,{size:{xs:12,md:6},children:e.jsx(ht,{endpoint:c.endpoint,selected:s(c),action:a},c.endpoint)},c.endpoint))})})}),e.jsx(eo,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2},children:t("common.dataStorage")}),e.jsx(Pe,{})]})}function so(){const{spaceGatewaysFirstLoading:t,spaceGateways:o}=O();return t?e.jsx(Ee,{relative:"parent",children:e.jsx(L,{})}):q(o)?e.jsx(Zt,{}):e.jsx(oo,{})}function no(){return e.jsx(ze,{children:e.jsx(so,{})})}function ao(){const{spaceGateway:t,settingStorageEndpoint:o,updateSpaceGateway:n,hasStorageEndpoint:s,loading:r,storageEndpoint:a}=yt(),c=xe(()=>({display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"16px"}));return r?e.jsx(Ee,{relative:"parent",children:e.jsx(L,{})}):e.jsxs(S,{sx:{maxWidth:"md",position:"relative"},children:[s?e.jsx(bt,{spaceGateway:t,settingStorageEndpoint:o}):e.jsx(kt,{}),e.jsx(S,{sx:c,children:e.jsx(jt,{onConnect:n,storageEndpoint:a})})]})}function ro(){const{t}=D();return e.jsxs(St,{children:[e.jsxs(F,{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(ao,{})]})}function io({navOrientation:t="vertical",...o}){const{t:n,locale:s}=D(),{blocklet:r}=U(),a=mt({key:"md"}),[c,i]=pt(),d=c.get("tab")||"backup",l=a?"horizontal":t,p=xe(()=>{const w=[{label:n("common.backup"),value:"backup"}],y=r?.capabilities?.didSpace;return(y===N.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED||y===N.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP)&&w.push({label:n("common.storage"),value:"storage"}),w},[s,l]),x=xe(()=>({backup:e.jsx(no,{}),storage:e.jsx(ro,{})}))[d],u=w=>{i(y=>(w==="backup"?y.delete("tab"):y.set("tab",w),y))};if(p.length<=1)return e.jsx(me,{children:x});const k=e.jsx(ut,{tabs:p,current:d,orientation:l,onChange:u,sx:[{borderRight:1,height:"100%",borderColor:"divider"},l==="horizontal"&&{borderRight:0}]});if(l==="vertical")return e.jsx(S,{...o,children:e.jsxs(F,{direction:{md:"column",lg:"row"},sx:{gap:2},children:[e.jsx(S,{sx:{flexShrink:0},children:e.jsx(je,{left:k})}),e.jsx(S,{sx:{flexGrow:1,minWidth:0},children:e.jsx(me,{sx:{mt:1},children:x})})]})});if(l==="horizontal")return e.jsxs(S,{...o,children:[e.jsx(je,{left:k}),e.jsx(me,{sx:{mt:2},children:x})]})}io.propTypes={navOrientation:m.oneOf(["vertical","horizontal"])};const me=ee(S)`
|
|
1
|
+
import{bY as Ge,bX as Ke,r as h,bZ as Fe,j as e,b8 as ee,b$ as $e,cc as J,c0 as Ye,bV as He,ce as qe,aF as he,M as q,bn as A,cr as Ce,H as B,X as V,bf as E,fB as we,aQ as Be,b as N,iY as Ve,V as D,gD as Qe,o as m,x as Xe,aw as De,y as fe,ak as Ze,p as Je,C as L,T as j,k as et,s as tt,f as ot,iZ as X,h$ as Z,i_ as st,K as S,aV as G,aH as T,L as nt,g as H,dj as at,ay as Se,Q as F,aE as $,a8 as Y,a4 as rt,dG as it,gt as ct,a$ as lt,v as pe,w as dt,G as be,Y as Ee,bz as xe,B as pt}from"./index-oppNoNvH.js";import{T as ut}from"./html-title-DV29cJ5k.js";import{u as U}from"./blocklet--AI07_i0.js";import{u as mt}from"./use-mobile-B3ZO2ENR.js";import{c as Ie,d as ft,e as xt,f as gt,g as ue,h as ht,b as St,u as yt,C as bt,D as kt,a as jt}from"./connect-to-DP2mM_22.js";import"./index-DnGfacYV.js";import"./index-BojVbZw0.js";import"./api-DAWWUzPu.js";import{d as Ct,a as wt,g as Bt,i as Dt,e as ge,f as Et,h as It,j as Tt}from"./spaces-B91L1fYZ.js";import{v as Rt}from"./index-CQwHcXdR.js";import{E as zt}from"./index-CeeztwBq.js";import{H as vt}from"./HelpOutline-OM9v4KDS.js";import{H as Pt}from"./index-BwAtwN98.js";import{x as At}from"./index-DRYJ0xIl.js";import{c as Lt}from"./actions-BU7VBlNr.js";import{D as Ut}from"./DeleteOutline-DeY1XytP.js";import{g as ke}from"./get-safe-url-CWx4sAFH.js";import{S as Ot}from"./switch-control-C9oMQ7W-.js";import{L as je}from"./list-header-xkh_uL_h.js";import"./OpenInNew-BZCBTL61.js";import"./ButtonGroup-zxfGLX1y.js";import"./getValidReactChildren-Cg2u2AWU.js";import"./FilterList-5aPzs6zd.js";import"./CSSTransition-BHFpNneQ.js";import"./emotion-cache.browser.esm-89zxT23k.js";import"./index-CsAuzX0k.js";import"./redux-DfszZyTl.js";import"./typeof-QjJsDpFa.js";import"./depsEqual-DM_xCHol.js";import"./index-1qcmbchL.js";import"./TableSearch-DsuiCyEx.js";import"./Search-CbRhrT-l.js";import"./Clear-CmclKblN.js";import"./MoreVert-CdXWMKz-.js";import"./useLocalStorage-CZNQlTk5.js";import"./url-evaluation-QeH6FlO4.js";import"./permission-DZytcuWC.js";import"./Switch-D12CiGzx.js";function Mt(t){return Ge("MuiIcon",t)}Ke("MuiIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const Nt=t=>{const{color:o,fontSize:n,classes:s}=t,r={root:["root",o!=="inherit"&&`color${J(o)}`,`fontSize${J(n)}`]};return Ye(r,Mt,s)},_t=ee("span",{name:"MuiIcon",slot:"Root",overridesResolver:(t,o)=>{const{ownerState:n}=t;return[o.root,n.color!=="inherit"&&o[`color${J(n.color)}`],o[`fontSize${J(n.fontSize)}`]]}})(He(({theme:t})=>({userSelect:"none",width:"1em",height:"1em",overflow:"hidden",display:"inline-block",textAlign:"center",flexShrink:0,variants:[{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:t.typography.pxToRem(20)}},{props:{fontSize:"medium"},style:{fontSize:t.typography.pxToRem(24)}},{props:{fontSize:"large"},style:{fontSize:t.typography.pxToRem(36)}},{props:{color:"action"},style:{color:(t.vars||t).palette.action.active}},{props:{color:"disabled"},style:{color:(t.vars||t).palette.action.disabled}},{props:{color:"inherit"},style:{color:void 0}},...Object.entries(t.palette).filter(qe()).map(([o])=>({props:{color:o},style:{color:(t.vars||t).palette[o].main}}))]}))),ye=h.forwardRef(function(o,n){const s=Fe({props:o,name:"MuiIcon"}),{baseClassName:r="material-icons",className:a,color:c="inherit",component:i="span",fontSize:d="medium",...l}=s,p={...s,baseClassName:r,color:c,component:i,fontSize:d},f=Nt(p);return e.jsx(_t,{as:i,className:$e(r,"notranslate",f.root,a),ownerState:p,"aria-hidden":!0,ref:n,...l})});ye.muiName="Icon";const Wt=he(e.jsx("path",{d:"M6 6v2h8.59L5 17.59 6.41 19 16 9.41V18h2V6z"})),Gt=he(e.jsx("path",{d:"M14.69 2.21 4.33 11.49c-.64.58-.28 1.65.58 1.73L13 14l-4.85 6.76c-.22.31-.19.74.08 1.01.3.3.77.31 1.08.02l10.36-9.28c.64-.58.28-1.65-.58-1.73L11 10l4.85-6.76c.22-.31.19-.74-.08-1.01-.3-.3-.77-.31-1.08-.02"})),Kt=he(e.jsx("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"}));async function Ft({blockletDid:t,nodeApi:o,spaceGateways:n}){let s=!1;const r=await Promise.all(n.map(async a=>{let{name:c}=a;const i=await Ct(a.endpoint);return!q(i)&&i!==c&&(c=i,s=!0),{...a,name:c}}));return s&&await Promise.all(r.filter(a=>a.did).map(a=>o.updateBlockletSpaceGateway({input:{did:t,where:{did:a.did},spaceGateway:{...a}}}))),r}function $t({refresh:t}={}){const{blocklet:o}=U(),n=o?.meta?.did,{api:s}=A();return Ce(async()=>{if(!n)return[];const{spaceGateways:r}=await s.getBlockletSpaceGateways({input:{did:n}});return await Ft({blockletDid:n,nodeApi:s,spaceGateways:r})??[]},{refreshDeps:[n,t],onError(r){r?.message?.includes("not logged")?console.warn(r):(console.error(r),B.error(V(r)))}})}function Te({deps:t,setLoading:o,backupDate:n}={deps:[],setLoading:()=>{},backupDate:new Date}){const{blocklet:s}=U(),[r,a]=h.useState([]),{api:c}=A(),[i,d]=h.useMemo(()=>n?[E(n).startOf("day").toISOString(),E(n).endOf("day").toISOString()]:[E().startOf("year").toISOString(),E().endOf("day").toISOString()],[n]),l=we(async()=>{try{if(o(!0),!s){a([]);return}const{backups:p}=await c.getBlockletBackups({input:{did:s.meta.did,startTime:i,endTime:d}});a(p??[])}catch(p){console.error(p),B.error(V(p))}finally{o(!1)}},1e3);return Be(async()=>{l()},[s?.meta?.did].concat(t)),{backups:r}}function Yt({appDid:t}){const{backups:o}=Te(),[n,s]=h.useState({message:"",progress:0,completed:!1}),r=A(),{ws:{useSubscription:a}}=r;return a(N.BlockletEvents.backupProgress,c=>{t===c?.appDid&&s(()=>({...c}))},[t]),h.useEffect(()=>{if(o?.length&&Ve(o[0]?.status)){const[c]=o;s(()=>({message:c.message,progress:c.progress,completed:c.progress>=100}))}},[o]),n}function Ht({deps:t=[],setLoading:o=()=>{}}={}){const{blocklet:n}=U(),[s,r]=h.useState([]),{api:a}=A(),c=h.useCallback(we(async()=>{if(!a||!n?.meta?.did){r([]);return}try{o(!0);const i=E(),d=i.subtract(1,"year"),{summary:l}=await a.getBlockletBackupSummary({input:{did:n.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(V(i)),r([])}finally{o(!1)}},1e3),[]);return Be(async()=>(await c(),()=>{c.cancel()}),[n?.meta?.did].concat(t)),{backupSummary:s}}const Re=h.createContext({}),{Provider:qt,Consumer:Ho}=Re;function ze({children:t}){const{t:o}=D(),{api:n}=A(),{blocklet:s}=U(),[r,a]=h.useState(null),[c,i]=h.useState(!1),{data:d,loading:l,mutate:p}=$t({refresh:c}),f=Qe(d),x=Yt({appDid:s?.appDid}),u=h.useMemo(()=>wt(s?.environments),[s?.environments]),[k,w]=h.useState(!1),[y,b]=h.useState(0),{backups:te}=Te({deps:[y,r],setLoading:w,backupDate:r}),[oe,se]=h.useState(0),{backupSummary:ne}=Ht({deps:[oe]}),[_,M]=h.useState(d?.find(g=>g.endpoint===u)),I=s?.settings?.autoBackup,z=()=>{i(g=>!g)},ae=()=>{se(g=>g+1)},re=()=>{b(g=>g+1)},K=async g=>{await n.updateAutoBackup({input:{did:s.meta.did,autoBackup:g}})},Q=async()=>{await n.abortBlockletBackup({input:{appPid:s.meta.did}})},ie=async(g,P)=>{try{p(R=>{const v=[...R];return v.push({...g,loading:!0}),v}),await n.addBlockletSpaceGateway({input:{did:s.meta.did,spaceGateway:g}}),u!==P&&await n.configBlocklet({input:{did:[s.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:P}]}}),M(g),z(),B.success(o("storage.spaces.connectedWithName",{name:g?.name??"DID Spaces"}))}catch(R){throw console.error(R),p(v=>[...v].filter(W=>W.did!==g.did)),R}},ce=async g=>{g&&(g.endpoint===u&&(await n.configBlocklet({input:{did:[s.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),I?.enabled&&await K({enabled:!1})),await n.deleteBlockletSpaceGateway({input:{did:s.meta.did,spaceGatewayDid:g?.did}}),p(P=>{const R=[...P];return R.splice(R.indexOf(g),1),R}),M(g),z())},le=async g=>{await Promise.all([n.updateBlockletSpaceGateway({input:{did:s.meta.did,where:{did:g.did},spaceGateway:g}}),u!==g.endpoint&&n.configBlocklet({input:{did:[s.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:g.endpoint}]}})]),B.success(o("storage.spaces.connectedWithName",{name:g?.name??"DID Spaces"})),z()},C=g=>g?.endpoint===u;return e.jsx(qt,{value:{spaceGateways:d||[],selectedSpaceGateway:_,addSpaceGateway:ie,deleteSpaceGateway:ce,updateSpaceGateway:le,refreshSpaceGateways:z,spaceGatewaysLoading:l,spaceGatewaysFirstLoading:f,spaceGatewayIsSelected:C,updateAutoBackup:K,abortBlockletBackup:Q,backupEndpoint:u,backupProgress:x,backups:te,backupSummary:ne,refreshBackupSummary:ae,refreshBackups:re,setBackupDate:a,backupsLoading:k,autoBackup:I},children:t})}ze.propTypes={children:m.any.isRequired};function O(){return h.useContext(Re)}function ve({...t}){const{blocklet:o}=U(),{info:n}=A(),{t:s}=D(),r=Ie({blocklet:o}),a=Xe(n),{spaceGateways:c,addSpaceGateway:i}=O(),d={checkFn:De.create({baseURL:fe(window.location.origin,Ze())}).get,webWalletUrl:a,extraParams:{appPid:o.appPid,appDid:r.appDid,appName:r.appName,appDescription:r.appDescription,appUrl:r.appUrl,referrer:r.referrer,scopes:r.scopes,nodeDid:n.did}},l=async({endpoint:f,name:x,did:u})=>{const k=await Bt(f);if(!await Dt(k)){B.error(s("storage.spaces.gateway.add.invalidUrl"));return}if(c.some(b=>b.endpoint===f)){B.error(s("storage.spaces.gateway.add.duplicate",{name:x}));return}await i({name:x,did:u,url:k,endpoint:f},f)},p=async({spaceGateway:f})=>{try{await l(f)}catch(x){console.error(x),B.error(V(x))}};return e.jsx(ft,{...t,connectScope:"app",options:d,onSuccess:p})}function Vt(){const{api:t}=A(),{blocklet:o}=U(),{data:n,loading:s}=Ce(()=>t.getBlocklet({input:{did:o?.meta?.did,attachDiskInfo:!0,attachRuntimeInfo:!0}}),{ready:!!o?.meta?.did,refreshDeps:[o?.meta?.did]});return{blocklet:n?.blocklet??null,loading:s}}function Pe({...t}){const{t:o}=h.useContext(Je),{blocklet:n,loading:s}=Vt();if(n?.diskInfo){const r=(i,d,l)=>e.jsxs(j,{children:[i," ",e.jsx("strong",{children:d?et(d):"empty"})]}),a=n.environments.reduce((i,d)=>(i[d.key]=d.value,i),{}),c=[{key:"appDir",name:o("blocklet.diskInfo.appDir"),value:r(a.BLOCKLET_APP_DIR,n.diskInfo.app)},{key:"dataDir",name:o("blocklet.diskInfo.dataDir"),value:r(a.BLOCKLET_DATA_DIR,n.diskInfo.data)},{key:"logDir",name:o("blocklet.diskInfo.logDir"),value:r(a.BLOCKLET_LOG_DIR,n.diskInfo.log)},{key:"cacheDir",name:o("blocklet.diskInfo.cacheDir"),value:r(a.BLOCKLET_CACHE_DIR,n.diskInfo.cache)}];return e.jsx(Qt,{component:"div",...t,children:c.map(i=>e.jsx(Rt,{valueComponent:"div",nameWidth:120,name:i.name,children:i.value},i.key))})}return s?e.jsx(L,{}):e.jsx(j,{children:o("blocklet.diskInfo.empty")})}const Qt=tt(j)``;function Ae(){const{t}=D(),{setBackupDate:o,backupSummary:n}=O(),s=xt({key:"lg"}),r=h.useRef(null),a=ot(),c=h.useCallback(l=>{o(l)},[o]),i=h.useMemo(()=>{const l=E().add(1,"day"),p=l.subtract(1,"year"),f=new Map(n.map(u=>[u.date,{date:u.date,successCount:u.successCount,errorCount:u.errorCount}])),x=[];for(let u=p.clone();E(u).isBefore(l);u=u.add(1,"day")){const k=u.format("YYYY-MM-DD");x.push(f.get(k)||{date:k,successCount:0,errorCount:0})}return x},[n]),d=h.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:12},tooltip:{formatter:k=>{const{date:w,successCount:y,errorCount:b}=i[k.dataIndex]||{date:k.data[0],successCount:0,errorCount:0};return[`<div>${t("common.time")}: ${w}</div>`,`<div>${t("common.succeeded")}: ${y}</div>`,`<div>${t("common.failed")}: ${b}</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:X[600]},{min:-9,max:-6,color:X[500]},{min:-6,max:-3,color:X[400]},{min:-3,max:-1,color:X[300]},{min:0,max:0,color:a.palette.grey[200]},{min:1,max:3,color:Z[300]},{min:3,max:6,color:Z[400]},{min:6,max:9,color:Z[500]},{min:9,max:Number.MAX_SAFE_INTEGER,color:Z[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:st[200],color:"inherit"}}}}),[i,t,a]);return e.jsxs(e.Fragment,{children:[e.jsx(S,{ref:r,sx:{maxWidth:"1280px",border:"1px solid",borderColor:"divider",padding:"8px",overflowX:"auto"},children:e.jsx(S,{sx:{width:"1200px",height:"180px",position:"relative"},children:e.jsx(zt,{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(S,{sx:{display:"flex",justifyContent:"flex-end",mt:1,mr:s?2:5,mb:2},children:e.jsxs(G,{direction:s?"column":"row",spacing:s?2:1,sx:{width:"100%",justifyContent:"flex-start",alignItems:s?"flex-start":"center"},children:[e.jsxs(G,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(S,{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(G,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(S,{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(G,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(S,{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 Xt=ee(({className:t,...o})=>e.jsx(Se,{...o,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function Le({status:t,message:o="",createdAt:n}){const{t:s}=D(),r=t===T.BACKUPS.STATUS.PROGRESS&&E().diff(n,"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(L,{sx:{marginRight:"4px"},size:"12px"}),s("common.progress")]}):i?e.jsx(H,{type:"success",children:s("common.succeeded")}):e.jsxs(S,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(H,{type:"error",children:s("common.failed")}),e.jsx(Se,{style:{display:"flex",alignItems:"center",flexShrink:0},title:o||a,children:e.jsx(ye,{children:e.jsx(vt,{style:{width:"24px",height:"24px"},color:"error"})})})]})}Le.propTypes={status:m.string.isRequired,message:m.string,createdAt:m.string.isRequired};function Ue({metadata:t={}}){const{t:o}=D();if(q(t))return e.jsx(H,{type:"success",children:o("common.succeeded")});const n=t.count||0,s=t.size||0,r=At(s,{iec:!0}),a=e.jsxs(S,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:[e.jsxs(j,{variant:"body2",children:[o("common.fileCount"),": ",n]}),e.jsxs(j,{variant:"body2",children:[o("common.fileSize"),": ",r]})]});return e.jsxs(S,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(H,{type:"success",children:o("common.succeeded")}),e.jsx(Xt,{title:a,style:{display:"flex",alignItems:"center",flexShrink:0},placement:"left",children:e.jsx(ye,{children:e.jsx(at,{style:{width:"24px",height:"24px"},color:"primary"})})})]})}Ue.propTypes={metadata:m.object};function Oe(){const{t,locale:o}=D(),{spaceGateways:n,backups:s,backupsLoading:r}=O(),a=h.useMemo(()=>[{label:"DID Space",name:"target",options:{customBodyRenderLite:i=>{const{targetUrl:d,targetName:l,status:p,createdAt:f}=s[i],x=p===T.BACKUPS.STATUS.PROGRESS&&E().diff(f,"hours")>=T.BACKUPS.TIMEOUT_HOURS,u=p===T.BACKUPS.STATUS.SUCCEEDED&&!x,k=l||n.find(w=>d?.includes(ge(w?.endpoint)))?.name||"Unknown DID Space";return u?e.jsx(nt,{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(H,{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=>q(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:p,createdAt:f,metadata:x}=d,u=l===T.BACKUPS.STATUS.PROGRESS&&E().diff(f,"hours")>=T.BACKUPS.TIMEOUT_HOURS,k=l===T.BACKUPS.STATUS.PROGRESS&&!u,w=l===T.BACKUPS.STATUS.SUCCEEDED&&!u;return k?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(L,{sx:{marginRight:"4px"},size:"12px"}),t("common.progress")]}):w?e.jsx(Ue,{metadata:x}):e.jsx(Le,{status:l,message:p,createdAt:f})}}}],[s,n,t]),c=h.useMemo(()=>!s?.length,[s]);return e.jsx(e.Fragment,{children:c?e.jsx(S,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100px",color:"#9397A1",marginTop:"16px",marginBottom:"24px"},children:t("storage.spaces.record.emptyData")}):e.jsx(Pt,{title:"",loading:r,data:s,columns:a,emptyNode:t("storage.spaces.record.emptyData",o),options:{download:!1,filter:!1,print:!1,search:!1,viewColumns:!1}})})}function Zt(){const{t}=D();return e.jsxs(S,{children:[e.jsxs(S,{sx:{display:"flex",gap:3,flexDirection:{xs:"column",md:"row"}},children:[e.jsxs(S,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",alignContent:"center",minWidth:240},children:[e.jsx(gt,{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(ve,{})]}),e.jsxs(S,{sx:{flexGrow:1,minWidth:0},children:[e.jsx(S,{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 Me({spaceGateway:t,onConfirm:o=()=>{},onCancel:n=()=>{}}){const{t:s}=D(),[r,a]=h.useState(!1),[c,i]=h.useState(!1),d=(f,x)=>{f?.preventDefault(),f?.stopPropagation(),a(x)},l=async f=>{try{f?.stopPropagation(),i(!0),await o?.(t),a(!1)}catch(x){console.error(x),B.error(`${s("storage.space.gateway.delete.failed")}: ${V(x)}`)}finally{a(!1),i(!1)}},p=f=>{d(f,!1),n?.(f)};return e.jsxs(e.Fragment,{children:[e.jsxs(F,{color:"red",onClick:f=>d(f,!0),children:[e.jsx($,{style:{minWidth:24,color:"red"},children:e.jsx(Ut,{fontSize:"small"})}),e.jsx(Y,{style:{color:"red"},children:s("common.disconnect")})]}),e.jsx(rt,{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:p,children:e.jsx(j,{sx:{wordWrap:"break-word"},children:s("storage.spaces.gateway.delete.descForBackup",{name:`${t?.name}`})})})]})}Me.propTypes={spaceGateway:m.shape({name:m.string.isRequired,url:m.string.isRequired,protected:m.bool}).isRequired,onConfirm:m.func,onCancel:m.func};function Ne({spaceGateway:t,selected:o,onDelete:n=()=>{},onConnect:s=()=>{},enableSwitchToSpace:r=!0,backupInProgress:a=!1,...c}){const{abortBlockletBackup:i}=O(),[d,l]=h.useState(null),{t:p}=D(),[f,x]=h.useState(!1),u=(y,b)=>{y.stopPropagation(),y.preventDefault(),l(b&&y.currentTarget)},k=async y=>{try{x(!0),u(y,!1),await s(t)}catch(b){console.error(b),B.error(b.message)}finally{x(!1)}},w=async y=>{try{x(!0),u(y,!1),await i()}catch(b){console.error(b),B.error(b.message)}finally{x(!1)}};return e.jsxs(e.Fragment,{children:[f||t?.loading?e.jsx(L,{sx:{ml:1},size:"24px"}):e.jsx(it,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions",variant:"outlined",size:"small",onClick:y=>u(y,!0),...c,children:e.jsx(ct,{})}),e.jsxs(lt,{id:"simple-menu",anchorEl:d,keepMounted:!0,open:!!d,onClose:y=>u(y,!1),children:[e.jsxs(F,{onClick:y=>{u(y,!1),window.open(ke(t.endpoint?Et(t.endpoint):t.url,{allowDomains:null}))},children:[e.jsx($,{style:{minWidth:24},children:e.jsx(Wt,{fontSize:"small"})}),e.jsx(Y,{children:p("common.open")})]}),e.jsxs(F,{onClick:y=>{u(y,!1),window.open(ke(It(t.endpoint),{allowDomains:null}))},children:[e.jsx($,{style:{minWidth:24},children:e.jsx(Kt,{fontSize:"small"})}),e.jsx(Y,{children:p("storage.spaces.strategy.viewBackupFiles")})]}),!o&&r&&e.jsxs(F,{onClick:k,children:[e.jsx($,{style:{minWidth:24},children:e.jsx(Gt,{fontSize:"small"})}),e.jsx(Y,{children:p("storage.spaces.connect.switchToSpace")})]}),a&&e.jsxs(F,{onClick:w,children:[e.jsx($,{style:{minWidth:24},children:e.jsx(Lt,{fontSize:"small"})}),e.jsx(Y,{children:p("storage.spaces.connect.abortBlockletBackup")})]}),!a&&e.jsx(Me,{spaceGateway:t,onConfirm:async()=>{l(null),await n?.(t)},onCancel:()=>l(null)})]})]})}Ne.propTypes={spaceGateway:m.shape({name:m.string.isRequired,url:m.string.isRequired,protected:m.bool,endpoint:m.string.isRequired,loading:m.bool}).isRequired,selected:m.bool.isRequired,enableSwitchToSpace:m.bool,onDelete:m.func,onConnect:m.func,backupInProgress:m.bool};const Jt=ee(({className:t,...o})=>e.jsx(Se,{...o,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function _e({spaceGateway:t,spaceStatus:o,selected:n,onConnected:s=()=>{},onDeleted:r=()=>{},onBackedUp:a=()=>{}}){const{t:c,locale:i}=D(),{blocklet:d}=U(),{api:l,info:{did:p}}=A(),{appDid:f,appName:x,appDescription:u,scopes:k,appUrl:w,referrer:y}=Ie({blocklet:d}),{backupProgress:b,updateSpaceGateway:te,deleteSpaceGateway:oe,refreshBackupSummary:se,refreshBackups:ne}=O(),[_,M]=h.useState(!1),[I,z]=h.useState({open:!1,action:"one-click-authorization",checkTimeout:1e3*300,messages:{title:c("storage.spaces.authorize.title",{appName:x},i),scan:c("storage.spaces.authorize.scan",{appName:x},i),confirm:"",success:e.jsx(j,{gutterBottom:!0,children:c("storage.spaces.authorize.success")})},onClose:()=>{z(C=>({...C,open:!1}))}}),ae=n&&!_&&o===ue.DISCONNECTED,re=n&&!_&&!t.loading&&o===ue.CONNECTED,K=n&&_&&o===ue.CONNECTED&&b?.progress>=0,Q=async()=>{try{if(await Tt(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}z(C=>({...C,open:!0,prefix:fe(t.url,"space/api/did"),baseUrl:new URL(t.url).origin,checkFn:De.create({baseURL:fe(t.url,"space")}).get,extraParams:{appDid:f,appName:x,appDescription:u,scopes:k,appUrl:w,referrer:y,nodeDid:p,spaceDid:t.did}}))},ie=async(C,g)=>{const P=g(C.endpoint),R=ge(P),v=C.space?g(C.space):{};if(t.did&&R!==t.did){z(We=>({...We,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 de={...t,name:v.name??"DID Space",did:v.did??ge(P),endpoint:P};await te(de),z(W=>({...W,open:!1})),s?.(null,de)},ce=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)}},le=async()=>{try{await oe(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 h.useEffect(()=>{b?.completed?(n&&(b?.progress===100?(B.success(c("storage.spaces.backupSuccessfully")),a?.(null,t)):b.message&&a?.(new Error(b?.message),t),b.progress=0,b.message=""),M(!1),se(),ne()):b.progress&&M(!0)},[b]),e.jsxs(e.Fragment,{children:[e.jsxs(S,{sx:{display:"flex",alignItems:"center",".action-btn":{borderRadius:1,marginLeft:1}},children:[re&&e.jsx(pe,{className:"action-btn",variant:"outlined",size:"small",onClick:ce,children:c("storage.spaces.strategy.backupNow")}),ae&&e.jsx(pe,{className:"action-btn",variant:"outlined",size:"small",onClick:Q,children:c("storage.spaces.disconnected.reconnectNow")}),K&&e.jsx(Jt,{title:b?.message&&e.jsx(S,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:e.jsx(j,{variant:"body2",children:b.message})}),children:e.jsxs(pe,{className:"action-btn",variant:"outlined",size:"small",sx:{minWidth:70},children:[e.jsx(L,{variant:"determinate",value:b?.progress,size:14,sx:{mr:1}}),b?.progress,"%"]})}),e.jsx(dt,{forceConnected:!1,saveConnect:!1,prefix:I.prefix,open:I.open,popup:!0,action:I.action,baseUrl:I.baseUrl,checkFn:I.checkFn,onSuccess:ie,onClose:I.onClose,checkTimeout:I.checkTimeout,extraParams:I.extraParams,messages:I.messages,locale:i},"get-endpoint")]}),e.jsx(Ne,{sx:{minWidth:32,padding:"2px 4px",ml:1},spaceGateway:t,selected:n,onDelete:le,onConnect:Q,enableSwitchToSpace:b?.completed||q(b?.message),backupInProgress:K})]})}_e.propTypes={spaceGateway:m.shape({did:m.string.isRequired,name:m.string.isRequired,url:m.string.isRequired,endpoint:m.string.isRequired,protected:m.bool,loading:m.bool}).isRequired,spaceStatus:m.string.isRequired,selected:m.bool.isRequired,onConnected:m.func,onDeleted:m.func,onBackedUp:m.func};function eo({...t}){const{t:o}=D();return e.jsxs(S,{...t,children:[e.jsx(S,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:o("storage.spaces.backup.records")})}),e.jsx(Ae,{}),e.jsx(Oe,{})]})}function to({...t}){const{t:o}=D(),{autoBackup:n,updateAutoBackup:s}=O(),r=async()=>{try{const a=!n?.enabled;await s({enabled:a}),B.success(o(a?"storage.spaces.autoBackup.enabled":"storage.spaces.autoBackup.disabled"))}catch(a){B.error(a.message)}};return e.jsx(Ot,{checked:!!n?.enabled,onChange:r,name:"enableWelcomePage",labelProps:{label:e.jsx(j,{sx:{marginRight:"8px"},children:e.jsx("span",{children:o("storage.spaces.autoBackup.title")})})},style:{...t.style}})}function oo(){const{t}=D(),{spaceGateways:o,spaceGatewaysLoading:n,spaceGatewayIsSelected:s}=O(),r=n&&!o?.length,a=({spaceGateway:c,spaceStatus:i,selected:d,refresh:l})=>e.jsx(_e,{spaceGateway:c,spaceStatus:i,selected:d,onConnected:()=>l(),onBackedUp:p=>p&&l()});return e.jsxs(S,{sx:{display:"flex",flexDirection:"column"},children:[e.jsxs(S,{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(to,{}),e.jsx(ve,{})]}),e.jsx(S,{sx:{mt:2},children:r?e.jsx(S,{sx:{display:"flex",justifyContent:"center"},children:e.jsx(L,{})}):e.jsx(be,{container:!0,spacing:2,children:e.jsx(e.Fragment,{children:o.map(c=>e.jsx(be,{size:{xs:12,md:6},children:e.jsx(ht,{endpoint:c.endpoint,selected:s(c),action:a},c.endpoint)},c.endpoint))})})}),e.jsx(eo,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2},children:t("common.dataStorage")}),e.jsx(Pe,{})]})}function so(){const{spaceGatewaysFirstLoading:t,spaceGateways:o}=O();return t?e.jsx(Ee,{relative:"parent",children:e.jsx(L,{})}):q(o)?e.jsx(Zt,{}):e.jsx(oo,{})}function no(){return e.jsx(ze,{children:e.jsx(so,{})})}function ao(){const{spaceGateway:t,settingStorageEndpoint:o,updateSpaceGateway:n,hasStorageEndpoint:s,loading:r,storageEndpoint:a}=yt(),c=xe(()=>({display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"16px"}));return r?e.jsx(Ee,{relative:"parent",children:e.jsx(L,{})}):e.jsxs(S,{sx:{maxWidth:"md",position:"relative"},children:[s?e.jsx(bt,{spaceGateway:t,settingStorageEndpoint:o}):e.jsx(kt,{}),e.jsx(S,{sx:c,children:e.jsx(jt,{onConnect:n,storageEndpoint:a})})]})}function ro(){const{t}=D();return e.jsxs(St,{children:[e.jsxs(G,{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(ao,{})]})}function io({navOrientation:t="vertical",...o}){const{t:n,locale:s}=D(),{blocklet:r}=U(),a=mt({key:"md"}),[c,i]=pt(),d=c.get("tab")||"backup",l=a?"horizontal":t,p=xe(()=>{const w=[{label:n("common.backup"),value:"backup"}],y=r?.capabilities?.didSpace;return(y===N.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED||y===N.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP)&&w.push({label:n("common.storage"),value:"storage"}),w},[s,l]),x=xe(()=>({backup:e.jsx(no,{}),storage:e.jsx(ro,{})}))[d],u=w=>{i(y=>(w==="backup"?y.delete("tab"):y.set("tab",w),y))};if(p.length<=1)return e.jsx(me,{children:x});const k=e.jsx(ut,{tabs:p,current:d,orientation:l,onChange:u,sx:[{borderRight:1,height:"100%",borderColor:"divider"},l==="horizontal"&&{borderRight:0}]});if(l==="vertical")return e.jsx(S,{...o,children:e.jsxs(G,{direction:{md:"column",lg:"row"},sx:{gap:2},children:[e.jsx(S,{sx:{flexShrink:0},children:e.jsx(je,{left:k})}),e.jsx(S,{sx:{flexGrow:1,minWidth:0},children:e.jsx(me,{sx:{mt:1},children:x})})]})});if(l==="horizontal")return e.jsxs(S,{...o,children:[e.jsx(je,{left:k}),e.jsx(me,{sx:{mt:2},children:x})]})}io.propTypes={navOrientation:m.oneOf(["vertical","horizontal"])};const me=ee(S)`
|
|
3
3
|
position: relative;
|
|
4
4
|
min-height: 66vh;
|
|
5
5
|
overflow: hidden;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,p as n,j as t,s as r}from"./index-
|
|
1
|
+
import{r as o,p as n,j as t,s as r}from"./index-oppNoNvH.js";import{p as a}from"./index-Ctq71AUP.js";function c(){const{t:s}=o.useContext(n);return t.jsx(e,{style:{paddingTop:"25vh"},children:t.jsx(a,{status:"404",description:s("noMatch.desc"),style:{backgroundColor:"transparent"}})})}const e=r.main``;export{c as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c1 as a,r as f,cr as V,ba as W,bb as X,cS as v,fp as u,cs as m,fq as Z,fr as $,fs as I}from"./index-
|
|
1
|
+
import{c1 as a,r as f,cr as V,ba as W,bb as X,cS as v,fp as u,cs as m,fq as Z,fr as $,fs as I}from"./index-oppNoNvH.js";var ee=function(t){return t===document||t===document.documentElement||t===document.body?Math.max(window.pageYOffset,document.documentElement.scrollTop,document.body.scrollTop):t.scrollTop},O=function(t){return t.scrollHeight||Math.max(document.documentElement.scrollHeight,document.body.scrollHeight)},re=function(t){return t.clientHeight||Math.max(document.documentElement.clientHeight,document.body.clientHeight)},oe=function(t,o){o===void 0&&(o={});var g=o.target,x=o.isNoMore,F=o.threshold,w=F===void 0?100:F,B=o.direction,P=B===void 0?"bottom":B,R=o.reloadDeps,Y=R===void 0?[]:R,k=o.manual,h=o.onBefore,_=o.onSuccess,M=o.onError,y=o.onFinally,q=a(f.useState(),2),c=q[0],E=q[1],D=a(f.useState(!1),2),b=D[0],i=D[1],S=P==="top",T=f.useRef(void 0),L=f.useRef(0),H=f.useMemo(function(){return x?x(c):!1},[c]),s=V(function(r){return W(void 0,void 0,void 0,function(){var e,n,l,d;return X(this,function(C){switch(C.label){case 0:return[4,t(r)];case 1:return e=C.sent(),E(r?v(v({},e),{list:S?u(u([],a(e.list),!1),a((l=r.list)!==null&&l!==void 0?l:[]),!1):u(u([],a((d=r.list)!==null&&d!==void 0?d:[]),!1),a(e.list),!1)}):v(v({},e),{list:u([],a((n=e.list)!==null&&n!==void 0?n:[]),!1)})),[2,e]}})})},{manual:k,onFinally:function(r,e,n){i(!1),y?.(e,n)},onBefore:function(){return h?.()},onSuccess:function(r){setTimeout(function(){if(S){var e=I(g);if(e=e===document?document.documentElement:e,e){var n=O(e);e.scrollTo(0,n-L.current)}}else z()}),_?.(r)},onError:function(r){return M?.(r)}}),N=s.loading,G=s.error,A=s.run,j=s.runAsync,J=s.cancel,p=m(function(){H||(i(!0),A(c))}),K=m(function(){return H?Promise.reject():(i(!0),j(c))}),Q=function(){return i(!1),A()},U=function(){return i(!1),j()},z=function(){var r=I(g);if(r){var e=r===document?document.documentElement:r,n=ee(e),l=O(e),d=re(e);S?(T.current!==void 0&&T.current>n&&n<=w&&p(),T.current=n,L.current=l-n):l-n<=d+w&&p()}};return Z("scroll",function(){N||b||z()},{target:g}),$(function(){A()},u([],a(Y),!1)),{data:c,loading:!b&&N,error:G,loadingMore:b,noMore:H,loadMore:p,loadMoreAsync:K,reload:m(Q),reloadAsync:m(U),mutate:E,cancel:J}};export{oe as u};
|