@abtnode/blocklet-services 1.16.45-beta-20250609-111118-0d252ebe → 1.16.45-beta-20250612-231219-481217be
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/cache.js +36 -21
- package/api/libs/connect/session.js +2 -2
- package/api/middlewares/proxy-to-daemon.js +6 -2
- package/api/routes/blocklet.js +25 -5
- package/api/routes/dns-resolver.js +1 -1
- package/api/routes/env.js +2 -1
- package/api/services/auth/connect/invite.js +1 -1
- package/api/services/auth/connect/issue-passport.js +1 -1
- package/api/services/auth/connect/verify-destroy.js +3 -6
- package/api/services/auth/connect/verify-elevated.js +8 -9
- package/api/services/auth/session.js +1 -1
- package/api/services/oauth/server.js +2 -1
- package/api/socket/channel/did.js +2 -2
- package/dist/assets/{AdapterDayjs-BXVfASrK.js → AdapterDayjs-BzjU9O7t.js} +1 -1
- package/dist/assets/{ArrowDropDown-Ce8TY3aP.js → ArrowDropDown-CrJjI_sT.js} +1 -1
- package/dist/assets/{CheckCircle-M9NlpTm_.js → CheckCircle-BcPSvH2E.js} +1 -1
- package/dist/assets/{ChevronLeft-02OWcWpH.js → ChevronLeft-Ch9iK6fF.js} +1 -1
- package/dist/assets/{ChevronRight-CB8w0u2n.js → ChevronRight-DclARA5k.js} +1 -1
- package/dist/assets/{Community-vE_QnoqV.js → Community-D4mv0jfL.js} +1 -1
- package/dist/assets/{DeleteOutline-1-hBNY1U.js → DeleteOutline-CnS2XiM1.js} +1 -1
- package/dist/assets/{Done-CcJLRcBY.js → Done-C9LPqADS.js} +1 -1
- package/dist/assets/{Download-HHknpEZd.js → Download-D9LfWoxF.js} +1 -1
- package/dist/assets/{Edit-hd-cDU5C.js → Edit-rPlryssW.js} +1 -1
- package/dist/assets/{EditIcon-DiM9RB8U.js → EditIcon-DfiDnAsm.js} +1 -1
- package/dist/assets/{Error-D0rGqAKE.js → Error-q_AhSCeT.js} +1 -1
- package/dist/assets/{ExpandLess-Fb-uW6u_.js → ExpandLess-Da2Rv9Ox.js} +1 -1
- package/dist/assets/{Google-WGwK551e.js → Google-Buu8u6PW.js} +1 -1
- package/dist/assets/{Holiday-BnL2IwX3.js → Holiday-DkzYmdt-.js} +1 -1
- package/dist/assets/{Home-DeTVRhMG.js → Home-DkCBzKe9.js} +1 -1
- package/dist/assets/{InfoOutlined-CLiL5VeK.js → InfoOutlined-C8ZBPUhD.js} +1 -1
- package/dist/assets/{Launch-BwVeOcBz.js → Launch-Nu8TBDKk.js} +1 -1
- package/dist/assets/{LaunchOutlined-CPurmWuM.js → LaunchOutlined-DQZ7S23O.js} +1 -1
- package/dist/assets/{LockIcon-QnxDGvZv.js → LockIcon-BEG59s5q.js} +1 -1
- package/dist/assets/{Meeting-BkjjPbp7.js → Meeting-KSUAdbzW.js} +1 -1
- package/dist/assets/{MoreHoriz-9E3q8aHi.js → MoreHoriz-Ba9rYlyz.js} +1 -1
- package/dist/assets/{OffSick-D2B01pyN.js → OffSick-B0VcZ-o0.js} +1 -1
- package/dist/assets/{PlayArrow-B_ZNrQDa.js → PlayArrow-RVSfCmrB.js} +1 -1
- package/dist/assets/{QuestionMarkCircle-BMcwgPWr.js → QuestionMarkCircle-jbhclAfX.js} +1 -1
- package/dist/assets/{TuneOutlined-0oMZE8a4.js → TuneOutlined-CwV20zYf.js} +1 -1
- package/dist/assets/{ViewList-ColSGL1_.js → ViewList-D1BI4ac9.js} +1 -1
- package/dist/assets/{WorkingRemotely-CxoGYC4d.js → WorkingRemotely-5Kw3C-_c.js} +1 -1
- package/dist/assets/{access-control-nyeEpwlF.js → access-control-C-kFaf9T.js} +1 -1
- package/dist/assets/{actions-DtL6bYnA.js → actions-DYQW2ChM.js} +1 -1
- package/dist/assets/{add-component-core-CaE3xcyT.js → add-component-core-UeQfX1b1.js} +37 -37
- package/dist/assets/add-resource-BdL-oJxe.js +1 -0
- package/dist/assets/{addon-e-JO0VU3.js → addon-DMedfvRj.js} +1 -1
- package/dist/assets/{advanced-yrYBgA5T.js → advanced-BZZToP_j.js} +2 -2
- package/dist/assets/api-87p2GGd0.js +1 -0
- package/dist/assets/{appearance-DB1QowgL.js → appearance-CYop22yw.js} +1 -1
- package/dist/assets/ar-D9QEDjY-.js +7 -0
- package/dist/assets/{audit-logs-BamIXrWh.js → audit-logs-BtBk6uAY.js} +3 -3
- package/dist/assets/{authorize-B9LP0G9q.js → authorize-CQZkUNyV.js} +1 -1
- package/dist/assets/{base-chart-BYonGucU.js → base-chart-C2FJuVG1.js} +1 -1
- package/dist/assets/{base32-CmYq1ikq.js → base32-DEjena1X.js} +1 -1
- package/dist/assets/{branding-OlEgtAUT.js → branding-7ppDxFZf.js} +2 -2
- package/dist/assets/branding-gXMozCeI.js +54 -0
- package/dist/assets/{bundle-avatar-C41ZXEbR.js → bundle-avatar-B5-ypzmO.js} +1 -1
- package/dist/assets/button-YPMo8IwK.js +1 -0
- package/dist/assets/{click-to-copy-BUVqg1RQ.js → click-to-copy-BMX2P5UB.js} +1 -1
- package/dist/assets/{cloneDeep-ro06l5HL.js → cloneDeep-Jl_OPbSo.js} +1 -1
- package/dist/assets/{collapse--nd2JDBL.js → collapse-9taxUXec.js} +1 -1
- package/dist/assets/{complete-gnnvUqGU.js → complete-C8T0HN-B.js} +1 -1
- package/dist/assets/{component-ClWADDCr.js → component-D6hOmRzO.js} +1 -1
- package/dist/assets/{config-2Sy6fCTJ.js → config-DcwlSddI.js} +1 -1
- package/dist/assets/{config-QpBBpp7d.js → config-Sq1CUTiJ.js} +1 -1
- package/dist/assets/{config-navigation-CsVa3Hf0.js → config-navigation-IR_yUgmM.js} +6 -6
- package/dist/assets/{config-space-B39Ur9Mf.js → config-space-C3fS58cn.js} +1 -1
- package/dist/assets/{confirm-Bay3BcpN.js → confirm-DApmnpvm.js} +1 -1
- package/dist/assets/{connect-T4cAO9om.js → connect-BF4GoRL-.js} +1 -1
- package/dist/assets/connect-Bf8y7fMm.js +5 -0
- package/dist/assets/{connect-to-Dac7orQh.js → connect-to-Bwfa2hMr.js} +1 -1
- package/dist/assets/{content-layout-DuPlKBe3.js → content-layout-BC2QkTYi.js} +1 -1
- package/dist/assets/dashboard-B2X6c8E8.js +239 -0
- package/dist/assets/{de-Dv_ApqsF.js → de-BOa43YBF.js} +2 -2
- package/dist/assets/{delete-confirm-B1F5wKdb.js → delete-confirm-BsEqJQRY.js} +1 -1
- package/dist/assets/{did-address-bJAfhuZx.js → did-address-L54dTMrT.js} +1 -1
- package/dist/assets/domain-BGh0GDuZ.js +9 -0
- package/dist/assets/{domain-action-card-yyZstsWL.js → domain-action-card-DWqnvzry.js} +2 -2
- package/dist/assets/domains-CdwErmIF.js +1 -0
- package/dist/assets/dot-iw3hN9HL.js +7 -0
- package/dist/assets/{email-CYOorZ7K.js → email-By_nAv9m.js} +1 -1
- package/dist/assets/{empty-spinner-DSwpCqdd.js → empty-spinner-BHwHZpq-.js} +1 -1
- package/dist/assets/es-A3ma-OJp.js +9 -0
- package/dist/assets/{exchange-passport-xHfEBrd8.js → exchange-passport-BsgMfRJS.js} +1 -1
- package/dist/assets/fr-I3xKp6I5.js +7 -0
- package/dist/assets/{fuel-CtSAk9S3.js → fuel-RMmgm9AQ.js} +1 -1
- package/dist/assets/{gen-access-key-CoOxXtqa.js → gen-access-key-4teK8Dys.js} +1 -1
- package/dist/assets/{get-safe-url-BWDUV79Q.js → get-safe-url-B8xlSMyD.js} +1 -1
- package/dist/assets/{get-safe-url-CwT4-jkw.js → get-safe-url-t1C0E5Ux.js} +1 -1
- package/dist/assets/{hi-Dqbq8i5Y.js → hi-DacRhM8A.js} +1 -1
- package/dist/assets/{home-D1kBU1RC.js → home-CmHUXg5q.js} +1 -1
- package/dist/assets/{id-Bxr8o3Uo.js → id-B7LQAHL7.js} +3 -3
- package/dist/assets/{iframe-DsIqy16E.js → iframe-Dj9NLHp2.js} +1 -1
- package/dist/assets/{index-BoQJXOtZ.js → index-B2NkqENf.js} +1 -1
- package/dist/assets/{index-BpvW-cUy.js → index-BCtTVvHw.js} +1 -1
- package/dist/assets/{index-Cx-ESLe9.js → index-Bb7iSrGO.js} +4 -4
- package/dist/assets/{index-CTfYMqG2.js → index-Be8E3hiQ.js} +5 -5
- package/dist/assets/{index-DQl2QJod.js → index-BeE0KRva.js} +2 -2
- package/dist/assets/{index-DWgnwzKO.js → index-Bv7OAPJU.js} +1 -1
- package/dist/assets/{index-BnR8uU0R.js → index-BzZuK-66.js} +1 -1
- package/dist/assets/{index-CyS4mBmV.js → index-C8uNNoMb.js} +6 -6
- package/dist/assets/{index-CI4cLtBE.js → index-CCOwwQoc.js} +1 -1
- package/dist/assets/{index-DMSe2Qjx.js → index-CJQbYw9E.js} +2 -2
- package/dist/assets/{index-Dntq1ezd.js → index-CKY4HT0P.js} +1 -1
- package/dist/assets/{index-B18R5SlV.js → index-CMYalRl2.js} +7 -7
- package/dist/assets/{index-BXjOxZPH.js → index-CTlzm-Mc.js} +1 -1
- package/dist/assets/{index-8kcb4Nom.js → index-Cs3-IS09.js} +1 -1
- package/dist/assets/{index-DU8cx_m6.js → index-DEZojGsm.js} +1 -1
- package/dist/assets/{index-B7qZ5OdP.js → index-DXeoVV9Y.js} +11 -11
- package/dist/assets/{index-B1fP-8KR.js → index-DaM-GRtb.js} +2 -2
- package/dist/assets/{index-DaMn1fo9.js → index-Dfw2EDXA.js} +10 -10
- package/dist/assets/{index-DO-a7P7z.js → index-Dgsq6V-N.js} +1 -1
- package/dist/assets/{index-B4wY8GsU.js → index-DtZg53T9.js} +3 -3
- package/dist/assets/{index-j6UAnd8n.js → index-F85lIJcp.js} +1 -1
- package/dist/assets/{index-CY9xLy04.js → index-Inc_KF9k.js} +3 -3
- package/dist/assets/{index-CZgWTJXl.js → index-Mzv6hCex.js} +1 -1
- package/dist/assets/{index-Brd3-BIC.js → index-NnUiYa0L.js} +1 -1
- package/dist/assets/{index-C5vFhD_w.js → index-SX_KWrQh.js} +1 -1
- package/dist/assets/{invitation-BsuZg3B2.js → invitation-Ck_kq3Tr.js} +3 -3
- package/dist/assets/{invite-YNiMO-nB.js → invite-89aeW4Ho.js} +1 -1
- package/dist/assets/{issue-passport-2R7-XHuR.js → issue-passport-4udVYVdq.js} +1 -1
- package/dist/assets/{item-DHMVgmIa.js → item-D0U5vYXJ.js} +1 -1
- package/dist/assets/{ja-CJfcqkdo.js → ja-DRQ4Eecl.js} +3 -1
- package/dist/assets/{ko-BxAazRix.js → ko-CzL3UzwL.js} +3 -1
- package/dist/assets/{launch-result-message-DNgJY11G.js → launch-result-message-AharZGq2.js} +1 -1
- package/dist/assets/{layout-BnunMkuP.js → layout-CQb1lhEv.js} +1 -1
- package/dist/assets/{list-h4Ed_myi.js → list-BOdwWlS0.js} +2 -2
- package/dist/assets/{list-DZwgo-zf.js → list-KVxvPXZu.js} +6 -6
- package/dist/assets/{list-header-D976e09p.js → list-header-C7gle0n0.js} +1 -1
- package/dist/assets/localization-OxVxEhoS.js +1 -0
- package/dist/assets/{log-6M_J_pon.js → log-DOIh9luu.js} +1 -1
- package/dist/assets/{logger-KwxABgLK.js → logger-Dhaq1LDX.js} +1 -1
- package/dist/assets/{login-C2ILZhOf.js → login-J6Bsrh3B.js} +1 -1
- package/dist/assets/{login-oauth-callback-Dt9V4GRH.js → login-oauth-callback-BRmEibAb.js} +1 -1
- package/dist/assets/{logo-uploader-Dhh7Un4G.js → logo-uploader-Dzebv-rF.js} +3 -3
- package/dist/assets/{lost-passport-JODD9Yck.js → lost-passport-p5ZuXjnG.js} +2 -2
- package/dist/assets/{omit-O1pUD7ku.js → omit-BlzmxIB5.js} +1 -1
- package/dist/assets/{open-window-Dn44K3ur.js → open-window-Byi7CkW_.js} +1 -1
- package/dist/assets/{overview-Bjj9JLCV.js → overview-ClOSCvvh.js} +1 -1
- package/dist/assets/{page-header-JH9JWGMg.js → page-header-C_KAJILy.js} +1 -1
- package/dist/assets/{passport-item-CoNRdRpk.js → passport-item-Du8-xENr.js} +1 -1
- package/dist/assets/{permission-B7ZHEOJv.js → permission-ClRym5FB.js} +1 -1
- package/dist/assets/preferences-B6Y0XpLo.js +1 -0
- package/dist/assets/profile-embed-C_hd_hMh.js +1 -0
- package/dist/assets/{pt-FpFCyI6v.js → pt-CHKumXYv.js} +3 -3
- package/dist/assets/publish-resource-kHaYkbDE.js +1 -0
- package/dist/assets/{react-beautiful-dnd.esm-DCPrD7-r.js → react-beautiful-dnd.esm-CHsohizU.js} +1 -1
- package/dist/assets/{ru-BuGIFp9h.js → ru-CvkEKhgU.js} +1 -1
- package/dist/assets/{runtime-1mGYl_p2.js → runtime-D5P_2uNM.js} +1 -1
- package/dist/assets/{sanitize-DbZs1H_T.js → sanitize-B18rcrOf.js} +1 -1
- package/dist/assets/sdk-CbugbTkF.js +1 -0
- package/dist/assets/search-4YYphs0l.js +1 -0
- package/dist/assets/section-BDMQAX_r.js +41 -0
- package/dist/assets/{security-C2l4SCkx.js → security-CXewZHyS.js} +1 -1
- package/dist/assets/{session-1k8BRnYA.js → session-Bkvl2PSP.js} +1 -1
- package/dist/assets/setup-TPtYDnBB.js +30 -0
- package/dist/assets/{shorten-label-CTSJhlwO.js → shorten-label-BQvbtscf.js} +1 -1
- package/dist/assets/{simple-select-cKQxVH3U.js → simple-select-0cjVFuay.js} +1 -1
- package/dist/assets/{slicedToArray-CRrLoxQ4.js → slicedToArray-DFQjSbCD.js} +1 -1
- package/dist/assets/{spaces-CpSu6mVL.js → spaces-C1lh7et6.js} +1 -1
- package/dist/assets/{start-BotjXVuZ.js → start-BgSlMXsE.js} +1 -1
- package/dist/assets/{starting-progress-a7uoLG-L.js → starting-progress-BikYigPA.js} +1 -1
- package/dist/assets/{status-DIJ9lK3F.js → status-DDvFiBxA.js} +1 -1
- package/dist/assets/{step-actions-DLZOEVat.js → step-actions-_23FIn8v.js} +1 -1
- package/dist/assets/{studio-Cua13-ul.js → studio-Db5oA_Tx.js} +1 -1
- package/dist/assets/{switch-control-CzaI2YNK.js → switch-control-BYqb8MZf.js} +1 -1
- package/dist/assets/{table-tips-Czrj7r52.js → table-tips-BW6G2sKO.js} +1 -1
- package/dist/assets/{th-BafLD2wR.js → th-B2BUfjNJ.js} +1 -1
- package/dist/assets/{traffic-fPCLOWN3.js → traffic-CUSLm0PX.js} +1 -1
- package/dist/assets/{transfer-BqCYXmCB.js → transfer-CSsXAviu.js} +1 -1
- package/dist/assets/{unsubscribe-BE77Etc2.js → unsubscribe-BA46-fTa.js} +1 -1
- package/dist/assets/{use-blocklet-logo-DGSQQmh2.js → use-blocklet-logo-CTCMbFiC.js} +1 -1
- package/dist/assets/{use-mobile-CXU9YBvX.js → use-mobile-CtTQsfXN.js} +1 -1
- package/dist/assets/{use-mobile-CiFFAdJf.js → use-mobile-DwzRjjku.js} +1 -1
- package/dist/assets/{use-server-logo-BbYHFDuK.js → use-server-logo-UTr-CyJD.js} +1 -1
- package/dist/assets/useAsync-DVHp96Uu.js +1 -0
- package/dist/assets/{useLocalStorage-BF3BqN1O.js → useLocalStorage-DyVGBDlt.js} +1 -1
- package/dist/assets/user-center-Cap4mg5H.js +77 -0
- package/dist/assets/{util-xXGeezrD.js → util-DlS4tWs9.js} +1 -1
- package/dist/assets/{util-CS4PqVkK.js → util-M3UFXQFT.js} +1 -1
- package/dist/assets/{vendor-arcblock-B4hgrXYM.js → vendor-arcblock-DiSm3oUX.js} +7 -7
- package/dist/assets/{vendor-hooks-BCm626KH.js → vendor-hooks-BFlOfe0M.js} +1 -1
- package/dist/assets/{vendor-mui-core-wlbruq2I.js → vendor-mui-core-Bq8gXTan.js} +1 -1
- package/dist/assets/{vendor-mui-x-BKgL6hAa.js → vendor-mui-x-1nqAyytV.js} +1 -1
- package/dist/assets/vendor-utils-BotmZdBm.js +208 -0
- package/dist/assets/{vendor-ux-did-connect-CX7qG3_M.js → vendor-ux-did-connect-DVX9lQ8a.js} +66 -66
- package/dist/assets/{vi-BMZxxaJ2.js → vi-BykmwIAT.js} +3 -3
- package/dist/assets/wrap-locale-B8EvOR-l.js +1 -0
- package/dist/assets/{zh-DusA4qAT.js → zh-CbCaOuAd.js} +3 -1
- package/dist/assets/{zh-tw-BO-QhSNP.js → zh-tw-C9JfiCVV.js} +3 -1
- package/dist/index.html +6 -6
- package/dist/service-worker.js +1 -1
- package/package.json +33 -33
- package/dist/assets/add-resource-CG8u25Lv.js +0 -1
- package/dist/assets/api-CQoRx33p.js +0 -1
- package/dist/assets/ar-0ZkmCCuq.js +0 -7
- package/dist/assets/branding-C2Dm2Z1c.js +0 -54
- package/dist/assets/button-C0Vra3Ak.js +0 -1
- package/dist/assets/connect-B77rXeVL.js +0 -5
- package/dist/assets/dashboard-k0XcV2m5.js +0 -239
- package/dist/assets/domain-CEwb0Lyz.js +0 -9
- package/dist/assets/domains-CRt4uYYF.js +0 -1
- package/dist/assets/dot-DR7_m3Np.js +0 -7
- package/dist/assets/es-D_uF0siv.js +0 -7
- package/dist/assets/fr-DVFSQfDp.js +0 -7
- package/dist/assets/localization-BNjdHo-G.js +0 -1
- package/dist/assets/preferences-DUSp_pAb.js +0 -1
- package/dist/assets/profile-embed-BIjwkrGW.js +0 -1
- package/dist/assets/publish-resource-AW43Z8jj.js +0 -1
- package/dist/assets/sdk-BJQcHaGO.js +0 -1
- package/dist/assets/section-Bb547IGJ.js +0 -41
- package/dist/assets/setup-DxzbFXmd.js +0 -30
- package/dist/assets/useAsync-BMCqtJH2.js +0 -1
- package/dist/assets/useAsync-CBEJDwr0.js +0 -1
- package/dist/assets/user-center-olJmefSX.js +0 -77
- package/dist/assets/vendor-utils-B3iZkn2R.js +0 -208
- package/dist/assets/wrap-locale-Byq7otyk.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as
|
|
1
|
+
import{r as m}from"./vendor-react-DEoibe3W.js";import{a as w,k as C,a2 as T,ax as P,bZ as R}from"./vendor-ux-did-connect-DVX9lQ8a.js";import{l as v}from"./vendor-hooks-BFlOfe0M.js";import{j as e,aa as s,ab as y,ak as j,al as L,bo as M,br as W,bn as B,q as _,ap as A,I as D,y as z,H as F}from"./vendor-mui-core-Bq8gXTan.js";import{d as q}from"./Launch-Nu8TBDKk.js";import{a as K}from"./api-87p2GGd0.js";import{T as N}from"./table-tips-BW6G2sKO.js";import{D as k}from"./index-CMYalRl2.js";import{u as U}from"./dashboard-B2X6c8E8.js";import"./vendor-utils-BotmZdBm.js";import"./lottie-web-jYmAQWuC.js";import"./InfoOutlined-C8ZBPUhD.js";import"./use-mobile-DwzRjjku.js";import"./vendor-arcblock-DiSm3oUX.js";import"./useLocalStorage-DyVGBDlt.js";import"./index-8eXqqyHQ.js";import"./confirm-DApmnpvm.js";import"./PlayArrow-RVSfCmrB.js";import"./get-safe-url-B8xlSMyD.js";import"./session-Bkvl2PSP.js";import"./use-blocklet-logo-CTCMbFiC.js";import"./dot-iw3hN9HL.js";import"./useAsync-DVHp96Uu.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-CtTQsfXN.js";function $({endpoint:n}){const[i,r]=m.useState("mcp-link"),h=k(),{api:g}=k(),{teamDid:p}=U(),{t:u,locale:d}=w(),{data:o,run:b,loading:x}=v(()=>g.createAccessKey({input:{teamDid:p,passport:C.SERVER_ROLES.ADMIN,authType:"simple",remark:"Generated by MCP Servers"}}),{manual:!0}),{imgPrefix:t}=h,a=m.useMemo(()=>[{icon:e.jsx(s,{sx:{width:20,height:20},children:"🔗"}),value:"mcp-link",label:"MCP Link"},{icon:e.jsx(s,{component:"img",src:`${t}/mcp/claude.webp`,alt:"Claude",sx:{width:20,height:20}}),value:"claude",label:"Claude"},{icon:e.jsx(s,{component:"img",src:`${t}/mcp/cursor.png`,alt:"Cursor",sx:{width:20,height:20}}),value:"cursor",label:"Cursor"},{icon:e.jsx(s,{component:"img",src:`${t}/mcp/cline.png`,alt:"Cline",sx:{width:20,height:20}}),value:"cline",label:"Cline"},{icon:e.jsx(s,{component:"img",src:`${t}/mcp/roocline.png`,alt:"Roo Cline",sx:{width:20,height:20}}),value:"roo-cline",label:"Roo Cline"},{icon:e.jsx(s,{component:"img",src:`${t}/mcp/windsurf.png`,alt:"Windsurf",sx:{width:20,height:20}}),value:"windsurf",label:"Windsurf"},{icon:e.jsx(s,{component:"img",src:`${t}/mcp/witsy.png`,alt:"Witsy",sx:{width:20,height:20}}),value:"witsy",label:"Witsy"}],[t]),l=a.find(c=>c.value===i),f=m.useMemo(()=>{var c;return(c=o==null?void 0:o.data)==null?void 0:c.accessKeySecret},[o]),S=m.useMemo(()=>!f&&i!=="mcp-link",[f,i]),I=c=>{const E=`npx @blocklet/install-mcp@latest i ${n} --client ${c} --streamableHTTP --oauth2Bearer ${f}`;switch(c){case"cursor":case"claude":case"cline":case"roo-cline":case"windsurf":case"witsy":return E;case"mcp-link":default:return n}};return e.jsxs(s,{children:[e.jsx(P,{tabs:a,current:i,onChange:r,scrollButtons:"auto",iconPosition:"start"}),e.jsxs(s,{children:[e.jsxs(s,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(s,{component:"h2",children:i==="mcp-link"?l==null?void 0:l.label:`${l==null?void 0:l.label} ${u("installCommand")}`}),i!=="mcp-link"&&e.jsx(A,{href:`https://www.arcblock.io/docs/blocklet-developer/${d}/mcp-${i}`,target:"_blank",rel:"noopener noreferrer",children:e.jsx(D,{size:"small",children:e.jsx(q,{})})})]}),e.jsxs(s,{position:"relative",sx:{"& .codeblock__inner":{overflow:"auto !important"}},children:[e.jsx(R,{code:I(i),language:"shell",style:{margin:0}}),S&&e.jsx(s,{position:"absolute",top:0,right:0,left:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",sx:{bgcolor:"action.active",backdropFilter:"blur(3px)",WebkitBackdropFilter:"blur(3px)",zIndex:1},children:x?e.jsx(y,{}):e.jsx(z,{variant:"contained",color:"primary",onClick:b,size:"small",children:`${u("common.generate")} ${u("command")}`})})]})]})]})}$.propTypes={endpoint:F.string.isRequired};function ge(){var x;const[n,i]=m.useState(null),{t:r,locale:h}=w(),g=`${(x=window==null?void 0:window.blocklet)==null?void 0:x.appUrl}${C.WELLKNOWN_SERVICE_PATH_PREFIX}/mcp/servers`,{data:p,loading:u,error:d}=v(()=>Promise.all([K.get(g)])),o=m.useMemo(()=>{var t,a;return((a=(t=p==null?void 0:p[0])==null?void 0:t.data)==null?void 0:a.servers)||[]},[p]);m.useEffect(()=>{o!=null&&o.length&&i(o.find(t=>{var a;return t.did===((a=window==null?void 0:window.blocklet)==null?void 0:a.did)})||o[0])},[o]);const b=t=>{const a=t.target.value;i(o.find(l=>l.did===a))};return u?e.jsx(s,{children:e.jsx(y,{})}):d?e.jsx(j,{color:"error",children:d==null?void 0:d.message}):o!=null&&o.length?e.jsxs(L,{gap:2,sx:{maxWidth:1200},children:[e.jsx(N,{title:r("mcp.listTitle"),tooltipTitle:r("mcp.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${h}/mcp-server`}),e.jsxs(M,{fullWidth:!0,children:[e.jsx(W,{id:"server-select-label",children:r("mcp.available")}),e.jsx(B,{labelId:"server-select-label",value:(n==null?void 0:n.did)||"",label:r("mcp.available"),onChange:b,children:o.map(t=>e.jsx(_,{value:t.did,children:e.jsxs(s,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(T,{variant:"rounded",shape:"square",did:t.did,src:t.logo,size:20}),e.jsx(s,{sx:{fontSize:14},children:t.name})]})},t.did))})]}),n&&e.jsx($,{endpoint:n.endpoint})]}):e.jsx(j,{color:"warning",children:r("mcp.noServer")})}export{ge as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./vendor-react-DEoibe3W.js";import{j as L}from"./vendor-mui-core-
|
|
1
|
+
import"./vendor-react-DEoibe3W.js";import{j as L}from"./vendor-mui-core-Bq8gXTan.js";var t=function(e){return L.jsxs("svg",{...e,children:[L.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M50.152 10.6417L31.72 0L13.288 10.6417V24.7942L1 31.8887V53.1722L19.432 63.8139L31.6902 56.7366L31.72 56.7538L31.7498 56.7366L44.008 63.8139L62.44 53.1722V31.8887L50.152 24.7942V10.6417ZM60.52 32.9972L48.232 25.9027V11.7502L31.72 2.21703L15.208 11.7502V25.9028L2.92 32.9972V52.0636L19.432 61.5968L31.6902 54.5196L31.72 54.5368L31.7498 54.5196L44.008 61.5968L60.52 52.0636V32.9972Z",fill:"url(#paint0_linear_615_426)"}),L.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M50.1521 24.8307L31.7201 14.189L13.2881 24.8307V46.1141L31.7201 56.7558L50.1521 46.1141V24.8307ZM15.2081 25.9392L31.7201 16.406L48.2321 25.9392V45.0056L31.7201 54.5388L15.2081 45.0056V25.9392ZM28.5464 23.0464C28.6641 22.6342 29.0408 22.3501 29.4695 22.3501H33.9707C34.3993 22.3501 34.776 22.6342 34.8938 23.0464L35.7504 26.0447L37.8696 27.2681L40.8945 26.5109C41.3103 26.4068 41.7447 26.591 41.959 26.9622L44.2096 30.8604C44.424 31.2316 44.3662 31.6998 44.0682 32.0079L41.8999 34.2489V36.6959L44.0682 38.9369C44.3662 39.245 44.424 39.7133 44.2096 40.0845L41.959 43.9827C41.7447 44.3539 41.3103 44.538 40.8945 44.4339L37.8696 43.6767L35.7504 44.9002L34.8938 47.8984C34.776 48.3106 34.3993 48.5947 33.9707 48.5947H29.4695C29.0408 48.5947 28.6641 48.3106 28.5464 47.8984L27.6897 44.9002L25.5706 43.6767L22.5457 44.4339C22.1299 44.538 21.6955 44.3539 21.4812 43.9827L19.2305 40.0845C19.0162 39.7133 19.0739 39.245 19.372 38.9369L21.5402 36.6959V34.2489L19.372 32.0079C19.0739 31.6998 19.0162 31.2316 19.2305 30.8604L21.4812 26.9622C21.6955 26.591 22.1299 26.4068 22.5457 26.5109L25.5706 27.2681L27.6897 26.0447L28.5464 23.0464ZM28.9861 27.5132C29.2018 27.3887 29.3607 27.1851 29.4292 26.9456L30.1936 24.2701H33.2466L34.011 26.9456C34.0794 27.1851 34.2383 27.3887 34.4541 27.5132L37.2459 29.1251C37.4617 29.2497 37.7174 29.2855 37.9591 29.225L40.6583 28.5493L42.1848 31.1932L40.25 33.193C40.0768 33.372 39.9799 33.6114 39.9799 33.8605V37.0843C39.9799 37.3334 40.0768 37.5728 40.25 37.7518L42.1848 39.7516L40.6583 42.3955L37.9591 41.7198C37.7174 41.6593 37.4617 41.6951 37.2459 41.8197L34.4541 43.4316C34.2383 43.5561 34.0794 43.7597 34.011 43.9992L33.2466 46.6747H30.1936L29.4292 43.9992C29.3607 43.7597 29.2018 43.5561 28.9861 43.4316L26.1942 41.8197C25.9785 41.6951 25.7228 41.6593 25.4811 41.7198L22.7819 42.3955L21.2554 39.7516L23.1902 37.7518C23.3634 37.5728 23.4602 37.3334 23.4602 37.0843V33.8605C23.4602 33.6114 23.3634 33.372 23.1902 33.193L21.2554 31.1932L22.7819 28.5493L25.4811 29.225C25.7228 29.2855 25.9785 29.2497 26.1942 29.1251L28.9861 27.5132ZM31.7201 41.6407C28.3134 41.6407 25.5517 38.8791 25.5517 35.4724C25.5517 32.0657 28.3134 29.3041 31.7201 29.3041C35.1268 29.3041 37.8884 32.0657 37.8884 35.4724C37.8884 38.8791 35.1268 41.6407 31.7201 41.6407ZM35.9684 35.4724C35.9684 37.8187 34.0664 39.7207 31.7201 39.7207C29.3738 39.7207 27.4717 37.8187 27.4717 35.4724C27.4717 33.1261 29.3738 31.2241 31.7201 31.2241C34.0664 31.2241 35.9684 33.1261 35.9684 35.4724Z",fill:"url(#paint1_linear_615_426)"}),L.jsxs("defs",{children:[L.jsxs("linearGradient",{id:"paint0_linear_615_426",x1:"31.72",y1:"95.7208",x2:"95.488",y2:"34.3249",gradientUnits:"userSpaceOnUse",children:[L.jsx("stop",{stopColor:"#0FA4B7"}),L.jsx("stop",{offset:"0.494757",stopColor:"#1DC1C7"}),L.jsx("stop",{offset:"1",stopColor:"#2BE0D7"})]}),L.jsxs("linearGradient",{id:"paint1_linear_615_426",x1:"28.4374",y1:"99.2464",x2:"98.7613",y2:"44.9372",gradientUnits:"userSpaceOnUse",children:[L.jsx("stop",{stopColor:"#0FA4B7"}),L.jsx("stop",{offset:"0.494757",stopColor:"#1DC1C7"}),L.jsx("stop",{offset:"1",stopColor:"#2BE0D7"})]})]})]})};t.defaultProps={width:"64",height:"64",viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg"};var s=function(e){return L.jsx("svg",{...e,children:L.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.36096 2.3999C7.04725 2.3999 6.76249 2.58326 6.63267 2.86886L0.872671 15.5409C0.825415 15.6448 0.800964 15.7577 0.800964 15.8719V15.9999V27.3919C0.800964 27.8337 1.15914 28.1919 1.60096 28.1919H30.401C30.8428 28.1919 31.201 27.8337 31.201 27.3919V15.8719C31.201 15.7577 31.1765 15.6448 31.1293 15.5409L25.3693 2.86886C25.2394 2.58326 24.9547 2.3999 24.641 2.3999H7.36096ZM2.40096 16.7999V26.5919H29.601V16.7932C29.5669 16.7976 29.5321 16.7999 29.4968 16.7999H22.3993L20.3328 19.8997C20.1845 20.1222 19.9347 20.2559 19.6672 20.2559H11.6032C11.3357 20.2559 11.0859 20.1222 10.9375 19.8997L8.87104 16.7999H2.40096ZM29.2167 15.1999H21.9712C21.7037 15.1999 21.4539 15.3336 21.3056 15.5561L19.239 18.6559H12.0313L9.96483 15.5561C9.81645 15.3336 9.56667 15.1999 9.29919 15.1999H2.78519L7.8761 3.9999H24.1258L29.2167 15.1999Z",fill:"currentColor"})})};s.defaultProps={width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg"};export{s as E,t as S};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as S,g as Ee,b as
|
|
1
|
+
import{r as S,g as Ee,b as dt}from"./vendor-react-DEoibe3W.js";import{a as pt,l as ne}from"./vendor-hooks-BFlOfe0M.js";import{j as e,aa as y,H as w,ah as H,E as ut,T as E,X as mt,al as te,ad as Y,ab as $,ak as $e,a9 as ft,I as q,O as W,q as oe,N as ht,br as Me,cl as Oe,cm as ee,bT as We,bq as qe,bx as xt,bs as gt,bR as yt,v as jt,y as vt,bn as bt,s as Ct}from"./vendor-mui-core-Bq8gXTan.js";import{a as L,ar as U,ax as St,$ as fe,a3 as A,ac as xe,k as G,aV as Tt,B as _,r as wt,a5 as ge,bH as He,i as Ue,bg as Pt,b_ as Ae,bu as It,bG as Rt}from"./vendor-ux-did-connect-DVX9lQ8a.js";import{D as F,y as Ge,n as Dt,V as J,G as kt,ad as At,f as Ft,b as re,aE as Nt,T as Ve}from"./index-CMYalRl2.js";import{l as Lt,c as Bt,v as ye,M as X}from"./vendor-arcblock-DiSm3oUX.js";import{W as je}from"./did-address-L54dTMrT.js";import{u as M}from"./dashboard-B2X6c8E8.js";import{r as ve,a as be,b as Ce,c as ie,d as zt,e as Ke,u as _t,f as Et}from"./passport-item-Du8-xENr.js";import{p as Ye}from"./util-M3UFXQFT.js";import{u as $t}from"./use-mobile-DwzRjjku.js";import{w as V,P as Ze}from"./permission-ClRym5FB.js";import{C as Mt}from"./Google-Buu8u6PW.js";import{P as Z,aA as Ot,K as Wt}from"./vendor-utils-BotmZdBm.js";import{E as le}from"./EditIcon-DfiDnAsm.js";import{C as Se}from"./confirm-DApmnpvm.js";import{L as Je}from"./list-header-C7gle0n0.js";import{f as se}from"./index-8eXqqyHQ.js";import{_ as qt}from"./useSetState-CWq0AVWn.js";import{L as Ht}from"./LockIcon-BEG59s5q.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-DyVGBDlt.js";import"./PlayArrow-RVSfCmrB.js";import"./get-safe-url-B8xlSMyD.js";import"./session-Bkvl2PSP.js";import"./use-blocklet-logo-CTCMbFiC.js";import"./InfoOutlined-C8ZBPUhD.js";import"./dot-iw3hN9HL.js";import"./useAsync-DVHp96Uu.js";import"./use-mobile-CtTQsfXN.js";import"./base32-DEjena1X.js";import"./cloneDeep-Jl_OPbSo.js";const Fe="info";function Te({createPassportSvg:c,passport:o,onCancel:d,onSwitchPassport:f}){const{t:u}=L(),l=pt({tab:Fe}),h={info:{label:u("common.basicInfo"),value:Fe,component:()=>e.jsx(Qe,{passport:o,createPassportSvg:c})},logs:{label:u("common.logs"),value:"logs",component:()=>e.jsx(tt,{passport:o})},related:{label:u("team.passport.related"),value:"related",component:()=>e.jsx(st,{passport:o,onSwitchPassport:f})}},s=Object.values(h).map(({label:n,value:t})=>({label:n,value:t})).filter(n=>n.value==="related"?o.parentDid:!0),m=h[l.tab]||h.info,r=n=>{l.tab=n};return e.jsx(U,{title:u("common.passport"),onClose:d,open:!0,PaperProps:{style:{maxWidth:800,minHeight:"80vh"}},fullWidth:!0,children:e.jsxs(Ut,{children:[e.jsx(y,{className:"tabs",children:e.jsx(St,{tabs:s,current:l.tab,onChange:r,scrollButtons:"auto"})}),e.jsx(y,{className:"body",children:e.jsx(m.component,{})})]})})}Te.propTypes={createPassportSvg:w.func.isRequired,passport:w.object.isRequired,onCancel:w.func.isRequired,onSwitchPassport:w.func};Te.defaultProps={onSwitchPassport:()=>{}};const Ut=H(y)`
|
|
2
2
|
margin-top: -16px;
|
|
3
3
|
|
|
4
4
|
.tabs {
|
|
@@ -9,7 +9,7 @@ import{r as S,g as Ee,b as ct}from"./vendor-react-DEoibe3W.js";import{a as dt,l
|
|
|
9
9
|
.body {
|
|
10
10
|
margin-top: 24px;
|
|
11
11
|
}
|
|
12
|
-
`;function
|
|
12
|
+
`;function Qe({createPassportSvg:c,passport:o}){var r,n,t,a;const{t:d,locale:f}=L(),{teamDid:u}=M(),{inService:l}=F(),h=$t(),s=[{items:[{label:d("common.role"),content:ve(o.title)},{label:d("common.did"),content:e.jsx(je,{did:o.id})},{label:d("team.passport.status"),content:be(o.status)},{label:d("common.type"),content:e.jsx(y,{sx:{display:"flex",gap:1,flexWrap:"wrap"},children:(o.type||[]).map(i=>e.jsx(ut,{label:i,variant:"outlined",size:"small",sx:{borderRadius:1}},i))})}]}],m=[{title:d("team.passport.owner"),items:[{label:d("team.passport.owner"),content:e.jsx(y,{children:Ce(o.user,l)})}]},{title:d("common.timeInfo"),items:[{label:d("team.passport.issuanceTime"),content:o.issuanceDate?e.jsx(fe,{value:o.issuanceDate,type:"all",locale:f}):"-"},{label:d("team.member.lastLogin"),content:o.lastLoginAt?e.jsx(fe,{value:o.lastLoginAt,type:"all",locale:f}):"-"},{label:d("common.expires"),content:o.expirationDate?e.jsx(fe,{value:o.expirationDate,type:"all",locale:f}):"-"}]},{title:d("blocklet.overview.source"),items:[{label:d("blocklet.overview.source"),content:ie(o.source)}]}];return e.jsxs(Gt,{gap:3,children:[e.jsxs(y,{sx:{display:"flex",flexDirection:h?"column":"row",alignItems:h?"flex-start":"center",justifyContent:h?"center":"flex-start",width:"100%",overflow:"hidden",gap:h?2:4},children:[e.jsx(y,{sx:{display:"flex",width:"180px"},className:"passport-image",dangerouslySetInnerHTML:{__html:c({scope:o.scope,role:o.role,title:o.scope==="kyc"?o.name:o.title,issuer:o.issuer&&o.issuer.name,issuerDid:o.issuer&&o.issuer.id,ownerName:(r=o.user)==null?void 0:r.fullName,ownerDid:(n=o.user)==null?void 0:n.did,ownerAvatarUrl:(t=o.user)!=null&&t.avatar?Ye((a=o.user)==null?void 0:a.avatar,u,l):"",revoked:o.revoked,extra:o!=null&&o.expirationDate?{key:"Exp",value:Ge(o.expirationDate).format("YYYY-MM-DD HH:mm:ss")}:null})}}),e.jsx(y,{className:"info-area",children:s.map(i=>e.jsxs(y,{children:[i.title&&e.jsx(E,{variant:"h6",sx:{mb:2},children:i.title}),e.jsx(y,{className:"info-grid",sx:{gap:"12px !important"},children:i.items.map(x=>e.jsxs(y,{className:"info-item",children:[e.jsx(y,{className:"info-label",sx:{maxWidth:40},children:e.jsx(E,{variant:"subtitle2",color:"textSecondary",children:x.label})}),e.jsx(y,{sx:{display:"flex",flexWrap:"wrap",gap:.5,minWidth:0},children:x.content})]},x.label))})]},i.title))})]}),e.jsx(mt,{}),e.jsx(y,{className:"info-area",children:m.map(i=>e.jsxs(y,{children:[e.jsx(E,{variant:"h5",sx:{mb:1.5},children:i.title}),e.jsx(y,{className:"info-grid",children:i.items.map(x=>e.jsxs(y,{className:"info-item",children:[e.jsx(y,{className:"info-label",children:e.jsx(E,{variant:"subtitle2",color:"textSecondary",children:x.label})}),e.jsx(y,{sx:{minWidth:500},children:x.content})]},x.label))})]},i.title))})]})}Qe.propTypes={passport:w.object.isRequired,createPassportSvg:w.func.isRequired};const Gt=H(te)`
|
|
13
13
|
.info-card {
|
|
14
14
|
margin-bottom: 24px;
|
|
15
15
|
overflow: hidden;
|
|
@@ -87,7 +87,7 @@ import{r as S,g as Ee,b as ct}from"./vendor-react-DEoibe3W.js";import{a as dt,l
|
|
|
87
87
|
margin: 0;
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
`,Qe=10,Xe=1;function et({passport:c}){const{api:o}=A(),{teamDid:d}=M(),{t:f,locale:u}=L(),[l,h]=S.useState({pageSize:Qe,page:Xe}),{data:s,loading:m}=ne(async()=>{const x={teamDid:d,query:{passportId:c.id},paging:{page:l.page,pageSize:l.pageSize}},g=await o.getPassportLogs({input:x});return{logs:g.passportLogs||[],total:g.paging.total}},{refreshDeps:[l.page,l.pageSize],onError:x=>F.error(x.message)}),r=S.useMemo(()=>(s==null?void 0:s.logs)||[],[s==null?void 0:s.logs]),n=x=>{var g,p,v,j,T,C,I,D,N;return x.action===G.PASSPORT_LOG_ACTION.APPROVE||x.action===G.PASSPORT_LOG_ACTION.REVOKE?(p=(g=x==null?void 0:x.metadata)==null?void 0:g.operator)!=null&&p.fullName?`${f("common.operator")}: ${(j=(v=x==null?void 0:x.metadata)==null?void 0:v.operator)==null?void 0:j.fullName}`:null:x.action===G.PASSPORT_LOG_ACTION.ISSUE&&((T=x.metadata)==null?void 0:T.action)===G.PASSPORT_ISSUE_ACTION.ISSUE_ON_INVITE?(I=(C=x==null?void 0:x.metadata)==null?void 0:C.inviter)!=null&&I.fullName?`${f("common.inviter")}: ${(N=(D=x==null?void 0:x.metadata)==null?void 0:D.inviter)==null?void 0:N.fullName}`:null:`passportId: ${x.passportId}`},t=S.useMemo(()=>[{label:f("common.action"),name:"action",options:{customBodyRender:(x,{rowIndex:g})=>{var v;const p=r[g];return e.jsx(Y,{title:n(p),children:`${x} ${(v=p.metadata)!=null&&v.action?`(${p.metadata.action})`:""}`})}}},{label:"IP",name:"operatorIp",options:{customBodyRender:x=>e.jsx(y,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsx("span",{children:x||"-"})})}},{label:"UA",width:250,name:"operatorUa",options:{customBodyRender:(x,{rowIndex:g})=>{const p=r[g];return e.jsxs(y,{sx:{display:"flex",alignItems:"center",gap:1},children:[p.operatorUa&&e.jsx(y,{children:zt(p.operatorUa)}),p.operatorUa&&e.jsx(Y,{title:p.operatorUa,children:e.jsx(Lt,{fontSize:"small",color:"action",sx:{fontSize:16,cursor:"pointer"}})})]})}}},{label:f("common.createdAt"),name:"createdAt",options:{customBodyRender:x=>Dt(x,u)}}],[f,u,r]),a=({page:x,rowsPerPage:g})=>{l.pageSize!==g?h(p=>({...p,pageSize:g,page:1})):l.page!==x+1&&h(p=>({...p,page:x+1}))},i={sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,search:!1,page:l.page-1,rowsPerPage:l.pageSize,count:(s==null?void 0:s.total)||0};return m?e.jsx(y,{py:2,children:e.jsx(te,{direction:"row",spacing:1,sx:{position:"relative",pb:2},children:e.jsx($,{})})}):e.jsx(y,{children:e.jsx(xe,{className:"logs-table",verticalKeyWidth:100,locale:u,data:r,columns:t,options:i,loading:m,onChange:a})})}et.propTypes={passport:w.object.isRequired};function tt({passport:c,onSwitchPassport:o}){const{api:d}=A(),{teamDid:f}=M(),{t:u,locale:l}=L(),[h,s]=S.useState({pageSize:Qe,page:Xe}),{data:m,loading:r}=ne(async()=>{const g={teamDid:f,passportId:c.parentDid,paging:{page:h.page,pageSize:h.pageSize}},p=await d.getRelatedPassports({input:g});return{passports:p.passports||[],total:p.paging.total}},{refreshDeps:[h.page,h.pageSize],onError:g=>F.error(g.message)}),n=S.useMemo(()=>(m==null?void 0:m.passports)||[],[m==null?void 0:m.passports]),t=S.useMemo(()=>[{label:u("team.passport.role"),name:"role",options:{customBodyRender:ve}},{label:u("team.passport.owner"),name:"user",options:{customBodyRender:Ce}},{label:u("team.passport.status"),name:"status",options:{customBodyRender:be}},{label:u("team.member.lastLogin"),name:"lastLoginAt",options:{customBodyRender:g=>Ve(g,l)}},{label:u("blocklet.overview.source"),name:"source",options:{customBodyRender:ie}}],[u,l]),a=({page:g,rowsPerPage:p})=>{h.pageSize!==p?s(v=>({...v,pageSize:p,page:1})):h.page!==g+1&&s(v=>({...v,page:g+1}))},i=S.useRef(null),x={sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,search:!1,page:h.page-1,rowsPerPage:h.pageSize,count:(m==null?void 0:m.total)||0,onRowClick(g,{dataIndex:p},v){var j;if((j=i.current)!=null&&j.contains(v.target)){const T=n[p];o(T)}}};return r?e.jsx(y,{py:2,children:e.jsx(te,{direction:"row",spacing:1,sx:{position:"relative",pb:2},children:e.jsx($,{})})}):e.jsxs(te,{spacing:1,children:[e.jsx($e,{severity:"warning",children:u("team.passport.relatedDescription")}),e.jsx(y,{ref:i,sx:{".MuiTableRow-root":{cursor:"pointer"}},children:e.jsx(xe,{className:"related-table",verticalKeyWidth:100,locale:l,data:n.filter(g=>g.id!==c.id),columns:t,options:x,loading:r,onChange:a})})]})}tt.propTypes={passport:w.object.isRequired,onSwitchPassport:w.func.isRequired};function ce({onCancel:c,onSuccess:o}){const{api:d}=A(),{blocklet:f}=kt(),{t:u}=L(),[l,h]=S.useState(!1),s=(f.environments.find(a=>a.key==="BLOCKLET_PASSPORT_COLOR")||{}).value||"auto",m=s==="auto"?St.getPassportColorFromDid(f.appDid):s,[r,n]=S.useState(m),t=async()=>{const a=[{key:Bt.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_PASSPORT_COLOR,value:r}];try{h(!0),await d.configBlocklet({input:{did:f.meta.did,configs:a}}),o()}catch(i){F.error(i.message)}finally{h(!1)}};return e.jsx(U,{title:u("team.passport.color"),onClose:c,open:!0,fullWidth:!0,actions:e.jsxs(e.Fragment,{children:[e.jsx(_,{onClick:c,color:"inherit",children:u("common.cancel")}),e.jsxs(_,{onClick:t,color:"primary",disabled:l,variant:"contained",autoFocus:!0,"data-cy":"color-btn-confirm",children:[l&&e.jsx($,{size:16}),u("common.save")]})]}),children:e.jsxs(y,{display:"flex",justifyContent:"center",alignItems:"center",className:"dialog-content",children:[e.jsx(Mt,{disableAlpha:!0,color:r,onChange:a=>n(a.hex)}),e.jsx("div",{style:{width:220,marginLeft:24},dangerouslySetInnerHTML:{__html:Ft({scope:"passport",role:"owner",title:"Owner",issuer:At.getDisplayName(f),issuerDid:f.appDid,ownerName:"Your Name",ownerDid:f.appDid,preferredColor:r})}})]})})}const Vt=V(ce,"mutate_team"),Kt=V(ce,"",J);function Yt(c){const{inService:o}=A();return o?e.jsx(Kt,{...c}):e.jsx(Vt,{...c})}ce.propTypes={onCancel:w.func.isRequired,onSuccess:w.func.isRequired};ce.defaultProps={};var Q=function(c){return e.jsx("svg",{...c,children:e.jsx("path",{d:"M8.4375 4.3125H8.25C8.35313 4.3125 8.4375 4.22812 8.4375 4.125V4.3125H15.5625V4.125C15.5625 4.22812 15.6469 4.3125 15.75 4.3125H15.5625V6H17.25V4.125C17.25 3.29766 16.5773 2.625 15.75 2.625H8.25C7.42266 2.625 6.75 3.29766 6.75 4.125V6H8.4375V4.3125ZM20.25 6H3.75C3.33516 6 3 6.33516 3 6.75V7.5C3 7.60313 3.08437 7.6875 3.1875 7.6875H4.60312L5.18203 19.9453C5.21953 20.7445 5.88047 21.375 6.67969 21.375H17.3203C18.1219 21.375 18.7805 20.7469 18.818 19.9453L19.3969 7.6875H20.8125C20.9156 7.6875 21 7.60313 21 7.5V6.75C21 6.33516 20.6648 6 20.25 6ZM17.1398 19.6875H6.86016L6.29297 7.6875H17.707L17.1398 19.6875Z"})})};Q.defaultProps={width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"};Q.displayName="delete";var we={},Zt=mt;Object.defineProperty(we,"__esModule",{value:!0});var Pe=we.default=void 0,Jt=Zt(Tt()),Qt=e;Pe=we.default=(0,Jt.default)((0,Qt.jsx)("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"}),"ArrowBack");var st=function(o){return e.jsx("svg",{...o,children:e.jsx("path",{d:"M64.707 8.707a1 1 0 0 0 0-1.414L58.343.929a1 1 0 1 0-1.414 1.414L62.586 8l-5.657 5.657a1 1 0 0 0 1.414 1.414l6.364-6.364ZM0 9h64V7H0v2Z",fill:"#666"})})};st.defaultProps={width:"65",height:"16",fill:"none",xmlns:"http://www.w3.org/2000/svg"};const Xt=(c,o)=>c?!o.some(d=>!d.from.passport||!d.to.role):!1;function Ie({onCancel:c,onSuccess:o,data:d,trustedPassports:f}){const{api:u}=A(),{roles:l,teamDid:h}=M(),{t:s}=L(),[m,r]=S.useState(!1),[n,t]=S.useState(d.issuerDid||""),[a,i]=S.useState(d.remark||""),[x,g]=S.useState(Z(d.mappings)||[]),p=f.findIndex(j=>j.issuerDid===d.issuerDid),v=async()=>{if(m)return;const j={issuerDid:n,remark:a,mappings:x.map(C=>({...C,to:{...C.to,ttl:C.to.ttl||0}}))},T=[...f];p===-1?T.unshift(j):T[p]=j;try{r(!0),await u.configTrustedPassports({input:{teamDid:h,trustedPassports:T}}),await re(800),r(!1),F.success(s("common.saveSuccess")),o()}catch(C){r(!1),F.error(se(C))}};return e.jsx(U,{title:s("team.passport.trustedIssuers"),open:!0,showCloseButton:!1,PaperProps:{style:{minHeight:"80vh"}},fullWidth:!0,prepend:e.jsx(q,{onClick:c,"data-cy":"trusted-issuer-close",size:"large",children:e.jsx(Pe,{})}),actions:e.jsxs(e.Fragment,{children:[e.jsx(_,{onClick:c,color:"inherit",children:s("common.cancel")}),e.jsxs(_,{onClick:()=>v(),color:"primary",disabled:!Xt(n,x)||!a||m,variant:"contained",autoFocus:!0,"data-cy":"save-mapping",children:[m&&e.jsx($,{size:16}),s("common.save")]})]}),children:e.jsx(es,{children:e.jsxs("div",{className:"dialog-content",children:[e.jsx(W,{fullWidth:!0,"data-cy":"input-issuer-did",placeholder:s("team.passport.issuerDid"),value:n,onChange:j=>{t(j.target.value)}}),e.jsx(W,{style:{marginTop:16},fullWidth:!0,"data-cy":"input-issuer-remark",placeholder:s("common.remark"),value:a,onChange:j=>{i(j.target.value)}}),e.jsxs(y,{mt:"30px",display:"flex",justifyContent:"space-between",alignItems:"center",children:[e.jsx(y,{className:"dialog-h1",children:s("team.passport.mappingRule")}),e.jsx(y,{children:e.jsx(_,{variant:"outlined",color:"primary","data-cy":"add-mapping",onClick:()=>{g(j=>{const T=[...j];return T.unshift({from:{passport:""},to:{role:G.ROLES.GUEST}}),T})},children:s("team.add")})})]}),e.jsxs(y,{className:"list",mt:-.5,children:[x.map((j,T)=>e.jsxs(y,{display:"flex",alignItems:"center",justifyContent:"space-between",my:3,children:[e.jsxs(y,{display:"flex",alignItems:"center",flexGrow:1,children:[e.jsx(y,{flexGrow:1,flexBasis:1,children:e.jsx(W,{fullWidth:!0,size:"small","data-cy":`input-${T}-from`,placeholder:"Issuer’s Passport Name/ID",value:j.from.passport,onChange:C=>{const{value:I}=C.target;g(D=>{const N=[...D];return N[T].from.passport=I,N})}})}),e.jsx(y,{flexShrink:0,mx:4,children:e.jsx(st,{})}),e.jsx(y,{flexGrow:1,flexBasis:1,children:e.jsx(W,{fullWidth:!0,size:"small",select:!0,value:j.to.role,onChange:C=>{g(I=>{const D=[...I];return D[T].to.role=C.target.value,D})},variant:"outlined",children:l.filter(C=>C.name!=="owner").map(C=>e.jsx(oe,{value:C.name,"data-cy":`passport-mapping-select-option-${C.name}`,children:e.jsx("span",{children:C.title||C.name})},C.name))})})]}),e.jsx(y,{flexShrink:0,ml:4,children:e.jsx(q,{onClick:()=>{g(C=>{const I=[...C];return I.splice(T,1),I})},size:"large",children:e.jsx(Q,{})})})]},`mapping-${T}`)),!x.length&&e.jsx(y,{my:2,color:"text.secondary",fontSize:"16px",children:e.jsx(ge,{children:s("common.empty")})})]})]})})})}Ie.propTypes={onCancel:w.func.isRequired,onSuccess:w.func.isRequired,trustedPassports:w.array,data:w.object};Ie.defaultProps={data:{},trustedPassports:[]};const es=H.div`
|
|
90
|
+
`,Xe=10,et=1;function tt({passport:c}){const{api:o}=F(),{teamDid:d}=M(),{t:f,locale:u}=L(),[l,h]=S.useState({pageSize:Xe,page:et}),{data:s,loading:m}=ne(async()=>{const x={teamDid:d,query:{passportId:c.id},paging:{page:l.page,pageSize:l.pageSize}},g=await o.getPassportLogs({input:x});return{logs:g.passportLogs||[],total:g.paging.total}},{refreshDeps:[l.page,l.pageSize],onError:x=>A.error(x.message)}),r=S.useMemo(()=>(s==null?void 0:s.logs)||[],[s==null?void 0:s.logs]),n=x=>{var g,p,v,j,T,C,I,D,N;return x.action===G.PASSPORT_LOG_ACTION.APPROVE||x.action===G.PASSPORT_LOG_ACTION.REVOKE?(p=(g=x==null?void 0:x.metadata)==null?void 0:g.operator)!=null&&p.fullName?`${f("common.operator")}: ${(j=(v=x==null?void 0:x.metadata)==null?void 0:v.operator)==null?void 0:j.fullName}`:null:x.action===G.PASSPORT_LOG_ACTION.ISSUE&&((T=x.metadata)==null?void 0:T.action)===G.PASSPORT_ISSUE_ACTION.ISSUE_ON_INVITE?(I=(C=x==null?void 0:x.metadata)==null?void 0:C.inviter)!=null&&I.fullName?`${f("common.inviter")}: ${(N=(D=x==null?void 0:x.metadata)==null?void 0:D.inviter)==null?void 0:N.fullName}`:null:`passportId: ${x.passportId}`},t=S.useMemo(()=>[{label:f("common.action"),name:"action",options:{customBodyRender:(x,{rowIndex:g})=>{var v;const p=r[g];return e.jsx(Y,{title:n(p),children:`${x} ${(v=p.metadata)!=null&&v.action?`(${p.metadata.action})`:""}`})}}},{label:"IP",name:"operatorIp",options:{customBodyRender:x=>e.jsx(y,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsx("span",{children:x||"-"})})}},{label:"UA",width:250,name:"operatorUa",options:{customBodyRender:(x,{rowIndex:g})=>{const p=r[g];return e.jsxs(y,{sx:{display:"flex",alignItems:"center",gap:1},children:[p.operatorUa&&e.jsx(y,{children:zt(p.operatorUa)}),p.operatorUa&&e.jsx(Y,{title:p.operatorUa,children:e.jsx(Lt,{fontSize:"small",color:"action",sx:{fontSize:16,cursor:"pointer"}})})]})}}},{label:f("common.createdAt"),name:"createdAt",options:{customBodyRender:x=>Dt(x,u)}}],[f,u,r]),a=({page:x,rowsPerPage:g})=>{l.pageSize!==g?h(p=>({...p,pageSize:g,page:1})):l.page!==x+1&&h(p=>({...p,page:x+1}))},i={sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,search:!1,page:l.page-1,rowsPerPage:l.pageSize,count:(s==null?void 0:s.total)||0};return m?e.jsx(y,{py:2,children:e.jsx(te,{direction:"row",spacing:1,sx:{position:"relative",pb:2},children:e.jsx($,{})})}):e.jsx(y,{children:e.jsx(xe,{className:"logs-table",verticalKeyWidth:100,locale:u,data:r,columns:t,options:i,loading:m,onChange:a})})}tt.propTypes={passport:w.object.isRequired};function st({passport:c,onSwitchPassport:o}){const{api:d}=F(),{teamDid:f}=M(),{t:u,locale:l}=L(),[h,s]=S.useState({pageSize:Xe,page:et}),{data:m,loading:r}=ne(async()=>{const g={teamDid:f,passportId:c.parentDid,paging:{page:h.page,pageSize:h.pageSize}},p=await d.getRelatedPassports({input:g});return{passports:p.passports||[],total:p.paging.total}},{refreshDeps:[h.page,h.pageSize],onError:g=>A.error(g.message)}),n=S.useMemo(()=>(m==null?void 0:m.passports)||[],[m==null?void 0:m.passports]),t=S.useMemo(()=>[{label:u("team.passport.role"),name:"role",options:{customBodyRender:ve}},{label:u("team.passport.owner"),name:"user",options:{customBodyRender:Ce}},{label:u("team.passport.status"),name:"status",options:{customBodyRender:be}},{label:u("team.member.lastLogin"),name:"lastLoginAt",options:{customBodyRender:g=>Ke(g,l)}},{label:u("blocklet.overview.source"),name:"source",options:{customBodyRender:ie}}],[u,l]),a=({page:g,rowsPerPage:p})=>{h.pageSize!==p?s(v=>({...v,pageSize:p,page:1})):h.page!==g+1&&s(v=>({...v,page:g+1}))},i=S.useRef(null),x={sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,search:!1,page:h.page-1,rowsPerPage:h.pageSize,count:(m==null?void 0:m.total)||0,onRowClick(g,{dataIndex:p},v){var j;if((j=i.current)!=null&&j.contains(v.target)){const T=n[p];o(T)}}};return r?e.jsx(y,{py:2,children:e.jsx(te,{direction:"row",spacing:1,sx:{position:"relative",pb:2},children:e.jsx($,{})})}):e.jsxs(te,{spacing:1,children:[e.jsx($e,{severity:"warning",children:u("team.passport.relatedDescription")}),e.jsx(y,{ref:i,sx:{".MuiTableRow-root":{cursor:"pointer"}},children:e.jsx(xe,{className:"related-table",verticalKeyWidth:100,locale:l,data:n.filter(g=>g.id!==c.id),columns:t,options:x,loading:r,onChange:a})})]})}st.propTypes={passport:w.object.isRequired,onSwitchPassport:w.func.isRequired};function ce({onCancel:c,onSuccess:o}){const{api:d}=F(),{blocklet:f}=kt(),{t:u}=L(),[l,h]=S.useState(!1),s=(f.environments.find(a=>a.key==="BLOCKLET_PASSPORT_COLOR")||{}).value||"auto",m=s==="auto"?Tt.getPassportColorFromDid(f.appDid):s,[r,n]=S.useState(m),t=async()=>{const a=[{key:Bt.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_PASSPORT_COLOR,value:r}];try{h(!0),await d.configBlocklet({input:{did:f.meta.did,configs:a}}),o()}catch(i){A.error(i.message)}finally{h(!1)}};return e.jsx(U,{title:u("team.passport.color"),onClose:c,open:!0,fullWidth:!0,actions:e.jsxs(e.Fragment,{children:[e.jsx(_,{onClick:c,color:"inherit",children:u("common.cancel")}),e.jsxs(_,{onClick:t,color:"primary",disabled:l,variant:"contained",autoFocus:!0,"data-cy":"color-btn-confirm",children:[l&&e.jsx($,{size:16}),u("common.save")]})]}),children:e.jsxs(y,{display:"flex",justifyContent:"center",alignItems:"center",className:"dialog-content",children:[e.jsx(Mt,{disableAlpha:!0,color:r,onChange:a=>n(a.hex)}),e.jsx("div",{style:{width:220,marginLeft:24},dangerouslySetInnerHTML:{__html:At({scope:"passport",role:"owner",title:"Owner",issuer:Ft.getDisplayName(f),issuerDid:f.appDid,ownerName:"Your Name",ownerDid:f.appDid,preferredColor:r})}})]})})}const Vt=V(ce,"mutate_team"),Kt=V(ce,"",J);function Yt(c){const{inService:o}=F();return o?e.jsx(Kt,{...c}):e.jsx(Vt,{...c})}ce.propTypes={onCancel:w.func.isRequired,onSuccess:w.func.isRequired};ce.defaultProps={};var Q=function(c){return e.jsx("svg",{...c,children:e.jsx("path",{d:"M8.4375 4.3125H8.25C8.35313 4.3125 8.4375 4.22812 8.4375 4.125V4.3125H15.5625V4.125C15.5625 4.22812 15.6469 4.3125 15.75 4.3125H15.5625V6H17.25V4.125C17.25 3.29766 16.5773 2.625 15.75 2.625H8.25C7.42266 2.625 6.75 3.29766 6.75 4.125V6H8.4375V4.3125ZM20.25 6H3.75C3.33516 6 3 6.33516 3 6.75V7.5C3 7.60313 3.08437 7.6875 3.1875 7.6875H4.60312L5.18203 19.9453C5.21953 20.7445 5.88047 21.375 6.67969 21.375H17.3203C18.1219 21.375 18.7805 20.7469 18.818 19.9453L19.3969 7.6875H20.8125C20.9156 7.6875 21 7.60313 21 7.5V6.75C21 6.33516 20.6648 6 20.25 6ZM17.1398 19.6875H6.86016L6.29297 7.6875H17.707L17.1398 19.6875Z"})})};Q.defaultProps={width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"};Q.displayName="delete";var we={},Zt=ft;Object.defineProperty(we,"__esModule",{value:!0});var Pe=we.default=void 0,Jt=Zt(wt()),Qt=e;Pe=we.default=(0,Jt.default)((0,Qt.jsx)("path",{d:"M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"}),"ArrowBack");var rt=function(o){return e.jsx("svg",{...o,children:e.jsx("path",{d:"M64.707 8.707a1 1 0 0 0 0-1.414L58.343.929a1 1 0 1 0-1.414 1.414L62.586 8l-5.657 5.657a1 1 0 0 0 1.414 1.414l6.364-6.364ZM0 9h64V7H0v2Z",fill:"#666"})})};rt.defaultProps={width:"65",height:"16",fill:"none",xmlns:"http://www.w3.org/2000/svg"};const Xt=(c,o)=>c?!o.some(d=>!d.from.passport||!d.to.role):!1;function Ie({onCancel:c,onSuccess:o,data:d,trustedPassports:f}){const{api:u}=F(),{roles:l,teamDid:h}=M(),{t:s}=L(),[m,r]=S.useState(!1),[n,t]=S.useState(d.issuerDid||""),[a,i]=S.useState(d.remark||""),[x,g]=S.useState(Z(d.mappings)||[]),p=f.findIndex(j=>j.issuerDid===d.issuerDid),v=async()=>{if(m)return;const j={issuerDid:n,remark:a,mappings:x.map(C=>({...C,to:{...C.to,ttl:C.to.ttl||0}}))},T=[...f];p===-1?T.unshift(j):T[p]=j;try{r(!0),await u.configTrustedPassports({input:{teamDid:h,trustedPassports:T}}),await re(800),r(!1),A.success(s("common.saveSuccess")),o()}catch(C){r(!1),A.error(se(C))}};return e.jsx(U,{title:s("team.passport.trustedIssuers"),open:!0,showCloseButton:!1,PaperProps:{style:{minHeight:"80vh"}},fullWidth:!0,prepend:e.jsx(q,{onClick:c,"data-cy":"trusted-issuer-close",size:"large",children:e.jsx(Pe,{})}),actions:e.jsxs(e.Fragment,{children:[e.jsx(_,{onClick:c,color:"inherit",children:s("common.cancel")}),e.jsxs(_,{onClick:()=>v(),color:"primary",disabled:!Xt(n,x)||!a||m,variant:"contained",autoFocus:!0,"data-cy":"save-mapping",children:[m&&e.jsx($,{size:16}),s("common.save")]})]}),children:e.jsx(es,{children:e.jsxs("div",{className:"dialog-content",children:[e.jsx(W,{fullWidth:!0,"data-cy":"input-issuer-did",placeholder:s("team.passport.issuerDid"),value:n,onChange:j=>{t(j.target.value)}}),e.jsx(W,{style:{marginTop:16},fullWidth:!0,"data-cy":"input-issuer-remark",placeholder:s("common.remark"),value:a,onChange:j=>{i(j.target.value)}}),e.jsxs(y,{mt:"30px",display:"flex",justifyContent:"space-between",alignItems:"center",children:[e.jsx(y,{className:"dialog-h1",children:s("team.passport.mappingRule")}),e.jsx(y,{children:e.jsx(_,{variant:"outlined",color:"primary","data-cy":"add-mapping",onClick:()=>{g(j=>{const T=[...j];return T.unshift({from:{passport:""},to:{role:G.ROLES.GUEST}}),T})},children:s("team.add")})})]}),e.jsxs(y,{className:"list",mt:-.5,children:[x.map((j,T)=>e.jsxs(y,{display:"flex",alignItems:"center",justifyContent:"space-between",my:3,children:[e.jsxs(y,{display:"flex",alignItems:"center",flexGrow:1,children:[e.jsx(y,{flexGrow:1,flexBasis:1,children:e.jsx(W,{fullWidth:!0,size:"small","data-cy":`input-${T}-from`,placeholder:"Issuer’s Passport Name/ID",value:j.from.passport,onChange:C=>{const{value:I}=C.target;g(D=>{const N=[...D];return N[T].from.passport=I,N})}})}),e.jsx(y,{flexShrink:0,mx:4,children:e.jsx(rt,{})}),e.jsx(y,{flexGrow:1,flexBasis:1,children:e.jsx(W,{fullWidth:!0,size:"small",select:!0,value:j.to.role,onChange:C=>{g(I=>{const D=[...I];return D[T].to.role=C.target.value,D})},variant:"outlined",children:l.filter(C=>C.name!=="owner").map(C=>e.jsx(oe,{value:C.name,"data-cy":`passport-mapping-select-option-${C.name}`,children:e.jsx("span",{children:C.title||C.name})},C.name))})})]}),e.jsx(y,{flexShrink:0,ml:4,children:e.jsx(q,{onClick:()=>{g(C=>{const I=[...C];return I.splice(T,1),I})},size:"large",children:e.jsx(Q,{})})})]},`mapping-${T}`)),!x.length&&e.jsx(y,{my:2,color:"text.secondary",fontSize:"16px",children:e.jsx(ge,{children:s("common.empty")})})]})]})})})}Ie.propTypes={onCancel:w.func.isRequired,onSuccess:w.func.isRequired,trustedPassports:w.array,data:w.object};Ie.defaultProps={data:{},trustedPassports:[]};const es=H.div`
|
|
91
91
|
.dialog-h1 {
|
|
92
92
|
font-size: 18px;
|
|
93
93
|
}
|
|
@@ -99,7 +99,7 @@ import{r as S,g as Ee,b as ct}from"./vendor-react-DEoibe3W.js";import{a as dt,l
|
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
-
`;function de({onCancel:c,hasPermission:o}){const{api:d}=
|
|
102
|
+
`;function de({onCancel:c,hasPermission:o}){const{api:d}=F(),{teamDid:f,trustedPassports:u}=M(),{t:l}=L(),[h,s]=S.useState(null),[m,r]=S.useState(!1),[n,t]=S.useState(!1),[a,i]=S.useState(""),x=async p=>{if(m)return;const v=u.findIndex(T=>T.issuerDid===p);v===-1&&A.error("Cannot find passports");const j=[...u];j.splice(v,1);try{r(!0),await d.configTrustedPassports({input:{teamDid:f,trustedPassports:j}}),await re(800),r(!1),A.success(l("common.saveSuccess")),s(!1)}catch(T){r(!1),A.error(T.message)}},g=u.filter(p=>!a||p.issuerDid.toLowerCase().includes(a.toLowerCase()));return e.jsxs(U,{title:l("team.passport.trustedIssuers"),open:!0,onClose:c,fullWidth:!0,PaperProps:{style:{minHeight:"80vh"}},children:[e.jsx(as,{children:e.jsxs("div",{className:"dialog-content",children:[e.jsx("div",{className:"dialog-h1",children:l("team.passport.trustedPassportIssuers")}),e.jsx(Je,{sx:{mt:3},actions:e.jsxs(e.Fragment,{children:[e.jsx(He,{options:{searchPlaceholder:l("team.passport.searchIssuerDid"),searchDebounceTime:600},search:a,searchText:a,searchTextUpdate:i,searchClose:()=>i(""),onSearchOpen:()=>{}}),o&&e.jsxs(_,{variant:"contained",color:"primary","data-cy":"add-trusted-issuer",onClick:()=>t({mode:"add"}),children:[e.jsx(ye,{style:{fontSize:16,marginRight:4}}),l("team.add")]})]})}),e.jsxs("div",{className:"list",children:[g.map(p=>e.jsxs(y,{display:"flex",alignItems:"center",justifyContent:"space-between",mt:"20px",children:[e.jsxs(y,{flexShrink:0,children:[e.jsx(je,{copyable:!1,size:16,did:Ue.toAddress(p.issuerDid),showDidLogo:!1}),!!p.remark&&e.jsx(y,{fontSize:12,maxWidth:"300px",children:p.remark})]}),e.jsx(y,{color:"gray",ml:"28px",flexGrow:1,children:p.mappings&&p.mappings.length?`${p.mappings.length} ${l("team.passport.mappingRule")}`:l("team.passport.defaultRule")}),e.jsxs(y,{flexShrink:0,display:"flex",alignItems:"center",children:[e.jsx(q,{onClick:()=>t({mode:"update",data:Z(p)}),"data-cy":"edit-mapping-rule",size:"large",children:e.jsx(le,{})}),e.jsx(q,{"data-cy":"delete-mapping-rule",onClick:()=>s({title:l("common.delete"),description:l("common.delConfirmDescription",{data:p.issuerDid}),confirm:l("common.delConfirm"),cancel:l("common.cancel"),onConfirm:()=>x(p.issuerDid),onCancel:()=>{r(!1),s(null)}}),size:"large",children:e.jsx(Q,{})})]})]},p.issuerDid)),!u.length&&e.jsx(ge,{children:l("common.empty")})]})]})}),n&&e.jsx(Ie,{mode:n.mode,data:n.data,trustedPassports:Z(u),onCancel:()=>t(null),onSuccess:()=>{t(null)}}),h&&e.jsx(Se,{title:h.title,description:h.description,confirm:h.confirm,cancel:h.cancel,params:h.params,onConfirm:h.onConfirm,onCancel:h.onCancel})]})}de.propTypes={onCancel:w.func.isRequired,hasPermission:w.bool};de.defaultProps={hasPermission:!1};const ts=V(de,"mutate_team"),ss=V(de,"",J);function rs(c){const{inService:o}=F();return o?e.jsx(ss,{...c}):e.jsx(ts,{...c})}const as=H.div`
|
|
103
103
|
.list {
|
|
104
104
|
.MuiIconButton-root {
|
|
105
105
|
svg {
|
|
@@ -107,7 +107,7 @@ import{r as S,g as Ee,b as ct}from"./vendor-react-DEoibe3W.js";import{a as dt,l
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
`;var ns=Ot();const Ne=Ee(ns);function Re({onCancel:c,onSuccess:o,data:d,trustedFactories:f}){var g,p,v;const{api:u}=
|
|
110
|
+
`;var ns=Ot();const Ne=Ee(ns);function Re({onCancel:c,onSuccess:o,data:d,trustedFactories:f}){var g,p,v;const{api:u}=F(),{roles:l,teamDid:h}=M(),{t:s}=L(),[m,r]=qt({loading:!1,fetching:!1,fetched:[],errored:[],factoryAddress:d.factoryAddress||"",remark:d.remark||"",role:((g=d.passport)==null?void 0:g.role)||"member",ttlPolicy:((p=d.passport)==null?void 0:p.ttlPolicy)||"never",ttl:Ne(+((v=d.passport)==null?void 0:v.ttl)||365*24*60*60*1e3),error:""}),n=f.findIndex(j=>j.factoryAddress===d.factoryAddress),t=async()=>{if(m.loading)return;const{factoryAddress:j,remark:T,role:C,ttlPolicy:I,ttl:D}=m,N={factoryAddress:j,remark:T,passport:{role:C,ttlPolicy:I,ttl:I==="never"?0:Ne(D)}},k=[...f];n===-1?k.unshift(N):k[n]=N;try{r({loading:!0}),await u.configTrustedFactories({input:{teamDid:h,trustedFactories:k}}),await re(800),A.success(s("common.saveSuccess")),o()}catch(B){console.error(B),A.error(se(B))}finally{r({loading:!1})}};S.useEffect(()=>{const j=m.fetched.find(C=>C.address===m.factoryAddress),T=m.errored.find(C=>C.address===m.factoryAddress);Ue.isValid(m.factoryAddress)&&!m.fetching&&!j&&!T&&(r({fetching:!0}),Nt(G.MAIN_CHAIN_ENDPOINT).getFactoryState({address:m.factoryAddress}).then(I=>{I.state?r({fetching:!1,fetched:[...m.fetched.filter(D=>D.address!==m.factoryAddress),I.state],remark:I.state.name}):r({fetching:!1,errored:[...m.errored.filter(D=>D.address!==m.factoryAddress),{address:m.factoryAddress}],error:s("team.passport.factory404",m)})}).catch(I=>{console.error(I),r({fetching:!1,error:se(I)})}))},[m.factoryAddress,m.fetching]);let a=m.error;const i=m.factoryAddress?m.errored.find(j=>j.address===m.factoryAddress):null;!a&&i&&(a=s("team.passport.factory404",m));const x=m.factoryAddress?m.fetched.find(j=>j.address===m.factoryAddress):null;return!a&&x&&(a=x.description),a||(a=s("team.passport.factoryAddressTip")),e.jsx(U,{title:s("team.passport.trustedFactories"),open:!0,showCloseButton:!1,PaperProps:{style:{minHeight:"80vh"}},fullWidth:!0,prepend:e.jsx(q,{onClick:c,"data-cy":"close-trusted-factory",size:"large",children:e.jsx(Pe,{})}),actions:e.jsxs(e.Fragment,{children:[e.jsx(_,{onClick:c,color:"inherit",children:s("common.cancel")}),e.jsxs(_,{onClick:()=>t(),color:"primary",disabled:!m.factoryAddress||!m.remark||!m.role||m.loading||m.error||i,variant:"contained",autoFocus:!0,"data-cy":"save-trusted-factory",children:[m.loading&&e.jsx($,{size:16}),s("common.save")]})]}),children:e.jsx(os,{children:e.jsxs("div",{className:"dialog-content",children:[e.jsx(W,{fullWidth:!0,error:!!m.error||!!i,"data-cy":"input-factory-address",label:s("team.passport.factoryAddress"),helperText:a,value:m.factoryAddress,InputProps:{endAdornment:m.fetching?e.jsx(ht,{position:"end",children:e.jsx($,{size:16})}):null},onChange:j=>{r({factoryAddress:j.target.value,error:""})}}),e.jsx(W,{style:{marginTop:32},fullWidth:!0,"data-cy":"input-factory-remark",label:s("common.remark"),value:m.remark,onChange:j=>{r({remark:j.target.value})}}),e.jsx(W,{style:{marginTop:32},fullWidth:!0,"data-cy":"input-passport-role",label:s("team.passport.role"),select:!0,value:m.role,onChange:j=>{r({role:j.target.value})},variant:"outlined",children:l.filter(j=>j.name!=="owner").map(j=>e.jsx(oe,{value:j.name,"data-cy":`passport-role-select-option-${j.name}`,children:e.jsx("span",{children:j.title||j.name})},j.name))}),e.jsxs("div",{style:{marginTop:32},children:[e.jsx(Me,{children:s("team.passport.ttl")}),e.jsxs(Oe,{color:"primary",size:"small",value:m.ttlPolicy,exclusive:!0,style:{marginTop:16},onChange:(j,T)=>r({ttlPolicy:T}),"data-cy":"input-passport-ttl-since","aria-label":"Expire Policy",children:[e.jsx(ee,{value:"never","data-cy":"input-passport-ttl-never",children:e.jsx(Y,{title:s("team.passport.ttlNeverTip"),children:e.jsx(E,{children:s("team.passport.ttlNever")})})}),e.jsx(ee,{value:"mint","data-cy":"input-passport-ttl-mint",children:e.jsx(Y,{title:s("team.passport.ttlMintTip"),children:e.jsx(E,{children:s("team.passport.ttlMint")})})}),e.jsx(ee,{value:"exchange","data-cy":"input-passport-ttl-exchange",children:e.jsx(Y,{title:s("team.passport.ttlExchangeTip"),children:e.jsx(E,{children:s("team.passport.ttlExchange")})})})]}),m.ttlPolicy!=="never"&&e.jsxs(e.Fragment,{children:[e.jsx(We,{fullWidth:!0,type:"text",style:{marginTop:16},"data-cy":"input-passport-ttl",value:m.ttl,onChange:j=>{r({ttl:j.target.value})}}),e.jsx(qe,{children:s("team.passport.ttlTip")})]})]})]})})})}Re.propTypes={onCancel:w.func.isRequired,onSuccess:w.func.isRequired,trustedFactories:w.array,data:w.object};Re.defaultProps={data:{},trustedFactories:[]};const os=H.div`
|
|
111
111
|
.dialog-h1 {
|
|
112
112
|
font-size: 18px;
|
|
113
113
|
}
|
|
@@ -119,7 +119,7 @@ import{r as S,g as Ee,b as ct}from"./vendor-react-DEoibe3W.js";import{a as dt,l
|
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
-
`;function pe({onCancel:c,hasPermission:o}){const{api:d}=
|
|
122
|
+
`;function pe({onCancel:c,hasPermission:o}){const{api:d}=F(),{teamDid:f,trustedFactories:u}=M(),{t:l}=L(),[h,s]=S.useState(null),[m,r]=S.useState(!1),[n,t]=S.useState(null),[a,i]=S.useState(""),x=async p=>{if(!m)try{r(!0),await d.configTrustedFactories({input:{teamDid:f,trustedFactories:u.filter(v=>v.factoryAddress!==p)}}),await re(800),r(!1),A.success(l("common.saveSuccess")),s(null)}catch(v){r(!1),A.error(v.message)}},g=u.filter(p=>!a||p.factoryAddress.toLowerCase().includes(a.toLowerCase()));return e.jsxs(U,{title:l("team.passport.trustedFactories"),open:!0,onClose:c,fullWidth:!0,PaperProps:{style:{minHeight:"80vh"}},children:[e.jsx(ds,{children:e.jsxs("div",{className:"dialog-content",children:[e.jsx("div",{className:"dialog-h1",children:l("team.passport.trustedFactoriesTip")}),e.jsx(Je,{sx:{mt:3},actions:e.jsxs(e.Fragment,{children:[e.jsx(He,{options:{searchPlaceholder:l("team.passport.searchFactoryAddress"),searchDebounceTime:600},search:a,searchText:a,searchTextUpdate:i,searchClose:()=>i(""),onSearchOpen:()=>{}}),o&&e.jsxs(_,{variant:"contained",color:"primary",size:"small","data-cy":"add-trusted-factory",onClick:()=>t({mode:"add"}),children:[e.jsx(ye,{style:{fontSize:16,marginRight:4}}),l("team.add")]})]})}),e.jsxs("div",{className:"list",children:[g.map(p=>e.jsxs(y,{display:"flex",alignItems:"center",justifyContent:"space-between",mt:"20px",children:[e.jsxs(y,{flexGrow:1,children:[e.jsx(je,{copyable:!1,did:p.factoryAddress,size:16,showDidLogo:!1}),!!p.remark&&e.jsx(y,{fontSize:12,maxWidth:"300px",children:p.remark})]}),e.jsx(y,{color:"gray",mr:"24px",children:e.jsx(Pt,{type:"success",children:p.passport.role})}),e.jsxs(y,{flexShrink:0,display:"flex",alignItems:"center",children:[e.jsx(q,{onClick:()=>t({mode:"update",data:Z(p)}),"data-cy":"edit-trusted-factory",size:"large",children:e.jsx(le,{})}),e.jsx(q,{"data-cy":"delete-trusted-factory",onClick:()=>s({title:l("common.delete"),description:l("common.delConfirmDescription",{data:p.factoryAddress}),confirm:l("common.delConfirm"),cancel:l("common.cancel"),onConfirm:()=>x(p.factoryAddress),onCancel:()=>{r(!1),s(null)}}),size:"large",children:e.jsx(Q,{})})]})]},p.factoryAddress)),!u.length&&e.jsx(ge,{children:l("common.empty")})]})]})}),n&&e.jsx(Re,{data:n.data,trustedFactories:Z(u),onCancel:()=>t(null),onSuccess:()=>{t(null)}}),h&&e.jsx(Se,{title:h.title,description:h.description,confirm:h.confirm,cancel:h.cancel,params:h.params,onConfirm:h.onConfirm,onCancel:h.onCancel})]})}pe.propTypes={onCancel:w.func.isRequired,hasPermission:w.bool};pe.defaultProps={hasPermission:!1};const is=V(pe,"mutate_team"),ls=V(pe,"",J);function cs(c){const{inService:o}=F();return o?e.jsx(ls,{...c}):e.jsx(is,{...c})}const ds=H.div`
|
|
123
123
|
.list {
|
|
124
124
|
.MuiIconButton-root {
|
|
125
125
|
svg {
|
|
@@ -127,12 +127,12 @@ import{r as S,g as Ee,b as ct}from"./vendor-react-DEoibe3W.js";import{a as dt,l
|
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
-
`;var
|
|
130
|
+
`;var at={exports:{}},nt={exports:{}};(function(){var c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o={rotl:function(d,f){return d<<f|d>>>32-f},rotr:function(d,f){return d<<32-f|d>>>f},endian:function(d){if(d.constructor==Number)return o.rotl(d,8)&16711935|o.rotl(d,24)&4278255360;for(var f=0;f<d.length;f++)d[f]=o.endian(d[f]);return d},randomBytes:function(d){for(var f=[];d>0;d--)f.push(Math.floor(Math.random()*256));return f},bytesToWords:function(d){for(var f=[],u=0,l=0;u<d.length;u++,l+=8)f[l>>>5]|=d[u]<<24-l%32;return f},wordsToBytes:function(d){for(var f=[],u=0;u<d.length*32;u+=8)f.push(d[u>>>5]>>>24-u%32&255);return f},bytesToHex:function(d){for(var f=[],u=0;u<d.length;u++)f.push((d[u]>>>4).toString(16)),f.push((d[u]&15).toString(16));return f.join("")},hexToBytes:function(d){for(var f=[],u=0;u<d.length;u+=2)f.push(parseInt(d.substr(u,2),16));return f},bytesToBase64:function(d){for(var f=[],u=0;u<d.length;u+=3)for(var l=d[u]<<16|d[u+1]<<8|d[u+2],h=0;h<4;h++)u*8+h*6<=d.length*8?f.push(c.charAt(l>>>6*(3-h)&63)):f.push("=");return f.join("")},base64ToBytes:function(d){d=d.replace(/[^A-Z0-9+\/]/ig,"");for(var f=[],u=0,l=0;u<d.length;l=++u%4)l!=0&&f.push((c.indexOf(d.charAt(u-1))&Math.pow(2,-2*l+8)-1)<<l*2|c.indexOf(d.charAt(u))>>>6-l*2);return f}};nt.exports=o})();var ps=nt.exports,he={utf8:{stringToBytes:function(c){return he.bin.stringToBytes(unescape(encodeURIComponent(c)))},bytesToString:function(c){return decodeURIComponent(escape(he.bin.bytesToString(c)))}},bin:{stringToBytes:function(c){for(var o=[],d=0;d<c.length;d++)o.push(c.charCodeAt(d)&255);return o},bytesToString:function(c){for(var o=[],d=0;d<c.length;d++)o.push(String.fromCharCode(c[d]));return o.join("")}}},Le=he;/*!
|
|
131
131
|
* Determine if an object is a Buffer
|
|
132
132
|
*
|
|
133
133
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
134
134
|
* @license MIT
|
|
135
|
-
*/var us=function(c){return c!=null&&(nt(c)||ms(c)||!!c._isBuffer)};function nt(c){return!!c.constructor&&typeof c.constructor.isBuffer=="function"&&c.constructor.isBuffer(c)}function ms(c){return typeof c.readFloatLE=="function"&&typeof c.slice=="function"&&nt(c.slice(0,0))}(function(){var c=ps,o=Le.utf8,d=us,f=Le.bin,u=function(l,h){l.constructor==String?h&&h.encoding==="binary"?l=f.stringToBytes(l):l=o.stringToBytes(l):d(l)?l=Array.prototype.slice.call(l,0):!Array.isArray(l)&&l.constructor!==Uint8Array&&(l=l.toString());for(var s=c.bytesToWords(l),m=l.length*8,r=1732584193,n=-271733879,t=-1732584194,a=271733878,i=0;i<s.length;i++)s[i]=(s[i]<<8|s[i]>>>24)&16711935|(s[i]<<24|s[i]>>>8)&4278255360;s[m>>>5]|=128<<m%32,s[(m+64>>>9<<4)+14]=m;for(var x=u._ff,g=u._gg,p=u._hh,v=u._ii,i=0;i<s.length;i+=16){var j=r,T=n,C=t,I=a;r=x(r,n,t,a,s[i+0],7,-680876936),a=x(a,r,n,t,s[i+1],12,-389564586),t=x(t,a,r,n,s[i+2],17,606105819),n=x(n,t,a,r,s[i+3],22,-1044525330),r=x(r,n,t,a,s[i+4],7,-176418897),a=x(a,r,n,t,s[i+5],12,1200080426),t=x(t,a,r,n,s[i+6],17,-1473231341),n=x(n,t,a,r,s[i+7],22,-45705983),r=x(r,n,t,a,s[i+8],7,1770035416),a=x(a,r,n,t,s[i+9],12,-1958414417),t=x(t,a,r,n,s[i+10],17,-42063),n=x(n,t,a,r,s[i+11],22,-1990404162),r=x(r,n,t,a,s[i+12],7,1804603682),a=x(a,r,n,t,s[i+13],12,-40341101),t=x(t,a,r,n,s[i+14],17,-1502002290),n=x(n,t,a,r,s[i+15],22,1236535329),r=g(r,n,t,a,s[i+1],5,-165796510),a=g(a,r,n,t,s[i+6],9,-1069501632),t=g(t,a,r,n,s[i+11],14,643717713),n=g(n,t,a,r,s[i+0],20,-373897302),r=g(r,n,t,a,s[i+5],5,-701558691),a=g(a,r,n,t,s[i+10],9,38016083),t=g(t,a,r,n,s[i+15],14,-660478335),n=g(n,t,a,r,s[i+4],20,-405537848),r=g(r,n,t,a,s[i+9],5,568446438),a=g(a,r,n,t,s[i+14],9,-1019803690),t=g(t,a,r,n,s[i+3],14,-187363961),n=g(n,t,a,r,s[i+8],20,1163531501),r=g(r,n,t,a,s[i+13],5,-1444681467),a=g(a,r,n,t,s[i+2],9,-51403784),t=g(t,a,r,n,s[i+7],14,1735328473),n=g(n,t,a,r,s[i+12],20,-1926607734),r=p(r,n,t,a,s[i+5],4,-378558),a=p(a,r,n,t,s[i+8],11,-2022574463),t=p(t,a,r,n,s[i+11],16,1839030562),n=p(n,t,a,r,s[i+14],23,-35309556),r=p(r,n,t,a,s[i+1],4,-1530992060),a=p(a,r,n,t,s[i+4],11,1272893353),t=p(t,a,r,n,s[i+7],16,-155497632),n=p(n,t,a,r,s[i+10],23,-1094730640),r=p(r,n,t,a,s[i+13],4,681279174),a=p(a,r,n,t,s[i+0],11,-358537222),t=p(t,a,r,n,s[i+3],16,-722521979),n=p(n,t,a,r,s[i+6],23,76029189),r=p(r,n,t,a,s[i+9],4,-640364487),a=p(a,r,n,t,s[i+12],11,-421815835),t=p(t,a,r,n,s[i+15],16,530742520),n=p(n,t,a,r,s[i+2],23,-995338651),r=v(r,n,t,a,s[i+0],6,-198630844),a=v(a,r,n,t,s[i+7],10,1126891415),t=v(t,a,r,n,s[i+14],15,-1416354905),n=v(n,t,a,r,s[i+5],21,-57434055),r=v(r,n,t,a,s[i+12],6,1700485571),a=v(a,r,n,t,s[i+3],10,-1894986606),t=v(t,a,r,n,s[i+10],15,-1051523),n=v(n,t,a,r,s[i+1],21,-2054922799),r=v(r,n,t,a,s[i+8],6,1873313359),a=v(a,r,n,t,s[i+15],10,-30611744),t=v(t,a,r,n,s[i+6],15,-1560198380),n=v(n,t,a,r,s[i+13],21,1309151649),r=v(r,n,t,a,s[i+4],6,-145523070),a=v(a,r,n,t,s[i+11],10,-1120210379),t=v(t,a,r,n,s[i+2],15,718787259),n=v(n,t,a,r,s[i+9],21,-343485551),r=r+j>>>0,n=n+T>>>0,t=t+C>>>0,a=a+I>>>0}return c.endian([r,n,t,a])};u._ff=function(l,h,s,m,r,n,t){var a=l+(h&s|~h&m)+(r>>>0)+t;return(a<<n|a>>>32-n)+h},u._gg=function(l,h,s,m,r,n,t){var a=l+(h&m|s&~m)+(r>>>0)+t;return(a<<n|a>>>32-n)+h},u._hh=function(l,h,s,m,r,n,t){var a=l+(h^s^m)+(r>>>0)+t;return(a<<n|a>>>32-n)+h},u._ii=function(l,h,s,m,r,n,t){var a=l+(s^(h|~m))+(r>>>0)+t;return(a<<n|a>>>32-n)+h},u._blocksize=16,u._digestsize=16,rt.exports=function(l,h){if(l==null)throw new Error("Illegal argument "+l);var s=c.wordsToBytes(u(l,h));return h&&h.asBytes?s:h&&h.asString?f.bytesToString(s):c.bytesToHex(s)}})();var fs=rt.exports;const hs=Ee(fs);function ue({teamDid:c,onCancel:o,onSuccess:d,onError:f,mode:u,item:l}){var D,N;const{api:h}=A(),[s,m]=S.useState(!1),[r,n]=S.useState(""),{t}=L(),[a,i]=S.useState(l.title||""),[x,g]=S.useState(l.description||""),[p,v]=S.useState(((D=l==null?void 0:l.extra)==null?void 0:D.display)||"builtin"),[j,T]=S.useState((N=l==null?void 0:l.extra)!=null&&N.types?l.extra.types.join(","):""),C=async()=>{const k=a.trim();if(!k){n(t("team.passport.error.titleEmpty"));return}if(k.length>64){n(t("team.passport.error.titleTooLong",{length:64}));return}const B=x.replace(/\n/g," ");if(!B){n(t("team.passport.error.descriptionEmpty"));return}const K=u==="create"?hs(k):l.name;n(null),m(!0);try{if(u==="create"){const R={teamDid:c,name:K,title:k,description:B};p==="custom"&&(R.extra=JSON.stringify({display:"custom",types:j.split(",")})),await h.createRole({input:R})}else{const R={teamDid:c,role:{name:K,title:k,description:B}};await h.updateRole({input:R})}d()}catch(R){const b=se(R);n(b),f(R)}finally{m(!1)}},I=e.jsxs("div",{children:[u==="update"&&e.jsx(E,{component:"div",style:{paddingTop:16},children:e.jsx(W,{label:"ID",autoComplete:"off",variant:"outlined",name:"url","data-cy":"mutate-role-input-name",fullWidth:!0,autoFocus:!0,value:l.name,disabled:!0})}),e.jsx(E,{component:"div",style:{marginTop:16},children:e.jsx(W,{label:t("common.title"),autoComplete:"off",variant:"outlined",name:"title","data-cy":"mutate-role-input-title",fullWidth:!0,autoFocus:!0,value:a,onChange:k=>{n(null),i(k.target.value)},disabled:u==="update"||s,helperText:t("team.passport.create.titleTip")})}),e.jsx(E,{component:"div",style:{marginTop:16,marginBottom:16},children:e.jsx(W,{label:t("common.description"),autoComplete:"off",variant:"outlined",name:"description","data-cy":"mutate-role-input-description",fullWidth:!0,autoFocus:!0,value:x,onChange:k=>{n(null),g(k.target.value)},disabled:s,multiline:!0,rows:3})}),u==="create"&&e.jsxs("div",{style:{marginBottom:16},children:[e.jsx(Me,{children:t("common.display")}),e.jsxs(Oe,{color:"primary",size:"small",value:p,exclusive:!0,style:{marginTop:16},disabled:s,onChange:(k,B)=>v(B),"data-cy":"input-role-display",children:[e.jsx(ee,{value:"builtin","data-cy":"input-role-display-builtin",children:e.jsx(E,{children:t("team.passport.displayBuiltin")})}),e.jsx(ee,{value:"custom","data-cy":"input-role-display-custom",children:e.jsx(E,{children:t("team.passport.displayCustom")})})]}),p==="custom"&&e.jsxs(e.Fragment,{children:[e.jsx(We,{fullWidth:!0,type:"text",style:{marginTop:16},"data-cy":"input-role-types",value:j,disabled:s,onChange:k=>{T(k.target.value)}}),e.jsx(qe,{children:t("team.passport.typesTip")})]})]})]});return e.jsxs(U,{title:u==="create"?t("team.passport.create.title"):"",fullWidth:!0,open:!0,onClose:o,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[e.jsx(_,{onClick:o,color:"inherit",children:t("common.cancel")}),e.jsxs(_,{"data-cy":"mutate-role-confirm",onClick:C,color:"primary",disabled:s,variant:"contained",autoFocus:!0,children:[s&&e.jsx($,{size:16}),t(u==="create"?"common.create":"common.update")]})]}),children:[e.jsx(ht,{component:"div",children:I}),!!r&&e.jsx($e,{severity:"error",variant:"icon",style:{width:"100%",margin:0},children:r})]})}ue.propTypes={teamDid:w.string.isRequired,onCancel:w.func.isRequired,onSuccess:w.func.isRequired,onError:w.func,mode:w.oneOf(["create","update"]),item:w.object};ue.defaultProps={onError:()=>{},mode:"create",item:{}};function me({onCancel:c,onSuccess:o,onDelete:d,roleName:f,hasPermission:u}){const{api:l}=A(),{roles:h,permissions:s,teamDid:m,refresh:r,isNodeTeam:n}=M(),{t}=L(),[a,i]=S.useState([]),[x,g]=S.useState(!1),[p,v]=S.useState(null),[j,T]=S.useState(!1),C=Z(h.find(R=>R.name===f)),I=Ge(f),D=async R=>{if(!j)try{T(!0),await l.deleteRole({input:{teamDid:m,name:R}}),d()}catch(b){F.error(b.message)}finally{T(!1),v(null)}},N=async(R,b)=>{const z=(await l.getPermissionsByRole({input:{teamDid:R,role:{name:b}}})).permissions||[],O=s.map(ae=>({...ae,bind:z.some(lt=>lt.name===ae.name)}));i(O)},k=async()=>{T(!0);const R=a.filter(b=>b.bind).map(b=>b.name);try{await l.updatePermissionsForRole({input:{teamDid:m,roleName:C.name,grantNames:R}}),F.success(t("common.saveSuccess")),o()}catch(b){F.error(se(b))}finally{T(!1)}};S.useEffect(()=>{m&&f&&N(m,f)},[m,f]);const B=n||!u;let K=null;return n&&(K=e.jsxs("div",{className:"bind",children:[e.jsx("div",{className:"title",children:t("common.permission")}),e.jsx("div",{className:"list",children:a.filter(R=>B?R.bind:!0).map(R=>e.jsx("div",{className:"item",children:e.jsx(xt,{control:e.jsx(gt,{disabled:B,checked:R.bind,onChange:()=>{i(b=>b.map(P=>(P.name===R.name&&(P.bind=!P.bind),P)))},name:R.name}),label:R.description})}))})]})),e.jsxs(U,{title:t("common.passport"),onClose:c,open:!0,fullWidth:!0,toolbar:u&&!I&&e.jsxs(e.Fragment,{children:[e.jsx(q,{onClick:()=>g(C),"data-cy":`edit-passport-${C.name}`,size:"large",children:e.jsx(le,{fill:"#bfbfbf"})}),e.jsx(q,{onClick:()=>v({title:t("team.passport.delete.title"),description:t("team.passport.delete.description",{name:C.title}),confirm:t("common.delConfirm"),cancel:t("common.cancel"),onConfirm:()=>{D(C.name)},onCancel:()=>{T(!1),v(null)}}),"data-cy":`delete-passport-${C.name}`,size:"large",children:e.jsx(Q,{"data-cy":"close-passport-dialog",fill:"#bfbfbf"})})]}),actions:n&&!B&&e.jsxs(e.Fragment,{children:[e.jsx(_,{onClick:c,color:"inherit",children:t("common.cancel")}),e.jsxs(_,{onClick:k,color:"primary",disabled:j||!C,variant:"contained",autoFocus:!0,"data-cy":"bind-permission-btn-confirm",children:[j&&e.jsx($,{size:16}),t("common.save")]})]}),children:[e.jsxs(js,{children:[!C&&e.jsx(vs,{children:e.jsx($,{})}),C&&e.jsxs("div",{className:"dialog-content",children:[e.jsxs("div",{className:"header",children:[e.jsx("div",{className:"title",children:C.title}),e.jsx("div",{className:"description",style:{marginTop:n?16:48},children:C.description})]}),K]})]}),x&&e.jsx(ue,{teamDid:m,onCancel:()=>g(null),onSuccess:()=>{g(null),r()},mode:"update",roleName:x.name,item:x}),p&&e.jsx(Se,{title:p.title,description:p.description,confirm:p.confirm,cancel:p.cancel,params:p.params,onConfirm:p.onConfirm,onCancel:p.onCancel})]})}const xs=V(me,"mutate_team"),gs=V(me,"",J);function ys(c){const{inService:o}=A();return o?e.jsx(gs,{...c}):e.jsx(xs,{...c})}me.propTypes={roleName:w.string.isRequired,onCancel:w.func.isRequired,onSuccess:w.func.isRequired,onDelete:w.func.isRequired,hasPermission:w.bool};me.defaultProps={hasPermission:!1};const js=H.div`
|
|
135
|
+
*/var us=function(c){return c!=null&&(ot(c)||ms(c)||!!c._isBuffer)};function ot(c){return!!c.constructor&&typeof c.constructor.isBuffer=="function"&&c.constructor.isBuffer(c)}function ms(c){return typeof c.readFloatLE=="function"&&typeof c.slice=="function"&&ot(c.slice(0,0))}(function(){var c=ps,o=Le.utf8,d=us,f=Le.bin,u=function(l,h){l.constructor==String?h&&h.encoding==="binary"?l=f.stringToBytes(l):l=o.stringToBytes(l):d(l)?l=Array.prototype.slice.call(l,0):!Array.isArray(l)&&l.constructor!==Uint8Array&&(l=l.toString());for(var s=c.bytesToWords(l),m=l.length*8,r=1732584193,n=-271733879,t=-1732584194,a=271733878,i=0;i<s.length;i++)s[i]=(s[i]<<8|s[i]>>>24)&16711935|(s[i]<<24|s[i]>>>8)&4278255360;s[m>>>5]|=128<<m%32,s[(m+64>>>9<<4)+14]=m;for(var x=u._ff,g=u._gg,p=u._hh,v=u._ii,i=0;i<s.length;i+=16){var j=r,T=n,C=t,I=a;r=x(r,n,t,a,s[i+0],7,-680876936),a=x(a,r,n,t,s[i+1],12,-389564586),t=x(t,a,r,n,s[i+2],17,606105819),n=x(n,t,a,r,s[i+3],22,-1044525330),r=x(r,n,t,a,s[i+4],7,-176418897),a=x(a,r,n,t,s[i+5],12,1200080426),t=x(t,a,r,n,s[i+6],17,-1473231341),n=x(n,t,a,r,s[i+7],22,-45705983),r=x(r,n,t,a,s[i+8],7,1770035416),a=x(a,r,n,t,s[i+9],12,-1958414417),t=x(t,a,r,n,s[i+10],17,-42063),n=x(n,t,a,r,s[i+11],22,-1990404162),r=x(r,n,t,a,s[i+12],7,1804603682),a=x(a,r,n,t,s[i+13],12,-40341101),t=x(t,a,r,n,s[i+14],17,-1502002290),n=x(n,t,a,r,s[i+15],22,1236535329),r=g(r,n,t,a,s[i+1],5,-165796510),a=g(a,r,n,t,s[i+6],9,-1069501632),t=g(t,a,r,n,s[i+11],14,643717713),n=g(n,t,a,r,s[i+0],20,-373897302),r=g(r,n,t,a,s[i+5],5,-701558691),a=g(a,r,n,t,s[i+10],9,38016083),t=g(t,a,r,n,s[i+15],14,-660478335),n=g(n,t,a,r,s[i+4],20,-405537848),r=g(r,n,t,a,s[i+9],5,568446438),a=g(a,r,n,t,s[i+14],9,-1019803690),t=g(t,a,r,n,s[i+3],14,-187363961),n=g(n,t,a,r,s[i+8],20,1163531501),r=g(r,n,t,a,s[i+13],5,-1444681467),a=g(a,r,n,t,s[i+2],9,-51403784),t=g(t,a,r,n,s[i+7],14,1735328473),n=g(n,t,a,r,s[i+12],20,-1926607734),r=p(r,n,t,a,s[i+5],4,-378558),a=p(a,r,n,t,s[i+8],11,-2022574463),t=p(t,a,r,n,s[i+11],16,1839030562),n=p(n,t,a,r,s[i+14],23,-35309556),r=p(r,n,t,a,s[i+1],4,-1530992060),a=p(a,r,n,t,s[i+4],11,1272893353),t=p(t,a,r,n,s[i+7],16,-155497632),n=p(n,t,a,r,s[i+10],23,-1094730640),r=p(r,n,t,a,s[i+13],4,681279174),a=p(a,r,n,t,s[i+0],11,-358537222),t=p(t,a,r,n,s[i+3],16,-722521979),n=p(n,t,a,r,s[i+6],23,76029189),r=p(r,n,t,a,s[i+9],4,-640364487),a=p(a,r,n,t,s[i+12],11,-421815835),t=p(t,a,r,n,s[i+15],16,530742520),n=p(n,t,a,r,s[i+2],23,-995338651),r=v(r,n,t,a,s[i+0],6,-198630844),a=v(a,r,n,t,s[i+7],10,1126891415),t=v(t,a,r,n,s[i+14],15,-1416354905),n=v(n,t,a,r,s[i+5],21,-57434055),r=v(r,n,t,a,s[i+12],6,1700485571),a=v(a,r,n,t,s[i+3],10,-1894986606),t=v(t,a,r,n,s[i+10],15,-1051523),n=v(n,t,a,r,s[i+1],21,-2054922799),r=v(r,n,t,a,s[i+8],6,1873313359),a=v(a,r,n,t,s[i+15],10,-30611744),t=v(t,a,r,n,s[i+6],15,-1560198380),n=v(n,t,a,r,s[i+13],21,1309151649),r=v(r,n,t,a,s[i+4],6,-145523070),a=v(a,r,n,t,s[i+11],10,-1120210379),t=v(t,a,r,n,s[i+2],15,718787259),n=v(n,t,a,r,s[i+9],21,-343485551),r=r+j>>>0,n=n+T>>>0,t=t+C>>>0,a=a+I>>>0}return c.endian([r,n,t,a])};u._ff=function(l,h,s,m,r,n,t){var a=l+(h&s|~h&m)+(r>>>0)+t;return(a<<n|a>>>32-n)+h},u._gg=function(l,h,s,m,r,n,t){var a=l+(h&m|s&~m)+(r>>>0)+t;return(a<<n|a>>>32-n)+h},u._hh=function(l,h,s,m,r,n,t){var a=l+(h^s^m)+(r>>>0)+t;return(a<<n|a>>>32-n)+h},u._ii=function(l,h,s,m,r,n,t){var a=l+(s^(h|~m))+(r>>>0)+t;return(a<<n|a>>>32-n)+h},u._blocksize=16,u._digestsize=16,at.exports=function(l,h){if(l==null)throw new Error("Illegal argument "+l);var s=c.wordsToBytes(u(l,h));return h&&h.asBytes?s:h&&h.asString?f.bytesToString(s):c.bytesToHex(s)}})();var fs=at.exports;const hs=Ee(fs);function ue({teamDid:c,onCancel:o,onSuccess:d,onError:f,mode:u,item:l}){var D,N;const{api:h}=F(),[s,m]=S.useState(!1),[r,n]=S.useState(""),{t}=L(),[a,i]=S.useState(l.title||""),[x,g]=S.useState(l.description||""),[p,v]=S.useState(((D=l==null?void 0:l.extra)==null?void 0:D.display)||"builtin"),[j,T]=S.useState((N=l==null?void 0:l.extra)!=null&&N.types?l.extra.types.join(","):""),C=async()=>{const k=a.trim();if(!k){n(t("team.passport.error.titleEmpty"));return}if(k.length>64){n(t("team.passport.error.titleTooLong",{length:64}));return}const B=x.replace(/\n/g," ");if(!B){n(t("team.passport.error.descriptionEmpty"));return}const K=u==="create"?hs(k):l.name;n(null),m(!0);try{if(u==="create"){const R={teamDid:c,name:K,title:k,description:B};p==="custom"&&(R.extra=JSON.stringify({display:"custom",types:j.split(",")})),await h.createRole({input:R})}else{const R={teamDid:c,role:{name:K,title:k,description:B}};await h.updateRole({input:R})}d()}catch(R){const b=se(R);n(b),f(R)}finally{m(!1)}},I=e.jsxs("div",{children:[u==="update"&&e.jsx(E,{component:"div",style:{paddingTop:16},children:e.jsx(W,{label:"ID",autoComplete:"off",variant:"outlined",name:"url","data-cy":"mutate-role-input-name",fullWidth:!0,autoFocus:!0,value:l.name,disabled:!0})}),e.jsx(E,{component:"div",style:{marginTop:16},children:e.jsx(W,{label:t("common.title"),autoComplete:"off",variant:"outlined",name:"title","data-cy":"mutate-role-input-title",fullWidth:!0,autoFocus:!0,value:a,onChange:k=>{n(null),i(k.target.value)},disabled:u==="update"||s,helperText:t("team.passport.create.titleTip")})}),e.jsx(E,{component:"div",style:{marginTop:16,marginBottom:16},children:e.jsx(W,{label:t("common.description"),autoComplete:"off",variant:"outlined",name:"description","data-cy":"mutate-role-input-description",fullWidth:!0,autoFocus:!0,value:x,onChange:k=>{n(null),g(k.target.value)},disabled:s,multiline:!0,rows:3})}),u==="create"&&e.jsxs("div",{style:{marginBottom:16},children:[e.jsx(Me,{children:t("common.display")}),e.jsxs(Oe,{color:"primary",size:"small",value:p,exclusive:!0,style:{marginTop:16},disabled:s,onChange:(k,B)=>v(B),"data-cy":"input-role-display",children:[e.jsx(ee,{value:"builtin","data-cy":"input-role-display-builtin",children:e.jsx(E,{children:t("team.passport.displayBuiltin")})}),e.jsx(ee,{value:"custom","data-cy":"input-role-display-custom",children:e.jsx(E,{children:t("team.passport.displayCustom")})})]}),p==="custom"&&e.jsxs(e.Fragment,{children:[e.jsx(We,{fullWidth:!0,type:"text",style:{marginTop:16},"data-cy":"input-role-types",value:j,disabled:s,onChange:k=>{T(k.target.value)}}),e.jsx(qe,{children:t("team.passport.typesTip")})]})]})]});return e.jsxs(U,{title:u==="create"?t("team.passport.create.title"):"",fullWidth:!0,open:!0,onClose:o,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[e.jsx(_,{onClick:o,color:"inherit",children:t("common.cancel")}),e.jsxs(_,{"data-cy":"mutate-role-confirm",onClick:C,color:"primary",disabled:s,variant:"contained",autoFocus:!0,children:[s&&e.jsx($,{size:16}),t(u==="create"?"common.create":"common.update")]})]}),children:[e.jsx(xt,{component:"div",children:I}),!!r&&e.jsx($e,{severity:"error",variant:"icon",style:{width:"100%",margin:0},children:r})]})}ue.propTypes={teamDid:w.string.isRequired,onCancel:w.func.isRequired,onSuccess:w.func.isRequired,onError:w.func,mode:w.oneOf(["create","update"]),item:w.object};ue.defaultProps={onError:()=>{},mode:"create",item:{}};function me({onCancel:c,onSuccess:o,onDelete:d,roleName:f,hasPermission:u}){const{api:l}=F(),{roles:h,permissions:s,teamDid:m,refresh:r,isNodeTeam:n}=M(),{t}=L(),[a,i]=S.useState([]),[x,g]=S.useState(!1),[p,v]=S.useState(null),[j,T]=S.useState(!1),C=Z(h.find(R=>R.name===f)),I=Ve(f),D=async R=>{if(!j)try{T(!0),await l.deleteRole({input:{teamDid:m,name:R}}),d()}catch(b){A.error(b.message)}finally{T(!1),v(null)}},N=async(R,b)=>{const z=(await l.getPermissionsByRole({input:{teamDid:R,role:{name:b}}})).permissions||[],O=s.map(ae=>({...ae,bind:z.some(ct=>ct.name===ae.name)}));i(O)},k=async()=>{T(!0);const R=a.filter(b=>b.bind).map(b=>b.name);try{await l.updatePermissionsForRole({input:{teamDid:m,roleName:C.name,grantNames:R}}),A.success(t("common.saveSuccess")),o()}catch(b){A.error(se(b))}finally{T(!1)}};S.useEffect(()=>{m&&f&&N(m,f)},[m,f]);const B=n||!u;let K=null;return n&&(K=e.jsxs("div",{className:"bind",children:[e.jsx("div",{className:"title",children:t("common.permission")}),e.jsx("div",{className:"list",children:a.filter(R=>B?R.bind:!0).map(R=>e.jsx("div",{className:"item",children:e.jsx(gt,{control:e.jsx(yt,{disabled:B,checked:R.bind,onChange:()=>{i(b=>b.map(P=>(P.name===R.name&&(P.bind=!P.bind),P)))},name:R.name}),label:R.description})}))})]})),e.jsxs(U,{title:t("common.passport"),onClose:c,open:!0,fullWidth:!0,toolbar:u&&!I&&e.jsxs(e.Fragment,{children:[e.jsx(q,{onClick:()=>g(C),"data-cy":`edit-passport-${C.name}`,size:"large",children:e.jsx(le,{fill:"#bfbfbf"})}),e.jsx(q,{onClick:()=>v({title:t("team.passport.delete.title"),description:t("team.passport.delete.description",{name:C.title}),confirm:t("common.delConfirm"),cancel:t("common.cancel"),onConfirm:()=>{D(C.name)},onCancel:()=>{T(!1),v(null)}}),"data-cy":`delete-passport-${C.name}`,size:"large",children:e.jsx(Q,{"data-cy":"close-passport-dialog",fill:"#bfbfbf"})})]}),actions:n&&!B&&e.jsxs(e.Fragment,{children:[e.jsx(_,{onClick:c,color:"inherit",children:t("common.cancel")}),e.jsxs(_,{onClick:k,color:"primary",disabled:j||!C,variant:"contained",autoFocus:!0,"data-cy":"bind-permission-btn-confirm",children:[j&&e.jsx($,{size:16}),t("common.save")]})]}),children:[e.jsxs(js,{children:[!C&&e.jsx(vs,{children:e.jsx($,{})}),C&&e.jsxs("div",{className:"dialog-content",children:[e.jsxs("div",{className:"header",children:[e.jsx("div",{className:"title",children:C.title}),e.jsx("div",{className:"description",style:{marginTop:n?16:48},children:C.description})]}),K]})]}),x&&e.jsx(ue,{teamDid:m,onCancel:()=>g(null),onSuccess:()=>{g(null),r()},mode:"update",roleName:x.name,item:x}),p&&e.jsx(Se,{title:p.title,description:p.description,confirm:p.confirm,cancel:p.cancel,params:p.params,onConfirm:p.onConfirm,onCancel:p.onCancel})]})}const xs=V(me,"mutate_team"),gs=V(me,"",J);function ys(c){const{inService:o}=F();return o?e.jsx(gs,{...c}):e.jsx(xs,{...c})}me.propTypes={roleName:w.string.isRequired,onCancel:w.func.isRequired,onSuccess:w.func.isRequired,onDelete:w.func.isRequired,hasPermission:w.bool};me.defaultProps={hasPermission:!1};const js=H.div`
|
|
136
136
|
.header {
|
|
137
137
|
.title {
|
|
138
138
|
font-weight: 400;
|
|
@@ -181,7 +181,7 @@ import{r as S,g as Ee,b as ct}from"./vendor-react-DEoibe3W.js";import{a as dt,l
|
|
|
181
181
|
justify-content: center;
|
|
182
182
|
align-items: center;
|
|
183
183
|
height: 200px;
|
|
184
|
-
`,Be=S.memo(({field:c,value:o,copyable:d})=>{const{local:f}=L();return o?e.jsxs(y,{display:"flex",alignItems:"center",gap:1,onClick:u=>u.stopPropagation(),children:[c?e.jsxs(
|
|
184
|
+
`,Be=S.memo(({field:c,value:o,copyable:d})=>{const{local:f}=L();return o?e.jsxs(y,{display:"flex",alignItems:"center",gap:1,onClick:u=>u.stopPropagation(),children:[c?e.jsxs(Ae,{variant:"subtitle1",color:"textSecondary",sx:{width:50,textAlign:"right"},children:[c,":"]}):null,e.jsx(Ae,{variant:"body1",children:e.jsxs(y,{display:"flex",alignItems:"center",children:[e.jsx(Y,{title:o,children:e.jsx("span",{className:"value-ellipsis",children:o})}),d?e.jsx(It,{content:Wt(o),locale:f,style:{marginLeft:"4px",color:"#999",fontSize:"0.8em",verticalAlign:"bottom"}}):null]})})]}):null});function De({createPassportSvg:c}){const{inService:o}=F(),{roles:d,teamIssuerDid:f,teamName:u,refresh:l,passportColor:h,teamDid:s,isNodeTeam:m}=M(),{t:r}=L(),[n,t]=S.useState(!1),[a,i]=S.useState(!1),x=jt(p=>p.breakpoints.down("md")),g=S.useCallback(p=>p&&!G.ROLES[p.toUpperCase()],[]);return e.jsxs(bs,{sx:{mt:0},children:[e.jsx(y,{display:"flex",justifyContent:"flex-end",children:!m&&e.jsxs(vt,{variant:"contained",edge:"end",color:"primary","data-cy":"create-role",onClick:()=>t(!0),children:[e.jsx(ye,{style:{fontSize:16,marginRight:4}}),r("team.passport.create.title")]})}),e.jsx(y,{className:"list",children:d.map(p=>e.jsxs(y,{"data-cy":`passport-${p.name}`,sx:{display:"flex",justifyContent:"space-between"},className:"item",display:"flex",alignItems:"center",onClick:()=>i(p),children:[e.jsxs(y,{display:"flex",alignItems:"center",children:[e.jsx("div",{style:{width:150},dangerouslySetInnerHTML:{__html:c({title:p.title,issuer:u,issuerDid:f,ownerName:"Your Name",ownerDid:f,preferredColor:h,width:"150px"})}}),e.jsxs(y,{ml:3,className:"title",children:[e.jsx(Be,{value:p.title}),g(p.name)?e.jsx(Be,{value:p.name,copyable:!0}):null]})]}),!x&&e.jsx(y,{className:"description",children:p.description}),e.jsx(Ze,{permission:o?"":"mutate_team",role:o?J:[],children:e.jsx("div",{className:"action",children:Ve(p.name)?e.jsx(Ht,{}):e.jsx(le,{})})})]},p.name))}),a&&e.jsx(ys,{onCancel:()=>i(!1),onSuccess:()=>{i(!1),l()},onDelete:()=>{i(!1),l()},mode:"update",roleName:a.name,item:a}),n&&e.jsx(ue,{teamDid:s,onCancel:()=>t(!1),onSuccess:()=>{t(!1),l()}})]})}const bs=H(y)`
|
|
185
185
|
.list {
|
|
186
186
|
.item {
|
|
187
187
|
padding: 12px;
|
|
@@ -219,7 +219,7 @@ import{r as S,g as Ee,b as ct}from"./vendor-react-DEoibe3W.js";import{a as dt,l
|
|
|
219
219
|
fill: ${({theme:c})=>c.palette.text.secondary};
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
|
-
`;De.propTypes={createPassportSvg:w.func.isRequired};De.defaultProps={};function ke({createPassportSvg:c}){const{t:o}=L(),{api:d,inService:f}=
|
|
222
|
+
`;De.propTypes={createPassportSvg:w.func.isRequired};De.defaultProps={};function ke({createPassportSvg:c}){const{t:o}=L(),{api:d,inService:f}=F(),{teamDid:u,refresh:l,enablePassportIssuance:h,isNodeTeam:s}=M(),[m,r]=S.useState(!1),[n,t]=S.useState(!1),[a,i]=S.useState(!1),[x,g]=S.useState(!1),[p,v]=S.useState(!1),j=async T=>{if(T.stopPropagation(),!x){g(!0);try{await d.configPassportIssuance({input:{teamDid:u,enable:!h}}),l(),await re(800),A.success(o("common.configSuccess"))}catch(C){A.error(C.message)}finally{g(!1)}}};return e.jsxs(y,{display:"flex",alignItems:"center",gap:1,sx:{ml:1},children:[e.jsx(Ze,{permission:f?"":"mutate_team",role:f?J:[],children:e.jsx(X,{variant:"outlined",menuButtonProps:{"data-cy":"trusted-issuers-more"},menu:e.jsxs(e.Fragment,{children:[e.jsx(X.Item,{onClick:()=>t(!0),"data-cy":"config-trusted-issuers",children:e.jsxs(y,{children:[o("team.passport.trustedPassportIssuers"),e.jsx(y,{fontSize:12,color:"#888",children:o("team.passport.trustedPassportIssuersTip")})]})}),e.jsx(X.Item,{onClick:()=>i(!0),"data-cy":"config-show-trusted-factories",children:e.jsxs(y,{children:[o("team.passport.configFactories"),e.jsx(y,{fontSize:12,color:"#888",children:o("team.passport.configFactoriesTip")})]})}),e.jsx(X.Item,{"data-cy":"config-show-issue-passport",onClick:j,children:e.jsxs(y,{display:"flex",alignItems:"center",children:[x&&e.jsx($,{size:16,style:{marginRight:8}}),e.jsxs(y,{children:[o(h?"team.passport.disableIssuance":"team.passport.enableIssuance"),e.jsx(y,{fontSize:12,color:"#888",children:o(h?"team.passport.disableIssuanceTip":"team.passport.enableIssuanceTip")})]})]})}),!s&&e.jsx(X.Item,{onClick:()=>r(!0),"data-cy":"config-passport-color",children:e.jsxs(y,{children:[o("team.passport.configColor"),e.jsx(y,{fontSize:12,color:"#888",children:o("team.passport.configColorTip")})]})})]}),children:()=>e.jsx(_,{variant:"outlined",onClick:()=>{v(!0)},children:o("team.passport.view")})})}),n&&e.jsx(rs,{onCancel:()=>t(!1)}),a&&e.jsx(cs,{onCancel:()=>i(!1)}),m&&e.jsx(Yt,{onCancel:()=>r(!1),onSuccess:()=>r(!1)}),p&&e.jsx(U,{open:!0,maxWidth:"lg",onClose:()=>v(!1),onBackdropClick:()=>v(!1),onEscapeKeyDown:()=>v(!1),title:o("team.passport.view"),children:e.jsx(De,{createPassportSvg:c,onCancel:()=>v(!1)})})]})}ke.propTypes={createPassportSvg:w.func.isRequired};ke.defaultProps={};const ze="$all",_e="",it=dt.memo(({createPassportSvg:c,passport:o,teamDid:d,inService:f})=>{var u,l,h,s;return e.jsx(y,{sx:{display:"flex"},dangerouslySetInnerHTML:{__html:c({scope:o.scope,role:o.role,title:o.scope==="kyc"?o.name:o.title,issuer:o.issuer&&o.issuer.name,issuerDid:o.issuer&&o.issuer.id,ownerName:(u=o.user)==null?void 0:u.fullName,ownerDid:(l=o.user)==null?void 0:l.did,ownerAvatarUrl:(h=o.user)!=null&&h.avatar?Ye((s=o.user)==null?void 0:s.avatar,d,f):"",revoked:o.revoked,width:"36px",extra:o!=null&&o.expirationDate?{key:"Exp",value:Ge(o.expirationDate).format("YYYY-MM-DD HH:mm:ss")}:null})}})});it.propTypes={passport:w.object.isRequired,createPassportSvg:w.func.isRequired,teamDid:w.string.isRequired,inService:w.bool.isRequired};function lt({createPassportSvg:c}){const{api:o}=F(),{teamDid:d}=M(),{t:f,locale:u}=L(),{SYSTEM_ROLES:l}=_t(),{inService:h}=F(),[s,m]=S.useState(!1),r=`passports-${d}`,n=Rt(r),[t,a]=S.useState({role:ze,status:_e,searchText:n.searchText||"",pageSize:n.rowsPerPage||10,page:n.page?n.page+1:1}),{data:i,loading:x}=ne(async()=>(await o.getPassportRoleCounts({input:{teamDid:d}})).counts||[],{refreshDeps:[d]}),{data:g,loading:p}=ne(async()=>{const b={};t.role!==ze&&(b.role=t.role),t.status&&(b.status=t.status);const P=await o.getPassportsByRole({input:{teamDid:d,query:b,paging:{page:t.page,pageSize:t.pageSize}}});return{passports:P.passports||[],total:P.paging.total}},{refreshDeps:[t.role,t.status,t.page,t.pageSize],onError:b=>A.error(b.message)}),v=b=>{const P=i==null?void 0:i.find(z=>z.key===b);return(P==null?void 0:P.value)||0},j=S.useMemo(()=>Object.keys(l).map(b=>({name:b,title:l[b],num:v(b)})),[i,v]),T=S.useMemo(()=>[{label:f("team.passport.role"),name:"role",options:{customBodyRender:(b,{rowIndex:P})=>{const z=g==null?void 0:g.passports[P];return e.jsxs(y,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(it,{createPassportSvg:c,passport:z,teamDid:d}),e.jsx(y,{children:ve(z.title)})]})}}},{label:f("team.passport.owner"),name:"user",options:{customBodyRender:b=>Ce(b,h)}},{label:f("team.passport.status"),name:"status",options:{customBodyRender:be}},{label:f("team.member.lastLogin"),name:"lastLoginAt",options:{customBodyRender:b=>Ke(b,u)}},{label:f("common.address"),name:"id",options:{customBodyRender:Et}},{label:f("blocklet.overview.source"),name:"source",options:{customBodyRender:(b,{rowIndex:P})=>{const z=g==null?void 0:g.passports[P];return z.parentDid?ie("recover"):ie(z.source)}}}],[f,u,g==null?void 0:g.passports,d,c,h]),C=b=>{a(P=>({...P,role:b,page:1}))},I=({page:b,rowsPerPage:P,searchText:z})=>{t.pageSize!==P?a(O=>({...O,searchText:"",pageSize:P,page:1})):t.page!==b+1?a(O=>({...O,searchText:"",page:b+1})):t.searchText!==z&&a(O=>({...O,searchText:z,page:1}))},D=S.useRef(null),N=(g==null?void 0:g.passports)||[],k=t.searchText?N.filter(b=>{var P;return b.id.includes(t.searchText)||(((P=b==null?void 0:b.user)==null?void 0:P.fullName)||"").includes(t.searchText)}):N,B={sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,onRowClick(b,{dataIndex:P},z){var O;if((O=D.current)!=null&&O.contains(z.target)){const ae=g==null?void 0:g.passports[P];m(ae)}},page:t.page-1,rowsPerPage:t.pageSize,count:(g==null?void 0:g.total)||0,searchDebounceTime:600},K=b=>{a(P=>({...P,status:b.target.value,page:1}))},R=e.jsxs(y,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsxs(y,{sx:{fontSize:16,fontWeight:400},children:[f("team.passport.status"),":"]}),e.jsxs(bt,{size:"small",value:t.status,onChange:K,displayEmpty:!0,sx:{minWidth:120,height:36,".MuiSelect-select":{py:.5,px:1.5}},children:[e.jsx(oe,{value:_e,children:f("common.all")}),Object.values(G.PASSPORT_STATUS).map(b=>e.jsx(oe,{value:b,sx:{py:1},children:f(`team.passport.statusMap.${b}`)},b))]})]});return x?e.jsx(y,{py:2,children:e.jsx(te,{direction:"row",justifyContent:"center",alignItems:"center",spacing:1,sx:{position:"relative",pb:2},children:e.jsx($,{})})}):e.jsxs(Cs,{children:[e.jsxs(y,{className:"main",display:"flex",sx:{mt:0,gap:3},children:[e.jsx(y,{className:"left",children:e.jsx(y,{className:"tabs",children:j.map(b=>e.jsxs(y,{className:`tab ${t.role===b.name?"active":""}`,onClick:()=>C(b.name),children:[e.jsx("span",{className:"text",children:b.title}),e.jsx(y,{sx:{color:"text.secondary"},children:b.num})]},b.name))})}),e.jsx(y,{ref:D,className:"right",children:e.jsx(xe,{className:"main-table",verticalKeyWidth:100,locale:u,durable:r,durableKeys:["page","rowsPerPage"],data:k,columns:T,options:B,loading:p,onChange:I,customButtons:[e.jsx(ke,{createPassportSvg:c})],title:R})})]}),s&&e.jsx(Te,{createPassportSvg:c,onCancel:()=>m(null),passport:s,onSwitchPassport:m})]})}lt.propTypes={createPassportSvg:w.func.isRequired};lt.defaultProps={};const Cs=Ct(y)`
|
|
223
223
|
.main {
|
|
224
224
|
.left {
|
|
225
225
|
width: 256px;
|
|
@@ -289,4 +289,4 @@ import{r as S,g as Ee,b as ct}from"./vendor-react-DEoibe3W.js";import{a as dt,l
|
|
|
289
289
|
overflow: auto;
|
|
290
290
|
}
|
|
291
291
|
}
|
|
292
|
-
`;export{
|
|
292
|
+
`;export{lt as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{j as e,H as h,ah as Je,T as C,ab as A,e as Ze,cD as Z,ae as G,cE as Ge,aa as j,al as W,s as ge,ad as Se,ap as et,cF as ze,a9 as ye,q,
|
|
2
|
-
`)},backgroundColor:n.palette.background.paper,borderColor:n.palette.divider,textStyle:{color:n.palette.text.primary,fontSize:14},extraCssText:`box-shadow: ${n.shadows[2]}; border-radius: 4px;`,padding:[8,10]},visualMap:{show:!1,min:-12,max:12,pieces:[{min:Number.MIN_SAFE_INTEGER,max:-9,color:Z[600]},{min:-9,max:-6,color:Z[500]},{min:-6,max:-3,color:Z[400]},{min:-3,max:-1,color:Z[300]},{min:0,max:0,color:n.palette.grey[200]},{min:1,max:3,color:G[300]},{min:3,max:6,color:G[400]},{min:6,max:9,color:G[500]},{min:9,max:Number.MAX_SAFE_INTEGER,color:G[600]}],orient:"horizontal",left:"center",bottom:12,itemWidth:12,itemHeight:12,textStyle:{color:n.palette.text.secondary,fontSize:12}},calendar:{top:30,left:50,right:10,bottom:4,cellSize:[8,8],splitLine:{show:!1},itemStyle:{borderWidth:2,borderColor:n.palette.background.default,color:n.palette.background.default},dayLabel:{show:!0,firstDay:0,nameMap:["","Mon","","Wed","","Fri",""],position:"start",margin:4,fontSize:10,color:n.palette.text.primary,fontWeight:"400",width:20},monthLabel:{show:!0,nameMap:"cn",align:"left",color:n.palette.text.primary,fontWeight:"400",fontSize:12,position:"start",margin:4,width:30,padding:[0,2]},yearLabel:{show:!1},range:[w().subtract(11,"month").startOf("month").format("YYYY-MM-DD"),w().endOf("month").format("YYYY-MM-DD")],orient:"horizontal"},series:{type:"heatmap",coordinateSystem:"calendar",data:d.map(b=>[b.date,b.errorCount?-b.errorCount:b.successCount]),label:{show:!1},itemStyle:{borderWidth:2,borderColor:n.palette.background.default,borderRadius:4},emphasis:{itemStyle:{borderWidth:2,borderColor:Ge[200],color:"inherit"}}}}),[d,t,n]);return e.jsxs(e.Fragment,{children:[e.jsx(j,{ref:i,sx:{maxWidth:"1280px",border:"1px solid",borderColor:"divider",padding:"8px",overflowX:"auto"},children:e.jsx(j,{sx:{width:"1200px",height:"180px",position:"relative"},children:e.jsx(Lt,{option:u,style:{height:"100%",width:"100%"},notMerge:!0,lazyUpdate:!1,opts:{renderer:"canvas"},onEvents:{click:c=>{c.componentType==="series"&&c.data&&a(c.data[0])}}})})}),e.jsx(j,{display:"flex",justifyContent:"flex-end",mt:1,mr:s?2:5,mb:2,children:e.jsxs(W,{direction:s?"column":"row",spacing:s?2:1,width:"100%",justifyContent:"flex-start",alignItems:s?"flex-start":"center",children:[e.jsxs(W,{direction:"row",alignItems:"center",spacing:1,children:[e.jsx(j,{width:32,height:12,borderRadius:.5,sx:{background:"linear-gradient(90deg, #8B5000 0%, #A36200 33%, #C17700 66%, #E29000 100%)"}}),e.jsx(C,{variant:"body2",color:"text.secondary",children:t("storage.spaces.backup.failed")})]}),e.jsxs(W,{direction:"row",alignItems:"center",spacing:1,children:[e.jsx(j,{width:32,height:12,borderRadius:.5,bgcolor:"grey.200",border:"1px solid",borderColor:"grey.200"}),e.jsx(C,{variant:"body2",color:"text.secondary",children:t("storage.spaces.backup.without")})]}),e.jsxs(W,{direction:"row",alignItems:"center",spacing:1,children:[e.jsx(j,{width:32,height:12,borderRadius:.5,sx:{background:"linear-gradient(90deg, #9be9a8 0%, #40c463 33%, #30a14e 66%, #216e39 100%)"}}),e.jsx(C,{variant:"body2",color:"text.secondary",children:t("storage.spaces.backup.succeeded")})]})]})})]})}Ce.propTypes={};const Ht=ge(({className:t,...r})=>e.jsx(Se,{...r,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function ke({status:t,message:r,createdAt:o}){const{t:s}=T(),i=t===R.BACKUPS.STATUS.PROGRESS&&w().diff(o,"hours")>=R.BACKUPS.TIMEOUT_HOURS,n=i&&s("common.timeoutError"),a=t===R.BACKUPS.STATUS.PROGRESS&&!i,d=t===R.BACKUPS.STATUS.SUCCEEDED&&!i;return a?e.jsxs(C,{display:"inline-flex",alignItems:"center",fontSize:"14px",children:[e.jsx(A,{sx:{marginRight:"4px"},size:"12px"}),s("common.progress")]}):d?e.jsx(V,{type:"success",children:s("common.succeeded")}):e.jsxs(j,{display:"inline-flex",alignItems:"center",children:[e.jsx(V,{type:"error",children:s("common.failed")})," ",e.jsx(Se,{style:{display:"flex",alignItems:"center",flexShrink:0},title:r||n,children:e.jsx(ze,{children:e.jsx(it,{style:{width:"24px",height:"24px"},color:"error"})})})]})}ke.propTypes={status:h.string.isRequired,message:h.string,createdAt:h.string.isRequired};ke.defaultProps={message:""};function De({metadata:t}){const{t:r}=T();if(Q(t))return e.jsx(V,{type:"success",children:r("common.succeeded")});const o=t.count||0,s=t.size||0,i=ct(s,{iec:!0}),n=e.jsxs(j,{p:1,sx:{color:"black",backgroundColor:"white"},borderRadius:1,boxShadow:2,children:[e.jsxs(C,{variant:"body2",children:[r("common.fileCount"),": ",o]}),e.jsxs(C,{variant:"body2",children:[r("common.fileSize"),": ",i]})]});return e.jsxs(j,{display:"inline-flex",alignItems:"center",children:[e.jsx(V,{type:"success",children:r("common.succeeded")})," ",e.jsx(Ht,{title:n,style:{display:"flex",alignItems:"center",flexShrink:0},placement:"left",children:e.jsx(ze,{children:e.jsx(lt,{style:{width:"24px",height:"24px"},color:"primary"})})})]})}De.propTypes={metadata:h.object};De.defaultProps={metadata:{}};function Be(){const{t,locale:r}=T(),{spaceGateways:o,backups:s,backupsLoading:i}=L(),n=y.useMemo(()=>[{label:"DID Space",name:"target",options:{customBodyRenderLite:d=>{var D;const{targetUrl:u,targetName:c,status:x,createdAt:p}=s[d],g=x===R.BACKUPS.STATUS.PROGRESS&&w().diff(p,"hours")>=R.BACKUPS.TIMEOUT_HOURS,f=x===R.BACKUPS.STATUS.SUCCEEDED&&!g,b=c||((D=o.find(S=>u==null?void 0:u.includes(xe(S==null?void 0:S.endpoint))))==null?void 0:D.name)||"Unknown DID Space";return f?e.jsx(et,{fontSize:"16px",href:u,target:"_blank",children:b}):e.jsx(C,{variant:"body1",fontSize:"16px",children:b})}}},{label:t("common.strategy"),name:"strategy",options:{customBodyRender:d=>{const u=t(d===0?"common.auto":"common.manual");return e.jsx(V,{children:u})}}},{label:t("common.startTime"),name:"createdAt",options:{customBodyRender:d=>w(d).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.endTime"),name:"updatedAt",options:{customBodyRender:d=>Q(d)?"":w(d).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.status"),name:"status",options:{customBodyRenderLite:d=>{const u=(s==null?void 0:s[d])??{},{status:c,message:x,createdAt:p,metadata:g}=u,f=c===R.BACKUPS.STATUS.PROGRESS&&w().diff(p,"hours")>=R.BACKUPS.TIMEOUT_HOURS,b=c===R.BACKUPS.STATUS.PROGRESS&&!f,D=c===R.BACKUPS.STATUS.SUCCEEDED&&!f;return b?e.jsxs(C,{display:"inline-flex",alignItems:"center",fontSize:"14px",children:[e.jsx(A,{sx:{marginRight:"4px"},size:"12px"}),t("common.progress")]}):D?e.jsx(De,{metadata:g}):e.jsx(ke,{status:c,message:x,createdAt:p})}}}],[s,o,t]),a=y.useMemo(()=>!(s!=null&&s.length),[s]);return e.jsx(e.Fragment,{children:a?e.jsx(j,{display:"flex",justifyContent:"center",alignItems:"center",height:"100px",color:"#9397A1",marginTop:"16px",marginBottom:"24px",children:t("storage.spaces.record.emptyData")}):e.jsx(mt,{title:"",loading:i,data:s,columns:n,emptyNode:t("storage.spaces.record.emptyData",r),options:{download:!1,filter:!1,print:!1,search:!1,viewColumns:!1}})})}Be.propTypes={};function $e(){const{t}=T();return e.jsxs(j,{children:[e.jsxs(j,{display:"flex",gap:3,flexDirection:{xs:"column",md:"row"},children:[e.jsxs(j,{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",alignContent:"center",minWidth:240,children:[e.jsx(dt,{style:{cursor:"pointer",width:"150px",height:"100%",maxHeight:160}}),e.jsx(C,{my:2,sx:{textAlign:"center",color:"text.secondary"},children:t("storage.spaces.connect.provider")}),e.jsx(ee,{})]}),e.jsxs(j,{sx:{flexGrow:1,minWidth:0},children:[e.jsx(j,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3,children:e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",children:t("storage.spaces.backup.records")})}),e.jsx(Ce,{})]})]}),e.jsx(Be,{sx:{marginTop:"24px"}}),e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",mb:2,mt:2,children:t("common.dataStorage")}),e.jsx(Ke,{})]})}$e.propTypes={};var Ee={},Vt=ye;Object.defineProperty(Ee,"__esModule",{value:!0});var qe=Ee.default=void 0,Qt=Vt(je()),Xt=e;qe=Ee.default=(0,Qt.default)((0,Xt.jsx)("path",{d:"M6 6v2h8.59L5 17.59 6.41 19 16 9.41V18h2V6z"}),"ArrowOutward");var we={},Jt=ye;Object.defineProperty(we,"__esModule",{value:!0});var Ye=we.default=void 0,Zt=Jt(je()),Gt=e;Ye=we.default=(0,Zt.default)((0,Gt.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"}),"ElectricBoltOutlined");var Te={},es=ye;Object.defineProperty(Te,"__esModule",{value:!0});var He=Te.default=void 0,ts=es(je()),ss=e;He=Te.default=(0,ts.default)((0,ss.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"}),"FolderOutlined");function Ie({spaceGateway:t,onConfirm:r,onCancel:o}){const{t:s}=T(),[i,n]=y.useState(!1),[a,d]=y.useState(!1),u=(p,g)=>{p==null||p.preventDefault(),p==null||p.stopPropagation(),n(g)},c=async p=>{try{p==null||p.stopPropagation(),d(!0),await(r==null?void 0:r(t)),n(!1)}catch(g){console.error(g),B.error(`${s("storage.space.gateway.delete.failed")}: ${X(g)}`)}finally{n(!1),d(!1)}},x=p=>{u(p,!1),o==null||o(p)};return e.jsxs(e.Fragment,{children:[e.jsxs(q,{color:"red",onClick:p=>u(p,!0),children:[e.jsx(Y,{style:{minWidth:24,color:"red"},children:e.jsx(_t,{fontSize:"small"})}),e.jsx(H,{style:{color:"red"},children:s("common.disconnect")})]}),e.jsx(ft,{title:s("storage.spaces.gateway.delete.title"),open:i,confirmButton:{text:s("common.confirm"),props:{size:"small",variant:"contained",color:"error",loading:a}},cancelButton:{text:s("common.cancel"),props:{size:"small",variant:"outlined",disabled:a}},onConfirm:c,onCancel:x,children:e.jsx(C,{sx:{wordWrap:"break-word"},children:s("storage.spaces.gateway.delete.descForBackup",{name:`${t==null?void 0:t.name}`})})})]})}Ie.propTypes={spaceGateway:h.shape({name:h.string.isRequired,url:h.string.isRequired,protected:h.bool}).isRequired,onConfirm:h.func,onCancel:h.func};Ie.defaultProps={onConfirm:()=>{},onCancel:()=>{}};function Re({spaceGateway:t,selected:r,onDelete:o,onConnect:s,enableSwitchToSpace:i,backupInProgress:n,...a}){const{abortBlockletBackup:d}=L(),[u,c]=y.useState(null),{t:x}=T(),[p,g]=y.useState(!1),f=(S,l)=>{S.stopPropagation(),S.preventDefault(),c(l&&S.currentTarget)},b=async S=>{try{g(!0),f(S,!1),await s(t)}catch(l){console.error(l),B.error(l.message)}finally{g(!1)}},D=async S=>{try{g(!0),f(S,!1),await d()}catch(l){console.error(l),B.error(l.message)}finally{g(!1)}};return e.jsxs(e.Fragment,{children:[p||t!=null&&t.loading?e.jsx(A,{sx:{ml:1},size:"24px"}):e.jsx(tt,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions",variant:"outlined",size:"small",onClick:S=>f(S,!0),...a,children:e.jsx(zt,{})}),e.jsxs(st,{id:"simple-menu",anchorEl:u,keepMounted:!0,open:!!u,onClose:S=>f(S,!1),children:[e.jsxs(q,{onClick:S=>{f(S,!1),window.open(Oe(t.endpoint?Rt(t.endpoint):t.url,{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(qe,{fontSize:"small"})}),e.jsx(H,{children:x("common.open")})]}),e.jsxs(q,{onClick:S=>{f(S,!1),window.open(Oe(vt(t.endpoint),{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(He,{fontSize:"small"})}),e.jsx(H,{children:x("storage.spaces.strategy.viewBackupFiles")})]}),!r&&i&&e.jsxs(q,{onClick:b,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Ye,{fontSize:"small"})}),e.jsx(H,{children:x("storage.spaces.connect.switchToSpace")})]}),n&&e.jsxs(q,{onClick:D,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Pt,{fontSize:"small"})}),e.jsx(H,{children:x("storage.spaces.connect.abortBlockletBackup")})]}),!n&&e.jsx(Ie,{spaceGateway:t,onConfirm:async()=>{c(null),await(o==null?void 0:o(t))},onCancel:()=>c(null)})]})]})}Re.propTypes={spaceGateway:h.shape({name:h.string.isRequired,url:h.string.isRequired,protected:h.bool,endpoint:h.string.isRequired,loading:h.bool}).isRequired,selected:h.bool.isRequired,enableSwitchToSpace:h.bool,onDelete:h.func,onConnect:h.func,backupInProgress:h.bool};Re.defaultProps={onDelete:()=>{},onConnect:()=>{},enableSwitchToSpace:!0,backupInProgress:!1};const ns=ge(({className:t,...r})=>e.jsx(Se,{...r,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function ve({spaceGateway:t,spaceStatus:r,selected:o,onConnected:s,onDeleted:i,onBackedUp:n}){const{t:a,locale:d}=T(),{blocklet:u}=O(),{api:c,info:{did:x}}=M(),{appDid:p,appName:g,appDescription:f,scopes:b,appUrl:D,referrer:S}=Ne({blocklet:u}),{backupProgress:l,updateSpaceGateway:te,deleteSpaceGateway:se,refreshBackupSummary:ne,refreshBackups:oe}=L(),[U,z]=y.useState(!1),[I,v]=y.useState({open:!1,action:"one-click-authorization",checkTimeout:1e3*300,messages:{title:a("storage.spaces.authorize.title",{appName:g},d),scan:a("storage.spaces.authorize.scan",{appName:g},d),confirm:"",success:e.jsx(C,{gutterBottom:!0,children:a("storage.spaces.authorize.success")})},onClose:()=>{v(k=>({...k,open:!1}))}}),re=o&&!U&&r===ue.DISCONNECTED,ae=o&&!U&&!t.loading&&r===ue.CONNECTED,F=o&&U&&r===ue.CONNECTED&&(l==null?void 0:l.progress)>=0,J=async()=>{try{if(await At(t==null?void 0:t.endpoint)){await c.configBlocklet({input:{did:[u.meta.did],configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:t.endpoint}]}}),B.success(a("storage.spaces.connect.switchToSpaceSucceeded",{name:t.name?`(${t.name})`:""})),s==null||s(null,t);return}}catch(k){console.error(k),s==null||s(k,t);return}v(k=>({...k,open:!0,prefix:he(t.url,"space/api/did"),baseUrl:new URL(t.url).origin,checkFn:Ue.create({baseURL:he(t.url,"space")}).get,extraParams:{appDid:p,appName:g,appDescription:f,scopes:b,appUrl:D,referrer:S,nodeDid:x,spaceDid:t.did}}))},ie=async(k,K)=>{const m=K(k.endpoint),N=xe(m),E=k.space?K(k.space):{};if(t.did&&N!==t.did){v(de=>({...de,open:!1}));const $=a("storage.spaces.gateway.switch.failedForMismatchSpace",{name:E!=null&&E.name?E.name:""});B.error($),s==null||s(new Error($),t);return}const P={...t,name:E.name??"DID Space",did:E.did??xe(m),endpoint:m};await te(P),v($=>({...$,open:!1})),s==null||s(null,P)},ce=async()=>{try{if(U)return;z(!0),await c.backupBlocklet({input:{appDid:u.appDid,to:"spaces"}})}catch(k){console.error(k),B.error(k.message),n==null||n(k,t)}finally{z(!0)}},le=async()=>{try{await se(t),B.success(a("storage.spaces.gateway.delete.succeeded",{name:t.name?`(${t.name})`:""})),i==null||i(null,t)}catch(k){console.error(k),i==null||i(k,t)}};return y.useEffect(()=>{l!=null&&l.completed?(o&&((l==null?void 0:l.progress)===100?(B.success(a("storage.spaces.backupSuccessfully")),n==null||n(null,t)):l.message&&(n==null||n(new Error(l==null?void 0:l.message),t)),l.progress=0,l.message=""),z(!1),setTimeout(()=>{ne(),oe()},1e3)):l.progress&&z(!0)},[l]),e.jsxs(e.Fragment,{children:[e.jsxs(j,{sx:{".action-btn":{borderRadius:1,marginLeft:1}},display:"flex",alignItems:"center",children:[ae&&e.jsx(pe,{className:"action-btn",variant:"outlined",size:"small",onClick:ce,children:a("storage.spaces.strategy.backupNow")}),re&&e.jsx(pe,{className:"action-btn",variant:"outlined",size:"small",onClick:J,children:a("storage.spaces.disconnected.reconnectNow")}),F&&e.jsx(ns,{title:(l==null?void 0:l.message)&&e.jsx(j,{p:1,sx:{color:"black",backgroundColor:"white"},borderRadius:1,boxShadow:2,children:e.jsx(C,{variant:"body2",children:l.message})}),children:e.jsxs(pe,{className:"action-btn",variant:"outlined",size:"small",sx:{minWidth:70},children:[e.jsx(A,{variant:"determinate",value:l==null?void 0:l.progress,size:14,sx:{mr:1}}),l==null?void 0:l.progress,"%"]})}),e.jsx(ht,{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:d},"get-endpoint")]}),e.jsx(Re,{sx:{minWidth:32,padding:"2px 4px",ml:1},spaceGateway:t,selected:o,onDelete:le,onConnect:J,enableSwitchToSpace:(l==null?void 0:l.completed)||Q(l==null?void 0:l.message),backupInProgress:F})]})}ve.propTypes={spaceGateway:h.shape({did:h.string.isRequired,name:h.string.isRequired,url:h.string.isRequired,endpoint:h.string.isRequired,protected:h.bool,loading:h.bool}).isRequired,spaceStatus:h.string.isRequired,selected:h.bool.isRequired,onConnected:h.func,onDeleted:h.func,onBackedUp:h.func};ve.defaultProps={onConnected:()=>{},onDeleted:()=>{},onBackedUp:()=>{}};function Ve({...t}){const{t:r}=T();return e.jsxs(j,{...t,children:[e.jsx(j,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3,children:e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",children:r("storage.spaces.backup.records")})}),e.jsx(Ce,{}),e.jsx(Be,{})]})}Ve.propTypes={};function Qe({...t}){const{t:r}=T(),{autoBackup:o,updateAutoBackup:s}=L(),i=async()=>{try{const n=!(o!=null&&o.enabled);await s({enabled:n}),B.success(r(n?"storage.spaces.autoBackup.enabled":"storage.spaces.autoBackup.disabled"))}catch(n){B.error(n.message)}};return e.jsx(Mt,{checked:!!(o!=null&&o.enabled),onChange:i,name:"enableWelcomePage",labelProps:{label:e.jsx(C,{marginRight:"8px",children:e.jsx("span",{children:r("storage.spaces.autoBackup.title")})})},style:{...t.style}})}Qe.propTypes={};function os(){const{t}=T(),{spaceGateways:r,spaceGatewaysLoading:o,spaceGatewayIsSelected:s}=L(),i=o&&!(r!=null&&r.length),n=({spaceGateway:a,spaceStatus:d,selected:u,refresh:c})=>e.jsx(ve,{spaceGateway:a,spaceStatus:d,selected:u,onConnected:()=>c(),onBackedUp:x=>x&&c()});return e.jsxs(j,{display:"flex",flexDirection:"column",children:[e.jsxs(j,{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(C,{fontSize:"1.2rem",fontWeight:"bold",flexGrow:1,children:t("storage.spaces.connected.title")}),e.jsx(Qe,{}),e.jsx(ee,{})]}),e.jsx(j,{mt:2,children:i?e.jsx(j,{display:"flex",justifyContent:"center",children:e.jsx(A,{})}):e.jsx(Ae,{container:!0,spacing:2,children:e.jsx(e.Fragment,{children:r.map(a=>e.jsx(Ae,{item:!0,xs:12,md:6,children:e.jsx(ut,{endpoint:a.endpoint,selected:s(a),action:n},a.endpoint)},a.endpoint))})})}),e.jsx(Ve,{sx:{marginTop:"24px"}}),e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",mb:2,children:t("common.dataStorage")}),e.jsx(Ke,{})]})}function rs(){const{spaceGatewaysFirstLoading:t,spaceGateways:r}=L();return t?e.jsx(_e,{relative:"parent",children:e.jsx(A,{})}):Q(r)?e.jsx($e,{}):e.jsx(os,{})}function as(){return e.jsx(be,{children:e.jsx(rs,{})})}function is(){const{spaceGateway:t,settingStorageEndpoint:r,updateSpaceGateway:o,hasStorageEndpoint:s,loading:i,storageEndpoint:n}=Nt(),a=fe(()=>({display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"16px"}));return i?e.jsx(_e,{relative:"parent",children:e.jsx(A,{})}):e.jsxs(j,{sx:{maxWidth:"md",position:"relative"},children:[s?e.jsx(kt,{spaceGateway:t,settingStorageEndpoint:r}):e.jsx(Dt,{}),e.jsx(j,{sx:a,children:e.jsx(Bt,{onConnect:o,storageEndpoint:n})})]})}function cs(){const{t}=T();return e.jsxs(Ut,{children:[e.jsxs(W,{spacing:1,marginBottom:2,children:[e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",children:t("storage.appLevel.title")}),e.jsx(C,{color:"text.secondary",children:t("storage.appLevel.description")})]}),e.jsx(is,{})]})}function Xe({navOrientation:t,...r}){const{t:o,locale:s}=T(),{blocklet:i}=O(),n=jt({key:"md"}),[a,d]=ot(),u=a.get("tab")||"backup",c=n?"horizontal":t,x=fe(()=>{var l;const D=[{label:o("common.backup"),value:"backup"}],S=(l=i==null?void 0:i.capabilities)==null?void 0:l.didSpace;return(S===_.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED||S===_.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP)&&D.push({label:o("common.storage"),value:"storage"}),D},[s,c]),g=fe(()=>({backup:e.jsx(as,{}),storage:e.jsx(cs,{})}))[u],f=D=>{d(S=>(D==="backup"?S.delete("tab"):S.set("tab",D),S))};if(x.length<=1)return e.jsx(me,{children:g});const b=e.jsx(xt,{tabs:x,current:u,orientation:c,onChange:f,sx:[{borderRight:1,height:"100%",borderColor:"divider"},c==="horizontal"&&{borderRight:0}]});if(c==="vertical")return e.jsx(j,{...r,children:e.jsxs(W,{direction:{md:"column",lg:"row"},gap:2,children:[e.jsx(j,{sx:{flexShrink:0},children:e.jsx(Le,{left:b})}),e.jsx(j,{sx:{flexGrow:1,minWidth:0},children:e.jsx(me,{sx:{mt:1},children:g})})]})});if(c==="horizontal")return e.jsxs(j,{...r,children:[e.jsx(Le,{left:b}),e.jsx(me,{sx:{mt:2},children:g})]})}Xe.propTypes={navOrientation:h.oneOf(["vertical","horizontal"])};Xe.defaultProps={navOrientation:"vertical"};const me=ge(j)`
|
|
1
|
+
import{j as e,H as h,ah as Je,T as C,ab as A,e as Ze,cD as Z,ae as G,cE as Ge,aa as j,al as W,s as ge,ad as Se,ap as et,cF as ze,a9 as ye,q,b7 as Y,b8 as H,y as tt,at as st,as as Ae}from"./vendor-mui-core-Bq8gXTan.js";import{l as nt,i as Pe,b as fe}from"./vendor-hooks-BFlOfe0M.js";import{r as y,h as ot}from"./vendor-react-DEoibe3W.js";import{c as _,y as rt,W as at,J as it,X as ct,l as lt,w as dt,Y as ue,x as ut}from"./vendor-arcblock-DiSm3oUX.js";import{a3 as B,a as T,bb as pt,k as R,bg as V,ac as mt,r as je,bD as ft,B as pe,at as ht,F as _e,ax as xt}from"./vendor-ux-did-connect-DVX9lQ8a.js";import{G as O,D as M,y as E,a3 as gt,af as St,aF as yt}from"./index-CMYalRl2.js";import{u as jt}from"./use-mobile-DwzRjjku.js";import{b as Q,d as Me,a8 as bt,I as Ct,E as Ue,A as he}from"./vendor-utils-BotmZdBm.js";import"./api-87p2GGd0.js";import{u as Ne,C as kt,D as Dt,a as Bt}from"./connect-to-Bwfa2hMr.js";import{b as wt,c as Et,d as Tt,i as It,e as xe,f as Rt,h as vt,j as At}from"./spaces-C1lh7et6.js";import{f as X}from"./index-8eXqqyHQ.js";import{I as Ot}from"./index-BzZuK-66.js";import{R as Lt}from"./index-CKY4HT0P.js";import{d as zt}from"./MoreHoriz-Ba9rYlyz.js";import{c as Pt}from"./dashboard-B2X6c8E8.js";import{d as _t}from"./DeleteOutline-CnS2XiM1.js";import{g as Oe}from"./get-safe-url-B8xlSMyD.js";import{S as Mt}from"./switch-control-BYqb8MZf.js";import{C as Ut,u as Nt}from"./config-space-C3fS58cn.js";import{L as Le}from"./list-header-C7gle0n0.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-DyVGBDlt.js";import"./confirm-DApmnpvm.js";import"./PlayArrow-RVSfCmrB.js";import"./session-Bkvl2PSP.js";import"./use-blocklet-logo-CTCMbFiC.js";import"./InfoOutlined-C8ZBPUhD.js";import"./dot-iw3hN9HL.js";import"./useAsync-DVHp96Uu.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-CtTQsfXN.js";async function Wt({blockletDid:t,nodeApi:r,spaceGateways:o}){let s=!1;const i=await Promise.all(o.map(async n=>{let{name:a}=n;const d=await wt(n.endpoint);return!Q(d)&&d!==a&&(a=d,s=!0),{...n,name:a}}));return s&&await Promise.all(i.filter(n=>n.did).map(n=>r.updateBlockletSpaceGateway({input:{did:t,where:{did:n.did},spaceGateway:{...n}}}))),i}function Ft({refresh:t}={}){var i;const{blocklet:r}=O(),o=(i=r==null?void 0:r.meta)==null?void 0:i.did,{api:s}=M();return nt(async()=>{if(!o)return[];const{spaceGateways:n}=await s.getBlockletSpaceGateways({input:{did:o}});return await Wt({blockletDid:o,nodeApi:s,spaceGateways:n})??[]},{refreshDeps:[o,t],onError(n){var a;(a=n==null?void 0:n.message)!=null&&a.includes("not logged")?console.warn(n):(console.error(n),B.error(X(n)))}})}function We({deps:t,setLoading:r,backupDate:o}={deps:[],setLoading:()=>{},backupDate:new Date}){var x;const{blocklet:s}=O(),[i,n]=y.useState([]),{api:a}=M(),[d,u]=y.useMemo(()=>o?[E(o).startOf("day").toISOString(),E(o).endOf("day").toISOString()]:[E().startOf("year").toISOString(),E().endOf("day").toISOString()],[o]),c=Me(async()=>{try{if(r(!0),!s){n([]);return}const{backups:p}=await a.getBlockletBackups({input:{did:s.meta.did,startTime:d,endTime:u}});n(p??[])}catch(p){console.error(p),B.error(X(p))}finally{r(!1)}},1e3);return Pe(async()=>{c()},[(x=s==null?void 0:s.meta)==null?void 0:x.did].concat(t)),{backups:i}}function Kt({appDid:t}){const{backups:r}=We(),[o,s]=y.useState({message:"",progress:0,completed:!1}),i=M(),{ws:{useSubscription:n}}=i;return n(_.BlockletEvents.backupProgress,a=>{t===(a==null?void 0:a.appDid)&&s(()=>({...a}))},[t]),y.useEffect(()=>{var a;if(r!=null&&r.length&&bt((a=r[0])==null?void 0:a.status)){const[d]=r;s(()=>({message:d.message,progress:d.progress,completed:d.progress>=100}))}},[r]),o}function $t({deps:t=[],setLoading:r=()=>{}}={}){var d;const{blocklet:o}=O(),[s,i]=y.useState([]),{api:n}=M(),a=y.useCallback(Me(async()=>{var u;if(!n||!((u=o==null?void 0:o.meta)!=null&&u.did)){i([]);return}try{r(!0);const c=E(),x=c.subtract(1,"year"),{summary:p}=await n.getBlockletBackupSummary({input:{did:o.meta.did,startTime:x.toISOString(),endTime:c.toISOString()}});i(Array.isArray(p)?p:[])}catch(c){console.error("Failed to fetch backup summary:",c),B.error(X(c)),i([])}finally{r(!1)}},1e3),[]);return Pe(async()=>(await a(),()=>{a.cancel()}),[(d=o==null?void 0:o.meta)==null?void 0:d.did].concat(t)),{backupSummary:s}}const Fe=y.createContext({}),{Provider:qt,Consumer:Ws}=Fe;function be({children:t}){var K;const{t:r}=T(),{api:o}=M(),{blocklet:s}=O(),[i,n]=y.useState(null),[a,d]=y.useState(!1),{data:u,loading:c,mutate:x}=Ft({refresh:a}),p=Ct(u),g=Kt({appDid:s==null?void 0:s.appDid}),f=y.useMemo(()=>Et(s==null?void 0:s.environments),[s==null?void 0:s.environments]),[b,D]=y.useState(!1),[S,l]=y.useState(!1),{backups:te}=We({deps:[S,i],setLoading:D,backupDate:i}),[se,ne]=y.useState(!1),{backupSummary:oe}=$t({deps:[se]}),[U,z]=y.useState(u==null?void 0:u.find(m=>m.endpoint===f)),I=(K=s==null?void 0:s.settings)==null?void 0:K.autoBackup,v=()=>{d(m=>!m)},re=()=>{ne(m=>!m)},ae=()=>{l(m=>!m)},F=async m=>{await o.updateAutoBackup({input:{did:s.meta.did,autoBackup:m}})},J=async()=>{await o.abortBlockletBackup({input:{appPid:s.meta.did}})},ie=async(m,N)=>{try{x(w=>{const P=[...w];return P.push({...m,loading:!0}),P}),await o.addBlockletSpaceGateway({input:{did:s.meta.did,spaceGateway:m}}),f!==N&&await o.configBlocklet({input:{did:[s.meta.did],configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:N}]}}),z(m),v(),B.success(r("storage.spaces.connectedWithName",{name:(m==null?void 0:m.name)??"DID Spaces"}))}catch(w){throw console.error(w),x(P=>[...P].filter(de=>de.did!==m.did)),w}},ce=async m=>{m&&(m.endpoint===f&&(await o.configBlocklet({input:{did:[s.meta.did],configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),I!=null&&I.enabled&&await F({enabled:!1})),await o.deleteBlockletSpaceGateway({input:{did:s.meta.did,spaceGatewayDid:m==null?void 0:m.did}}),x(N=>{const w=[...N];return w.splice(w.indexOf(m),1),w}),z(m),v())},le=async m=>{await Promise.all([o.updateBlockletSpaceGateway({input:{did:s.meta.did,where:{did:m.did},spaceGateway:m}}),f!==m.endpoint&&o.configBlocklet({input:{did:[s.meta.did],configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:m.endpoint}]}})]),B.success(r("storage.spaces.connectedWithName",{name:(m==null?void 0:m.name)??"DID Spaces"})),v()},k=m=>(m==null?void 0:m.endpoint)===f;return e.jsx(qt,{value:{spaceGateways:u||[],selectedSpaceGateway:U,addSpaceGateway:ie,deleteSpaceGateway:ce,updateSpaceGateway:le,refreshSpaceGateways:v,spaceGatewaysLoading:c,spaceGatewaysFirstLoading:p,spaceGatewayIsSelected:k,updateAutoBackup:F,abortBlockletBackup:J,backupEndpoint:f,backupProgress:g,backups:te,backupSummary:oe,refreshBackupSummary:re,refreshBackups:ae,setBackupDate:n,backupsLoading:b,autoBackup:I},children:t})}be.propTypes={children:h.any.isRequired};be.defaultProps={};function L(){return y.useContext(Fe)}function ee({...t}){const{blocklet:r}=O(),{info:o}=M(),{t:s}=T(),i=Ne({blocklet:r}),n=gt(o),{spaceGateways:a,addSpaceGateway:d}=L(),u={checkFn:Ue.create({baseURL:he(window.location.origin,St())}).get,webWalletUrl:n,extraParams:{appPid:r.appPid,appDid:i.appDid,appName:i.appName,appDescription:i.appDescription,appUrl:i.appUrl,referrer:i.referrer,scopes:i.scopes,nodeDid:o.did}},c=async({endpoint:p,name:g,did:f})=>{const b=await Tt(p);if(!await It(b)){B.error(s("storage.spaces.gateway.add.invalidUrl"));return}if(a.some(l=>l.endpoint===p)){B.error(s("storage.spaces.gateway.add.duplicate",{name:g}));return}await d({name:g,did:f,url:b,endpoint:p},p)},x=async({spaceGateway:p})=>{try{await c(p)}catch(g){console.error(g),B.error(X(g))}};return e.jsx(rt,{...t,connectScope:"app",options:u,onSuccess:x})}ee.propTypes={};ee.defaultProps={};function Ke({...t}){const{t:r}=y.useContext(pt),{blocklet:o,loadingDiskInfo:s,actions:i}=O();if(y.useEffect(()=>{i==null||i.refreshBlocklet({showError:!1,attachDiskInfo:!0})},[]),o.diskInfo){const n=(u,c,x)=>e.jsxs(C,{children:[u," ",e.jsx("strong",{children:c?yt(c):"empty"})]}),a=o.environments.reduce((u,c)=>(u[c.key]=c.value,u),{}),d=[{key:"appDir",name:r("blocklet.diskInfo.appDir"),value:n(a.BLOCKLET_APP_DIR,o.diskInfo.app)},{key:"dataDir",name:r("blocklet.diskInfo.dataDir"),value:n(a.BLOCKLET_DATA_DIR,o.diskInfo.data)},{key:"logDir",name:r("blocklet.diskInfo.logDir"),value:n(a.BLOCKLET_LOG_DIR,o.diskInfo.log)},{key:"cacheDir",name:r("blocklet.diskInfo.cacheDir"),value:n(a.BLOCKLET_CACHE_DIR,o.diskInfo.cache)}];return e.jsx(Yt,{component:"div",...t,children:d.map(u=>e.jsx(Ot,{valueComponent:"div",nameWidth:120,name:u.name,children:u.value},u.key))})}return s?e.jsx(A,{}):e.jsx(C,{children:r("blocklet.diskInfo.empty")})}const Yt=Je(C)``;function Ce(){const{t}=T(),{setBackupDate:r,backupSummary:o}=L(),s=at({key:"lg"}),i=y.useRef(null),n=Ze(),a=y.useCallback(c=>{r(c)},[r]),d=y.useMemo(()=>{const c=E().add(1,"day"),x=E().subtract(11,"month").startOf("month"),p=new Map(o.map(f=>[f.date,{date:f.date,successCount:f.successCount,errorCount:f.errorCount}])),g=[];for(let f=x.clone();E(f).isBefore(c);f=f.add(1,"day")){const b=f.format("YYYY-MM-DD");g.push(p.get(b)||{date:b,successCount:0,errorCount:0})}return g},[o]),u=y.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:12},tooltip:{formatter:b=>{const{date:D,successCount:S,errorCount:l}=d[b.dataIndex]||{date:b.data[0],successCount:0,errorCount:0};return[`<div>${t("common.time")}: ${D}</div>`,`<div>${t("common.succeeded")}: ${S}</div>`,`<div>${t("common.failed")}: ${l}</div>`].join(`
|
|
2
|
+
`)},backgroundColor:n.palette.background.paper,borderColor:n.palette.divider,textStyle:{color:n.palette.text.primary,fontSize:14},extraCssText:`box-shadow: ${n.shadows[2]}; border-radius: 4px;`,padding:[8,10]},visualMap:{show:!1,min:-12,max:12,pieces:[{min:Number.MIN_SAFE_INTEGER,max:-9,color:Z[600]},{min:-9,max:-6,color:Z[500]},{min:-6,max:-3,color:Z[400]},{min:-3,max:-1,color:Z[300]},{min:0,max:0,color:n.palette.grey[200]},{min:1,max:3,color:G[300]},{min:3,max:6,color:G[400]},{min:6,max:9,color:G[500]},{min:9,max:Number.MAX_SAFE_INTEGER,color:G[600]}],orient:"horizontal",left:"center",bottom:12,itemWidth:12,itemHeight:12,textStyle:{color:n.palette.text.secondary,fontSize:12}},calendar:{top:30,left:50,right:10,bottom:4,cellSize:[8,8],splitLine:{show:!1},itemStyle:{borderWidth:2,borderColor:n.palette.background.default,color:n.palette.background.default},dayLabel:{show:!0,firstDay:0,nameMap:["","Mon","","Wed","","Fri",""],position:"start",margin:4,fontSize:10,color:n.palette.text.primary,fontWeight:"400",width:20},monthLabel:{show:!0,nameMap:"cn",align:"left",color:n.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:d.map(b=>[b.date,b.errorCount?-b.errorCount:b.successCount]),label:{show:!1},itemStyle:{borderWidth:2,borderColor:n.palette.background.default,borderRadius:4},emphasis:{itemStyle:{borderWidth:2,borderColor:Ge[200],color:"inherit"}}}}),[d,t,n]);return e.jsxs(e.Fragment,{children:[e.jsx(j,{ref:i,sx:{maxWidth:"1280px",border:"1px solid",borderColor:"divider",padding:"8px",overflowX:"auto"},children:e.jsx(j,{sx:{width:"1200px",height:"180px",position:"relative"},children:e.jsx(Lt,{option:u,style:{height:"100%",width:"100%"},notMerge:!0,lazyUpdate:!1,opts:{renderer:"canvas"},onEvents:{click:c=>{c.componentType==="series"&&c.data&&a(c.data[0])}}})})}),e.jsx(j,{display:"flex",justifyContent:"flex-end",mt:1,mr:s?2:5,mb:2,children:e.jsxs(W,{direction:s?"column":"row",spacing:s?2:1,width:"100%",justifyContent:"flex-start",alignItems:s?"flex-start":"center",children:[e.jsxs(W,{direction:"row",alignItems:"center",spacing:1,children:[e.jsx(j,{width:32,height:12,borderRadius:.5,sx:{background:"linear-gradient(90deg, #8B5000 0%, #A36200 33%, #C17700 66%, #E29000 100%)"}}),e.jsx(C,{variant:"body2",color:"text.secondary",children:t("storage.spaces.backup.failed")})]}),e.jsxs(W,{direction:"row",alignItems:"center",spacing:1,children:[e.jsx(j,{width:32,height:12,borderRadius:.5,bgcolor:"grey.200",border:"1px solid",borderColor:"grey.200"}),e.jsx(C,{variant:"body2",color:"text.secondary",children:t("storage.spaces.backup.without")})]}),e.jsxs(W,{direction:"row",alignItems:"center",spacing:1,children:[e.jsx(j,{width:32,height:12,borderRadius:.5,sx:{background:"linear-gradient(90deg, #9be9a8 0%, #40c463 33%, #30a14e 66%, #216e39 100%)"}}),e.jsx(C,{variant:"body2",color:"text.secondary",children:t("storage.spaces.backup.succeeded")})]})]})})]})}Ce.propTypes={};const Ht=ge(({className:t,...r})=>e.jsx(Se,{...r,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function ke({status:t,message:r,createdAt:o}){const{t:s}=T(),i=t===R.BACKUPS.STATUS.PROGRESS&&E().diff(o,"hours")>=R.BACKUPS.TIMEOUT_HOURS,n=i&&s("common.timeoutError"),a=t===R.BACKUPS.STATUS.PROGRESS&&!i,d=t===R.BACKUPS.STATUS.SUCCEEDED&&!i;return a?e.jsxs(C,{display:"inline-flex",alignItems:"center",fontSize:"14px",children:[e.jsx(A,{sx:{marginRight:"4px"},size:"12px"}),s("common.progress")]}):d?e.jsx(V,{type:"success",children:s("common.succeeded")}):e.jsxs(j,{display:"inline-flex",alignItems:"center",children:[e.jsx(V,{type:"error",children:s("common.failed")})," ",e.jsx(Se,{style:{display:"flex",alignItems:"center",flexShrink:0},title:r||n,children:e.jsx(ze,{children:e.jsx(it,{style:{width:"24px",height:"24px"},color:"error"})})})]})}ke.propTypes={status:h.string.isRequired,message:h.string,createdAt:h.string.isRequired};ke.defaultProps={message:""};function De({metadata:t}){const{t:r}=T();if(Q(t))return e.jsx(V,{type:"success",children:r("common.succeeded")});const o=t.count||0,s=t.size||0,i=ct(s,{iec:!0}),n=e.jsxs(j,{p:1,sx:{color:"black",backgroundColor:"white"},borderRadius:1,boxShadow:2,children:[e.jsxs(C,{variant:"body2",children:[r("common.fileCount"),": ",o]}),e.jsxs(C,{variant:"body2",children:[r("common.fileSize"),": ",i]})]});return e.jsxs(j,{display:"inline-flex",alignItems:"center",children:[e.jsx(V,{type:"success",children:r("common.succeeded")})," ",e.jsx(Ht,{title:n,style:{display:"flex",alignItems:"center",flexShrink:0},placement:"left",children:e.jsx(ze,{children:e.jsx(lt,{style:{width:"24px",height:"24px"},color:"primary"})})})]})}De.propTypes={metadata:h.object};De.defaultProps={metadata:{}};function Be(){const{t,locale:r}=T(),{spaceGateways:o,backups:s,backupsLoading:i}=L(),n=y.useMemo(()=>[{label:"DID Space",name:"target",options:{customBodyRenderLite:d=>{var D;const{targetUrl:u,targetName:c,status:x,createdAt:p}=s[d],g=x===R.BACKUPS.STATUS.PROGRESS&&E().diff(p,"hours")>=R.BACKUPS.TIMEOUT_HOURS,f=x===R.BACKUPS.STATUS.SUCCEEDED&&!g,b=c||((D=o.find(S=>u==null?void 0:u.includes(xe(S==null?void 0:S.endpoint))))==null?void 0:D.name)||"Unknown DID Space";return f?e.jsx(et,{fontSize:"16px",href:u,target:"_blank",children:b}):e.jsx(C,{variant:"body1",fontSize:"16px",children:b})}}},{label:t("common.strategy"),name:"strategy",options:{customBodyRender:d=>{const u=t(d===0?"common.auto":"common.manual");return e.jsx(V,{children:u})}}},{label:t("common.startTime"),name:"createdAt",options:{customBodyRender:d=>E(d).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.endTime"),name:"updatedAt",options:{customBodyRender:d=>Q(d)?"":E(d).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.status"),name:"status",options:{customBodyRenderLite:d=>{const u=(s==null?void 0:s[d])??{},{status:c,message:x,createdAt:p,metadata:g}=u,f=c===R.BACKUPS.STATUS.PROGRESS&&E().diff(p,"hours")>=R.BACKUPS.TIMEOUT_HOURS,b=c===R.BACKUPS.STATUS.PROGRESS&&!f,D=c===R.BACKUPS.STATUS.SUCCEEDED&&!f;return b?e.jsxs(C,{display:"inline-flex",alignItems:"center",fontSize:"14px",children:[e.jsx(A,{sx:{marginRight:"4px"},size:"12px"}),t("common.progress")]}):D?e.jsx(De,{metadata:g}):e.jsx(ke,{status:c,message:x,createdAt:p})}}}],[s,o,t]),a=y.useMemo(()=>!(s!=null&&s.length),[s]);return e.jsx(e.Fragment,{children:a?e.jsx(j,{display:"flex",justifyContent:"center",alignItems:"center",height:"100px",color:"#9397A1",marginTop:"16px",marginBottom:"24px",children:t("storage.spaces.record.emptyData")}):e.jsx(mt,{title:"",loading:i,data:s,columns:n,emptyNode:t("storage.spaces.record.emptyData",r),options:{download:!1,filter:!1,print:!1,search:!1,viewColumns:!1}})})}Be.propTypes={};function $e(){const{t}=T();return e.jsxs(j,{children:[e.jsxs(j,{display:"flex",gap:3,flexDirection:{xs:"column",md:"row"},children:[e.jsxs(j,{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",alignContent:"center",minWidth:240,children:[e.jsx(dt,{style:{cursor:"pointer",width:"150px",height:"100%",maxHeight:160}}),e.jsx(C,{my:2,sx:{textAlign:"center",color:"text.secondary"},children:t("storage.spaces.connect.provider")}),e.jsx(ee,{})]}),e.jsxs(j,{sx:{flexGrow:1,minWidth:0},children:[e.jsx(j,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3,children:e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",children:t("storage.spaces.backup.records")})}),e.jsx(Ce,{})]})]}),e.jsx(Be,{sx:{marginTop:"24px"}}),e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",mb:2,mt:2,children:t("common.dataStorage")}),e.jsx(Ke,{})]})}$e.propTypes={};var we={},Vt=ye;Object.defineProperty(we,"__esModule",{value:!0});var qe=we.default=void 0,Qt=Vt(je()),Xt=e;qe=we.default=(0,Qt.default)((0,Xt.jsx)("path",{d:"M6 6v2h8.59L5 17.59 6.41 19 16 9.41V18h2V6z"}),"ArrowOutward");var Ee={},Jt=ye;Object.defineProperty(Ee,"__esModule",{value:!0});var Ye=Ee.default=void 0,Zt=Jt(je()),Gt=e;Ye=Ee.default=(0,Zt.default)((0,Gt.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"}),"ElectricBoltOutlined");var Te={},es=ye;Object.defineProperty(Te,"__esModule",{value:!0});var He=Te.default=void 0,ts=es(je()),ss=e;He=Te.default=(0,ts.default)((0,ss.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"}),"FolderOutlined");function Ie({spaceGateway:t,onConfirm:r,onCancel:o}){const{t:s}=T(),[i,n]=y.useState(!1),[a,d]=y.useState(!1),u=(p,g)=>{p==null||p.preventDefault(),p==null||p.stopPropagation(),n(g)},c=async p=>{try{p==null||p.stopPropagation(),d(!0),await(r==null?void 0:r(t)),n(!1)}catch(g){console.error(g),B.error(`${s("storage.space.gateway.delete.failed")}: ${X(g)}`)}finally{n(!1),d(!1)}},x=p=>{u(p,!1),o==null||o(p)};return e.jsxs(e.Fragment,{children:[e.jsxs(q,{color:"red",onClick:p=>u(p,!0),children:[e.jsx(Y,{style:{minWidth:24,color:"red"},children:e.jsx(_t,{fontSize:"small"})}),e.jsx(H,{style:{color:"red"},children:s("common.disconnect")})]}),e.jsx(ft,{title:s("storage.spaces.gateway.delete.title"),open:i,confirmButton:{text:s("common.confirm"),props:{size:"small",variant:"contained",color:"error",loading:a}},cancelButton:{text:s("common.cancel"),props:{size:"small",variant:"outlined",disabled:a}},onConfirm:c,onCancel:x,children:e.jsx(C,{sx:{wordWrap:"break-word"},children:s("storage.spaces.gateway.delete.descForBackup",{name:`${t==null?void 0:t.name}`})})})]})}Ie.propTypes={spaceGateway:h.shape({name:h.string.isRequired,url:h.string.isRequired,protected:h.bool}).isRequired,onConfirm:h.func,onCancel:h.func};Ie.defaultProps={onConfirm:()=>{},onCancel:()=>{}};function Re({spaceGateway:t,selected:r,onDelete:o,onConnect:s,enableSwitchToSpace:i,backupInProgress:n,...a}){const{abortBlockletBackup:d}=L(),[u,c]=y.useState(null),{t:x}=T(),[p,g]=y.useState(!1),f=(S,l)=>{S.stopPropagation(),S.preventDefault(),c(l&&S.currentTarget)},b=async S=>{try{g(!0),f(S,!1),await s(t)}catch(l){console.error(l),B.error(l.message)}finally{g(!1)}},D=async S=>{try{g(!0),f(S,!1),await d()}catch(l){console.error(l),B.error(l.message)}finally{g(!1)}};return e.jsxs(e.Fragment,{children:[p||t!=null&&t.loading?e.jsx(A,{sx:{ml:1},size:"24px"}):e.jsx(tt,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions",variant:"outlined",size:"small",onClick:S=>f(S,!0),...a,children:e.jsx(zt,{})}),e.jsxs(st,{id:"simple-menu",anchorEl:u,keepMounted:!0,open:!!u,onClose:S=>f(S,!1),children:[e.jsxs(q,{onClick:S=>{f(S,!1),window.open(Oe(t.endpoint?Rt(t.endpoint):t.url,{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(qe,{fontSize:"small"})}),e.jsx(H,{children:x("common.open")})]}),e.jsxs(q,{onClick:S=>{f(S,!1),window.open(Oe(vt(t.endpoint),{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(He,{fontSize:"small"})}),e.jsx(H,{children:x("storage.spaces.strategy.viewBackupFiles")})]}),!r&&i&&e.jsxs(q,{onClick:b,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Ye,{fontSize:"small"})}),e.jsx(H,{children:x("storage.spaces.connect.switchToSpace")})]}),n&&e.jsxs(q,{onClick:D,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Pt,{fontSize:"small"})}),e.jsx(H,{children:x("storage.spaces.connect.abortBlockletBackup")})]}),!n&&e.jsx(Ie,{spaceGateway:t,onConfirm:async()=>{c(null),await(o==null?void 0:o(t))},onCancel:()=>c(null)})]})]})}Re.propTypes={spaceGateway:h.shape({name:h.string.isRequired,url:h.string.isRequired,protected:h.bool,endpoint:h.string.isRequired,loading:h.bool}).isRequired,selected:h.bool.isRequired,enableSwitchToSpace:h.bool,onDelete:h.func,onConnect:h.func,backupInProgress:h.bool};Re.defaultProps={onDelete:()=>{},onConnect:()=>{},enableSwitchToSpace:!0,backupInProgress:!1};const ns=ge(({className:t,...r})=>e.jsx(Se,{...r,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function ve({spaceGateway:t,spaceStatus:r,selected:o,onConnected:s,onDeleted:i,onBackedUp:n}){const{t:a,locale:d}=T(),{blocklet:u}=O(),{api:c,info:{did:x}}=M(),{appDid:p,appName:g,appDescription:f,scopes:b,appUrl:D,referrer:S}=Ne({blocklet:u}),{backupProgress:l,updateSpaceGateway:te,deleteSpaceGateway:se,refreshBackupSummary:ne,refreshBackups:oe}=L(),[U,z]=y.useState(!1),[I,v]=y.useState({open:!1,action:"one-click-authorization",checkTimeout:1e3*300,messages:{title:a("storage.spaces.authorize.title",{appName:g},d),scan:a("storage.spaces.authorize.scan",{appName:g},d),confirm:"",success:e.jsx(C,{gutterBottom:!0,children:a("storage.spaces.authorize.success")})},onClose:()=>{v(k=>({...k,open:!1}))}}),re=o&&!U&&r===ue.DISCONNECTED,ae=o&&!U&&!t.loading&&r===ue.CONNECTED,F=o&&U&&r===ue.CONNECTED&&(l==null?void 0:l.progress)>=0,J=async()=>{try{if(await At(t==null?void 0:t.endpoint)){await c.configBlocklet({input:{did:[u.meta.did],configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:t.endpoint}]}}),B.success(a("storage.spaces.connect.switchToSpaceSucceeded",{name:t.name?`(${t.name})`:""})),s==null||s(null,t);return}}catch(k){console.error(k),s==null||s(k,t);return}v(k=>({...k,open:!0,prefix:he(t.url,"space/api/did"),baseUrl:new URL(t.url).origin,checkFn:Ue.create({baseURL:he(t.url,"space")}).get,extraParams:{appDid:p,appName:g,appDescription:f,scopes:b,appUrl:D,referrer:S,nodeDid:x,spaceDid:t.did}}))},ie=async(k,K)=>{const m=K(k.endpoint),N=xe(m),w=k.space?K(k.space):{};if(t.did&&N!==t.did){v(de=>({...de,open:!1}));const $=a("storage.spaces.gateway.switch.failedForMismatchSpace",{name:w!=null&&w.name?w.name:""});B.error($),s==null||s(new Error($),t);return}const P={...t,name:w.name??"DID Space",did:w.did??xe(m),endpoint:m};await te(P),v($=>({...$,open:!1})),s==null||s(null,P)},ce=async()=>{try{if(U)return;z(!0),await c.backupBlocklet({input:{appDid:u.appDid,to:"spaces"}})}catch(k){console.error(k),B.error(k.message),n==null||n(k,t)}finally{z(!0)}},le=async()=>{try{await se(t),B.success(a("storage.spaces.gateway.delete.succeeded",{name:t.name?`(${t.name})`:""})),i==null||i(null,t)}catch(k){console.error(k),i==null||i(k,t)}};return y.useEffect(()=>{l!=null&&l.completed?(o&&((l==null?void 0:l.progress)===100?(B.success(a("storage.spaces.backupSuccessfully")),n==null||n(null,t)):l.message&&(n==null||n(new Error(l==null?void 0:l.message),t)),l.progress=0,l.message=""),z(!1),setTimeout(()=>{ne(),oe()},1e3)):l.progress&&z(!0)},[l]),e.jsxs(e.Fragment,{children:[e.jsxs(j,{sx:{".action-btn":{borderRadius:1,marginLeft:1}},display:"flex",alignItems:"center",children:[ae&&e.jsx(pe,{className:"action-btn",variant:"outlined",size:"small",onClick:ce,children:a("storage.spaces.strategy.backupNow")}),re&&e.jsx(pe,{className:"action-btn",variant:"outlined",size:"small",onClick:J,children:a("storage.spaces.disconnected.reconnectNow")}),F&&e.jsx(ns,{title:(l==null?void 0:l.message)&&e.jsx(j,{p:1,sx:{color:"black",backgroundColor:"white"},borderRadius:1,boxShadow:2,children:e.jsx(C,{variant:"body2",children:l.message})}),children:e.jsxs(pe,{className:"action-btn",variant:"outlined",size:"small",sx:{minWidth:70},children:[e.jsx(A,{variant:"determinate",value:l==null?void 0:l.progress,size:14,sx:{mr:1}}),l==null?void 0:l.progress,"%"]})}),e.jsx(ht,{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:d},"get-endpoint")]}),e.jsx(Re,{sx:{minWidth:32,padding:"2px 4px",ml:1},spaceGateway:t,selected:o,onDelete:le,onConnect:J,enableSwitchToSpace:(l==null?void 0:l.completed)||Q(l==null?void 0:l.message),backupInProgress:F})]})}ve.propTypes={spaceGateway:h.shape({did:h.string.isRequired,name:h.string.isRequired,url:h.string.isRequired,endpoint:h.string.isRequired,protected:h.bool,loading:h.bool}).isRequired,spaceStatus:h.string.isRequired,selected:h.bool.isRequired,onConnected:h.func,onDeleted:h.func,onBackedUp:h.func};ve.defaultProps={onConnected:()=>{},onDeleted:()=>{},onBackedUp:()=>{}};function Ve({...t}){const{t:r}=T();return e.jsxs(j,{...t,children:[e.jsx(j,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3,children:e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",children:r("storage.spaces.backup.records")})}),e.jsx(Ce,{}),e.jsx(Be,{})]})}Ve.propTypes={};function Qe({...t}){const{t:r}=T(),{autoBackup:o,updateAutoBackup:s}=L(),i=async()=>{try{const n=!(o!=null&&o.enabled);await s({enabled:n}),B.success(r(n?"storage.spaces.autoBackup.enabled":"storage.spaces.autoBackup.disabled"))}catch(n){B.error(n.message)}};return e.jsx(Mt,{checked:!!(o!=null&&o.enabled),onChange:i,name:"enableWelcomePage",labelProps:{label:e.jsx(C,{marginRight:"8px",children:e.jsx("span",{children:r("storage.spaces.autoBackup.title")})})},style:{...t.style}})}Qe.propTypes={};function os(){const{t}=T(),{spaceGateways:r,spaceGatewaysLoading:o,spaceGatewayIsSelected:s}=L(),i=o&&!(r!=null&&r.length),n=({spaceGateway:a,spaceStatus:d,selected:u,refresh:c})=>e.jsx(ve,{spaceGateway:a,spaceStatus:d,selected:u,onConnected:()=>c(),onBackedUp:x=>x&&c()});return e.jsxs(j,{display:"flex",flexDirection:"column",children:[e.jsxs(j,{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(C,{fontSize:"1.2rem",fontWeight:"bold",flexGrow:1,children:t("storage.spaces.connected.title")}),e.jsx(Qe,{}),e.jsx(ee,{})]}),e.jsx(j,{mt:2,children:i?e.jsx(j,{display:"flex",justifyContent:"center",children:e.jsx(A,{})}):e.jsx(Ae,{container:!0,spacing:2,children:e.jsx(e.Fragment,{children:r.map(a=>e.jsx(Ae,{item:!0,xs:12,md:6,children:e.jsx(ut,{endpoint:a.endpoint,selected:s(a),action:n},a.endpoint)},a.endpoint))})})}),e.jsx(Ve,{sx:{marginTop:"24px"}}),e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",mb:2,children:t("common.dataStorage")}),e.jsx(Ke,{})]})}function rs(){const{spaceGatewaysFirstLoading:t,spaceGateways:r}=L();return t?e.jsx(_e,{relative:"parent",children:e.jsx(A,{})}):Q(r)?e.jsx($e,{}):e.jsx(os,{})}function as(){return e.jsx(be,{children:e.jsx(rs,{})})}function is(){const{spaceGateway:t,settingStorageEndpoint:r,updateSpaceGateway:o,hasStorageEndpoint:s,loading:i,storageEndpoint:n}=Nt(),a=fe(()=>({display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"16px"}));return i?e.jsx(_e,{relative:"parent",children:e.jsx(A,{})}):e.jsxs(j,{sx:{maxWidth:"md",position:"relative"},children:[s?e.jsx(kt,{spaceGateway:t,settingStorageEndpoint:r}):e.jsx(Dt,{}),e.jsx(j,{sx:a,children:e.jsx(Bt,{onConnect:o,storageEndpoint:n})})]})}function cs(){const{t}=T();return e.jsxs(Ut,{children:[e.jsxs(W,{spacing:1,marginBottom:2,children:[e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",children:t("storage.appLevel.title")}),e.jsx(C,{color:"text.secondary",children:t("storage.appLevel.description")})]}),e.jsx(is,{})]})}function Xe({navOrientation:t,...r}){const{t:o,locale:s}=T(),{blocklet:i}=O(),n=jt({key:"md"}),[a,d]=ot(),u=a.get("tab")||"backup",c=n?"horizontal":t,x=fe(()=>{var l;const D=[{label:o("common.backup"),value:"backup"}],S=(l=i==null?void 0:i.capabilities)==null?void 0:l.didSpace;return(S===_.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED||S===_.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP)&&D.push({label:o("common.storage"),value:"storage"}),D},[s,c]),g=fe(()=>({backup:e.jsx(as,{}),storage:e.jsx(cs,{})}))[u],f=D=>{d(S=>(D==="backup"?S.delete("tab"):S.set("tab",D),S))};if(x.length<=1)return e.jsx(me,{children:g});const b=e.jsx(xt,{tabs:x,current:u,orientation:c,onChange:f,sx:[{borderRight:1,height:"100%",borderColor:"divider"},c==="horizontal"&&{borderRight:0}]});if(c==="vertical")return e.jsx(j,{...r,children:e.jsxs(W,{direction:{md:"column",lg:"row"},gap:2,children:[e.jsx(j,{sx:{flexShrink:0},children:e.jsx(Le,{left:b})}),e.jsx(j,{sx:{flexGrow:1,minWidth:0},children:e.jsx(me,{sx:{mt:1},children:g})})]})});if(c==="horizontal")return e.jsxs(j,{...r,children:[e.jsx(Le,{left:b}),e.jsx(me,{sx:{mt:2},children:g})]})}Xe.propTypes={navOrientation:h.oneOf(["vertical","horizontal"])};Xe.defaultProps={navOrientation:"vertical"};const me=ge(j)`
|
|
3
3
|
position: relative;
|
|
4
4
|
min-height: 66vh;
|
|
5
5
|
overflow: hidden;
|