@abtnode/blocklet-services 1.17.3-beta-20251127-063055-94957209 → 1.17.3
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/routes/oauth/client.js +11 -1
- package/api/routes/user.js +23 -3
- package/api/services/notification/queue.js +34 -7
- package/api/util/user-util.js +48 -0
- package/dist/assets/{AdapterDayjs-DlsssqYa.js → AdapterDayjs-OZNn2tpO.js} +1 -1
- package/dist/assets/{Google-D0eQfUdH.js → Google-PoHjNVzr.js} +1 -1
- package/dist/assets/{access-control-Danf5ySk.js → access-control-2f5ZUYvn.js} +1 -1
- package/dist/assets/actions-CIp6hu8_.js +1 -0
- package/dist/assets/{add-component-core-Daobxf3I.js → add-component-core-C8wP5DXr.js} +35 -35
- package/dist/assets/add-resource-D-X1I5_V.js +1 -0
- package/dist/assets/{addon-Be4T3QjT.js → addon-DWBAL8PD.js} +2 -2
- package/dist/assets/{advanced-kv_eujfj.js → advanced-l0XvYXrR.js} +2 -2
- package/dist/assets/{aigne-vYtZdhdi.js → aigne-CsKyE9Oj.js} +1 -1
- package/dist/assets/api-DIucIOLX.js +1 -0
- package/dist/assets/{appearance-D_x7BGc3.js → appearance-CDE_5zqq.js} +1 -1
- package/dist/assets/{ar-Dz5bxvSE.js → ar-BJZY7v5z.js} +2 -2
- package/dist/assets/{arrow-down.svg-OnWcVrr5.js → arrow-down.svg-C5rjQJG2.js} +1 -1
- package/dist/assets/{audit-logs-BnoJxxOA.js → audit-logs-CvWoJqnE.js} +2 -2
- package/dist/assets/{authorize-CEopc1Jx.js → authorize-CgqsMeVu.js} +1 -1
- package/dist/assets/{base-chart-Cn6zWpXN.js → base-chart-DvlyWvB2.js} +1 -1
- package/dist/assets/{base32-DmEq36OL.js → base32-AX-I0UaR.js} +1 -1
- package/dist/assets/bind-account-C_93rOKB.js +1 -0
- package/dist/assets/{branding-B4_lA6sS.js → branding-C56V2vpD.js} +1 -1
- package/dist/assets/branding-D-5p5wha.js +1 -0
- package/dist/assets/{branding-DQ5FtHfK.js → branding-MYLazJOV.js} +5 -5
- package/dist/assets/{bundle-avatar-mI1l0Wbs.js → bundle-avatar-BdQv8P8t.js} +1 -1
- package/dist/assets/button-8Nchte_6.js +1 -0
- package/dist/assets/click-to-copy-DZ_4RDjR.js +1 -0
- package/dist/assets/{cloneDeep-D_9o-MDF.js → cloneDeep-B7kH4W7U.js} +1 -1
- package/dist/assets/{collapse-DL7FXe7i.js → collapse-CHg4yEHL.js} +1 -1
- package/dist/assets/{complete-CoMp3K_K.js → complete-BSud_fLS.js} +1 -1
- package/dist/assets/{component-DqnOhVec.js → component-Z_4kfVE0.js} +2 -2
- package/dist/assets/{config-l8EZr5wV.js → config-QNXiPFng.js} +1 -1
- package/dist/assets/{config-DIElb3ko.js → config-YjT0ptkh.js} +1 -1
- package/dist/assets/{config-navigation-CvEqeTCm.js → config-navigation-BdlyLYhE.js} +2 -2
- package/dist/assets/{config-space-D-JrZNQP.js → config-space-BSBup5aB.js} +1 -1
- package/dist/assets/{config-BNoxsDyj.js → config-tFuMpr42.js} +1 -1
- package/dist/assets/{confirm-7CqzZykT.js → confirm-DPD7yjeR.js} +1 -1
- package/dist/assets/{connect-CL9-wlU7.js → connect-C51xT0zT.js} +1 -1
- package/dist/assets/{connect-HC_-YXp4.js → connect-DFCRlbN9.js} +1 -1
- package/dist/assets/connect-to-B-qzDPba.js +1 -0
- package/dist/assets/{content-layout-dv29oUBd.js → content-layout-RghQFMLL.js} +1 -1
- package/dist/assets/{create-passport-svg-CESSejlW.js → create-passport-svg-BZVXsAoP.js} +1 -1
- package/dist/assets/createClass-dlbhjEVd.js +1 -0
- package/dist/assets/{dashboard-D4m3zfEM.js → dashboard-Cto_eSyJ.js} +2 -2
- package/dist/assets/{de-Ztxy5vEB.js → de-BF0NHTXz.js} +2 -2
- package/dist/assets/{delete-confirm-D1LtCumr.js → delete-confirm-G3d9EUZU.js} +1 -1
- package/dist/assets/{did-address-gjwvc_rF.js → did-address-CihvGtuj.js} +1 -1
- package/dist/assets/domain-CJ3ZeLQs.js +9 -0
- package/dist/assets/{domain-action-card-uJMlNbM4.js → domain-action-card-BAzAGOUR.js} +2 -2
- package/dist/assets/domains-CbYSc-np.js +1 -0
- package/dist/assets/{email-ua9HtNUU.js → email-BbooLxm_.js} +1 -1
- package/dist/assets/{empty-spinner-v7NQTJhv.js → empty-spinner-2ylB84wv.js} +1 -1
- package/dist/assets/engine-7kGw4V-U.js +1 -0
- package/dist/assets/{es-Cd-spoK_.js → es-Dv2m4LXp.js} +2 -2
- package/dist/assets/{exchange-passport-ClnnHBna.js → exchange-passport-B7UqzIxE.js} +1 -1
- package/dist/assets/{form-DswlznpT.js → form-Ci18kVmF.js} +3 -3
- package/dist/assets/{form-text-input-BdG6b7xY.js → form-text-input-CBL3JAev.js} +1 -1
- package/dist/assets/{form-wrapper-D4szSlOw.js → form-wrapper-CqFSijKV.js} +1 -1
- package/dist/assets/{fr-k8jXteN1.js → fr-BGhg9oO3.js} +2 -2
- package/dist/assets/{fuel-whr3Ilmj.js → fuel-BE74WZ6j.js} +1 -1
- package/dist/assets/{gen-access-key-DAhMUU-d.js → gen-access-key-s40ict9x.js} +1 -1
- package/dist/assets/{gen-simple-access-key-DS0CA98s.js → gen-simple-access-key-D8YVPusH.js} +1 -1
- package/dist/assets/get-safe-url-DT47R_1b.js +1 -0
- package/dist/assets/{hi-CvpI1-tn.js → hi-CPfDhW8g.js} +2 -2
- package/dist/assets/{home-Co102dWk.js → home-C9ok8LuA.js} +1 -1
- package/dist/assets/{id-D8coHs1U.js → id-9TUzKF6k.js} +2 -2
- package/dist/assets/{iframe-COJHAFfh.js → iframe-BoFxpqBT.js} +1 -1
- package/dist/assets/{index-BKN6q696.js → index-B9Igf2rm.js} +1 -1
- package/dist/assets/{index-XWTmneBy.js → index-BF7MtybM.js} +1 -1
- package/dist/assets/{index-uV0wgve2.js → index-BJz7bmlp.js} +1 -1
- package/dist/assets/{index-DwhuhEAl.js → index-BpNkmzkz.js} +2 -2
- package/dist/assets/{index-Dspz6jcA.js → index-ByWjeUNp.js} +7 -7
- package/dist/assets/{index-C0q0zQTI.js → index-C0TbDTja.js} +4 -4
- package/dist/assets/{index-DMxyBvNb.js → index-CCaP8G-5.js} +2 -2
- package/dist/assets/index-CFLPfp6M.js +124 -0
- package/dist/assets/index-CMuQuCcn.js +1 -0
- package/dist/assets/{index-B7aKP8pi.js → index-CN4lpn74.js} +132 -134
- package/dist/assets/{index-BbKEZuXu.js → index-CO3X6G_g.js} +1 -1
- package/dist/assets/{index-CqjGrKtg.js → index-CTzNs74h.js} +2 -2
- package/dist/assets/index-CUHwnb5s.js +120 -0
- package/dist/assets/index-CekShFJg.js +6 -0
- package/dist/assets/{index-DgXRGMR4.js → index-CgnIkelt.js} +1 -1
- package/dist/assets/index-CimoFUNL.js +7 -0
- package/dist/assets/index-CionuFLd.js +1 -0
- package/dist/assets/{index-Np46kKLW.js → index-ClpPXMAi.js} +5 -5
- package/dist/assets/{index-it0t1NhB.js → index-CpVl3QY6.js} +8 -8
- package/dist/assets/{index-DYMBrhSA.js → index-DA2Pny4B.js} +1 -1
- package/dist/assets/{index-DIDsL1O1.js → index-DA4iEV0M.js} +1 -1
- package/dist/assets/index-DQB7DBpQ.js +29 -0
- package/dist/assets/{index-BgHe98gK.js → index-DXYr8-bJ.js} +1 -1
- package/dist/assets/{index-BNDeY87F.js → index-DaIayPTI.js} +2 -2
- package/dist/assets/{index-C9kZHU28.js → index-DbmL_qgW.js} +8 -8
- package/dist/assets/{index-CCVrpeOq.js → index-DrJnt_vf.js} +4 -4
- package/dist/assets/index-DsQDfClt.js +1 -0
- package/dist/assets/index-DtUiw_0b.js +55 -0
- package/dist/assets/{index-BxqQFCR8.js → index-YApW_a5L.js} +1 -1
- package/dist/assets/{index-AgA4sW48.js → index-bbu7QFpz.js} +1 -1
- package/dist/assets/{index-CIxFbeb7.js → index-h3JyhqqC.js} +1 -1
- package/dist/assets/{index-D1fu_Ebn.js → index-tukXJbMk.js} +5 -5
- package/dist/assets/{index-CcXTlGtY.js → index-yGC4DbEU.js} +1 -1
- package/dist/assets/{invitation-C_tg_ETR.js → invitation-XkzkbIwS.js} +2 -2
- package/dist/assets/{invitations-DfUvBLlf.js → invitations-Cy_dNcIE.js} +1 -1
- package/dist/assets/{invite-nGN9Oyh4.js → invite-BSYvges4.js} +1 -1
- package/dist/assets/{isURL-C5WG5wCh.js → isURL-DskT4RKm.js} +2 -2
- package/dist/assets/{issue-passport-D9X0hPuR.js → issue-passport-opYjcMCB.js} +1 -1
- package/dist/assets/{item-CLLsRigr.js → item-DToR6hlW.js} +1 -1
- package/dist/assets/{ja-Dkn5OA2r.js → ja-DT5bRsBF.js} +2 -2
- package/dist/assets/{ko-DXfRo0NY.js → ko-CJn9PyPz.js} +2 -2
- package/dist/assets/{landing-page-BCWLCQCC.js → landing-page-DFIsLbb7.js} +1 -1
- package/dist/assets/{launch-result-message-cNLFIi7R.js → launch-result-message-AcBN2VCj.js} +1 -1
- package/dist/assets/{layout-C7kocIsT.js → layout-CkQwn0NR.js} +1 -1
- package/dist/assets/list-D4Gs036Z.js +103 -0
- package/dist/assets/{list-CoA75USb.js → list-D5UHzaOx.js} +1 -1
- package/dist/assets/{list-header-C3sqYJbQ.js → list-header-CA-QkwGq.js} +1 -1
- package/dist/assets/localization-DzNUtlVV.js +1 -0
- package/dist/assets/{log-By5AyjAO.js → log-RL9u31-I.js} +1 -1
- package/dist/assets/logger-DQUu6ucJ.js +1 -0
- package/dist/assets/login-CqeIoGod.js +1 -0
- package/dist/assets/{login-oauth-callback-1zhw-LOq.js → login-oauth-callback-0Nu4mPXk.js} +1 -1
- package/dist/assets/{logo-uploader-BrImw7s9.js → logo-uploader-Cv5-KB8L.js} +1 -1
- package/dist/assets/lost-passport-CoOQTlhO.js +167 -0
- package/dist/assets/{observability-BtYD0ieN.js → observability-Bzq6nAvX.js} +1 -1
- package/dist/assets/{omit-BSwpPhgW.js → omit-W13eVnqC.js} +1 -1
- package/dist/assets/{open-window-DVvGcPv8.js → open-window-BHKfDlI-.js} +1 -1
- package/dist/assets/{over-due-invoice-payment-BDO7_XVI.js → over-due-invoice-payment-MovV2cwi.js} +1 -1
- package/dist/assets/{overview-DAMKF9mI.js → overview-CCLvrJi4.js} +2 -2
- package/dist/assets/{page-header-DbMN84ZK.js → page-header-B4MDj6gy.js} +1 -1
- package/dist/assets/passport-CqvORkfw.js +1 -0
- package/dist/assets/{passport-item-B2H7GQg8.js → passport-item-BMa8rd85.js} +1 -1
- package/dist/assets/{permission-D6_WOpI3.js → permission-DLnMVuoy.js} +1 -1
- package/dist/assets/{playground-NSs9sx7X.js → playground-C71u8_tm.js} +1 -1
- package/dist/assets/preferences-CDvS8_ng.js +1 -0
- package/dist/assets/profile-embed-C8ofqlbV.js +1 -0
- package/dist/assets/pt-K9FK6Ube.js +5 -0
- package/dist/assets/publish-resource-CMoJF5DA.js +1 -0
- package/dist/assets/{react-beautiful-dnd.esm-CK4sWF8a.js → react-beautiful-dnd.esm--C1KYPc1.js} +1 -1
- package/dist/assets/{react-stripe.esm-DtEXX2jp.js → react-stripe.esm-DlJMzZK2.js} +1 -1
- package/dist/assets/{required-Cwbcx6Cg.js → required-glXJjYm5.js} +1 -1
- package/dist/assets/ru-C_RwukUu.js +5 -0
- package/dist/assets/runtime-D2sDgwrj.js +1 -0
- package/dist/assets/{sanitize-aIE75FMz.js → sanitize-Bm63FeNh.js} +1 -1
- package/dist/assets/sdk-CiQg0Ndf.js +1 -0
- package/dist/assets/{section-Bq6cqwD2.js → section-4gVAq_Fp.js} +1 -1
- package/dist/assets/{security-4cho6HAg.js → security-D7O7D2Dn.js} +1 -1
- package/dist/assets/{session-4l80Me2P.js → session-DNlfWI2Z.js} +1 -1
- package/dist/assets/{setup-BtaOnq1y.js → setup-CxJT_7C9.js} +1 -1
- package/dist/assets/{shorten-label-BugTCYOF.js → shorten-label-Cf--RqV-.js} +1 -1
- package/dist/assets/{simple-select-BueAriVl.js → simple-select-BAtHv3cq.js} +1 -1
- package/dist/assets/{spaces-iftz1eYH.js → spaces-B9YyAxJd.js} +1 -1
- package/dist/assets/{start-AVZVc08V.js → start-TaXS82Bg.js} +1 -1
- package/dist/assets/{starting-progress-KDLYjvJ9.js → starting-progress-B6ma-ZGa.js} +1 -1
- package/dist/assets/status-DsksxwVa.js +1 -0
- package/dist/assets/{step-actions-CFyLVUSC.js → step-actions-DbAALRbw.js} +1 -1
- package/dist/assets/{studio-CuikMk9t.js → studio-IkWmW2Xk.js} +1 -1
- package/dist/assets/{switch-control-tVHoI5QM.js → switch-control-DdOZdvsu.js} +1 -1
- package/dist/assets/{table-tips-AK8Y4Q8i.js → table-tips-cVuoMOXE.js} +1 -1
- package/dist/assets/team-BnNEVFdE.js +146 -0
- package/dist/assets/th-Bhii_FfA.js +5 -0
- package/dist/assets/traffic-BibrNphF.js +1 -0
- package/dist/assets/{transfer-dv44R-B9.js → transfer-CPU5ZBFf.js} +1 -1
- package/dist/assets/{unsubscribe-B_7KhKwO.js → unsubscribe-CBHokiq9.js} +1 -1
- package/dist/assets/{use-app-logo-BebTliBo.js → use-app-logo-BWOYOuhG.js} +1 -1
- package/dist/assets/{use-mobile-CbzGNuhc.js → use-mobile-BpPz1bKz.js} +1 -1
- package/dist/assets/{use-mobile-D-631edY.js → use-mobile-DoKVMODs.js} +1 -1
- package/dist/assets/{use-server-logo-BqPWSS3F.js → use-server-logo-UGU40YsW.js} +1 -1
- package/dist/assets/{use-window-close-Tv5rDlUk.js → use-window-close-CbUhh9L6.js} +1 -1
- package/dist/assets/{useAsync-CuuTq_2R.js → useAsync-Be4McwD-.js} +1 -1
- package/dist/assets/{useAsync-Di_jotad.js → useAsync-Cc-dQGZL.js} +1 -1
- package/dist/assets/{useAsyncRetry-D33rBUak.js → useAsyncRetry-DHTJ61Jg.js} +1 -1
- package/dist/assets/{useLocalStorage-CNRBVDFF.js → useLocalStorage-UFpv-3wa.js} +1 -1
- package/dist/assets/user-center-DxoxMBFK.js +126 -0
- package/dist/assets/{user-follower-Dv6JnrUr.js → user-follower-CNxYFKVI.js} +1 -1
- package/dist/assets/{util-DzML57Qs.js → util-DWpY3O7e.js} +1 -1
- package/dist/assets/{util-Cd42TaWI.js → util-DzwOLYt5.js} +1 -1
- package/dist/assets/{vendor-arcblock-D5spFpjt.js → vendor-arcblock-3xKfH3F1.js} +114 -115
- package/dist/assets/{vendor-hooks-BeI8hpF9.js → vendor-hooks-fhL5FJET.js} +1 -1
- package/dist/assets/{vendor-mui-core-Et2SVbGP.js → vendor-mui-core-DHT36AZL.js} +1 -1
- package/dist/assets/{vendor-mui-x-BIXAJqK8.js → vendor-mui-x-B4OOX5Es.js} +1 -1
- package/dist/assets/vendor-utils-BSZ4yJws.js +213 -0
- package/dist/assets/{vendor-ux-Y094QNTK.js → vendor-ux-sqP3hEhY.js} +45 -45
- package/dist/assets/vi-DVF2tjOG.js +5 -0
- package/dist/assets/{wait-connect-5-eiabIl.js → wait-connect-Crb0Z6pk.js} +1 -1
- package/dist/assets/{wizard-_JfH9fOz.js → wizard-GO-eYrph.js} +1 -1
- package/dist/assets/{wizard-components-C_0333Fa.js → wizard-components-B0p6B74G.js} +1 -1
- package/dist/assets/wrap-locale-C_7Ff1OO.js +1 -0
- package/dist/assets/{zh-DB1zAstv.js → zh-98nxdLeR.js} +2 -2
- package/dist/assets/{zh-Czp7XVra.js → zh-kaABsCb2.js} +1 -1
- package/dist/assets/{zh-tw-DVMVT9am.js → zh-tw-BdDE7n5E.js} +2 -2
- package/dist/index.html +1 -1
- package/dist/service-worker.js +1 -1
- package/package.json +32 -32
- package/dist/assets/actions-DHp-gk7h.js +0 -1
- package/dist/assets/add-resource-C2oX_-Zz.js +0 -1
- package/dist/assets/api-C1vNuLNj.js +0 -1
- package/dist/assets/bind-account-CNpaY2P8.js +0 -1
- package/dist/assets/branding-DW4NsL1y.js +0 -1
- package/dist/assets/button-CX931aAr.js +0 -1
- package/dist/assets/click-to-copy-Cq4W-wkJ.js +0 -1
- package/dist/assets/connect-to-DNIdRfZG.js +0 -1
- package/dist/assets/createClass-bIxJZr1p.js +0 -1
- package/dist/assets/domain-BSIx6Jyu.js +0 -9
- package/dist/assets/domains-DPyPBivZ.js +0 -1
- package/dist/assets/engine-cCWGwlN6.js +0 -1
- package/dist/assets/get-safe-url-DFrG9umg.js +0 -1
- package/dist/assets/index-BbXRGcZW.js +0 -7
- package/dist/assets/index-CEz-byBA.js +0 -1
- package/dist/assets/index-ClXbSPXF.js +0 -6
- package/dist/assets/index-CzmL_Hvj.js +0 -30
- package/dist/assets/index-DJFOLfX2.js +0 -120
- package/dist/assets/index-DmGYWcz-.js +0 -1
- package/dist/assets/index-KEP7l6E2.js +0 -124
- package/dist/assets/index-ZUT_Qafk.js +0 -1
- package/dist/assets/index-cUf5_jCs.js +0 -55
- package/dist/assets/list-CTOAY-ou.js +0 -103
- package/dist/assets/localization-B-Y1B8LC.js +0 -1
- package/dist/assets/logger-d9jkFx-x.js +0 -1
- package/dist/assets/login-DthiGxzS.js +0 -1
- package/dist/assets/lost-passport-BB122NeD.js +0 -167
- package/dist/assets/passport-UxiDT8mW.js +0 -1
- package/dist/assets/preferences-DexmqT2T.js +0 -1
- package/dist/assets/profile-embed-z9JSgirN.js +0 -1
- package/dist/assets/pt-CNQsUMCu.js +0 -5
- package/dist/assets/publish-resource-TLVbUo-x.js +0 -1
- package/dist/assets/ru-CjyCft4V.js +0 -5
- package/dist/assets/runtime-CnztHx23.js +0 -1
- package/dist/assets/sdk-CLOiRS-Q.js +0 -1
- package/dist/assets/status-DfnitO-x.js +0 -1
- package/dist/assets/team-CsIX00_k.js +0 -146
- package/dist/assets/th-WQWRMKAv.js +0 -5
- package/dist/assets/traffic-hGNEG2UT.js +0 -1
- package/dist/assets/user-center-xqAXQ-SZ.js +0 -126
- package/dist/assets/vendor-utils-DZwtp8ph.js +0 -213
- package/dist/assets/vi-Br98wbNi.js +0 -5
- package/dist/assets/wrap-locale-DFgLH2rd.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as i,b6 as e,bg as a,W as s}from"./vendor-mui-core-
|
|
1
|
+
import{j as i,b6 as e,bg as a,W as s}from"./vendor-mui-core-DHT36AZL.js";import{l}from"./vendor-ux-sqP3hEhY.js";const r=l(t=>i.jsx(a,{focusVisibleClassName:".Mui-focusVisible",disableRipple:!0,...t}))(({theme:t})=>({width:42,height:26,padding:0,"& .MuiSwitch-switchBase":{padding:0,margin:2,transitionDuration:"300ms","&.Mui-checked":{transform:"translateX(16px)",color:"#fff","& + .MuiSwitch-track":{backgroundColor:t.palette.primary.main,opacity:1,border:0},"&.Mui-disabled + .MuiSwitch-track":{opacity:.5}},"&.Mui-focusVisible .MuiSwitch-thumb":{color:t.palette.primary.main,border:"6px solid #fff"},"&.Mui-disabled .MuiSwitch-thumb":{color:t.palette.mode==="light"?t.palette.grey[100]:t.palette.grey[600]},"&.Mui-disabled + .MuiSwitch-track":{opacity:t.palette.mode==="light"?.7:.3}},"& .MuiSwitch-thumb":{boxSizing:"border-box",width:22,height:22},"& .MuiSwitch-track":{borderRadius:26/2,backgroundColor:t.palette.grey[200],opacity:1,transition:t.transitions.create(["background-color"],{duration:500})}}));function c({labelProps:t=null,...o}){return t?i.jsx(e,{control:i.jsx(r,{...o}),...t}):i.jsx(r,{...o})}c.propTypes={labelProps:s.object};export{c as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e,T as i}from"./vendor-mui-core-
|
|
1
|
+
import{j as e,T as i}from"./vendor-mui-core-DHT36AZL.js";import{K as p,L as c}from"./vendor-utils-BSZ4yJws.js";import{l as x}from"./vendor-ux-sqP3hEhY.js";function y({name:t,nameFormatter:r=o=>typeof o=="string"?o.split(" ").map(f=>p(c(f))).join(" "):o,layout:n="horizontal",children:a,valueComponent:l="div",nameWidth:m=90,...s}){return e.jsxs(d,{layout:n,width:m,...s,children:[e.jsx(i,{color:"textSecondary",className:"info-row__name",children:r(t)}),a&&e.jsx(i,{color:"textPrimary",component:l,className:"info-row__value",children:a})]})}const d=x("div")`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: ${t=>t.layout==="vertical"?"column":"row"};
|
|
4
4
|
justify-content: flex-start;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as l}from"./vendor-react-CUXIiAnY.js";import{V as C,$ as E,
|
|
1
|
+
import{r as l}from"./vendor-react-CUXIiAnY.js";import{V as C,$ as E,j as M,k as P}from"./vendor-ux-sqP3hEhY.js";import{k as y}from"./vendor-hooks-fhL5FJET.js";import{j as e,ak as s,a6 as S,aX as w,b1 as W,y as L,x as _,bc as B,M as D,T as z,a$ as A,I as K,bd as N,Q as F,W as U}from"./vendor-mui-core-DHT36AZL.js";import{c as $,_ as k}from"./index-CN4lpn74.js";import{a as V}from"./api-DIucIOLX.js";import{T as q}from"./table-tips-cVuoMOXE.js";import{u as G}from"./team-BnNEVFdE.js";import{u as H}from"./session-DNlfWI2Z.js";import"./vendor-utils-BSZ4yJws.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-3xKfH3F1.js";import"./use-mobile-DoKVMODs.js";import"./isURL-DskT4RKm.js";import"./use-app-logo-BWOYOuhG.js";function T({endpoint:i}){const[t,a]=l.useState("mcp-link"),x=k(),{api:h}=k(),{teamDid:m}=G(),{t:c,locale:p}=C(),{session:r}=H(),{data:u,run:o,loading:g}=y(()=>{const f={owner:$.SERVER_ROLES.ADMIN}[r?.user?.role]||r?.user?.role;return h.createAccessKey({input:{teamDid:m,passport:f,authType:"simple",remark:"Generated by MCP Servers"}})},{manual:!0}),{imgPrefix:n}=x,j=l.useMemo(()=>[{icon:e.jsx(s,{sx:{width:20,height:20},children:"🔗"}),value:"mcp-link",label:"MCP Link"},{icon:e.jsx(s,{component:"img",src:`${n}/mcp/claude.webp`,alt:"Claude",sx:{width:20,height:20}}),value:"claude",label:"Claude"},{icon:e.jsx(s,{component:"img",src:`${n}/mcp/cursor.png`,alt:"Cursor",sx:{width:20,height:20}}),value:"cursor",label:"Cursor"},{icon:e.jsx(s,{component:"img",src:`${n}/mcp/cline.png`,alt:"Cline",sx:{width:20,height:20}}),value:"cline",label:"Cline"},{icon:e.jsx(s,{component:"img",src:`${n}/mcp/roocline.png`,alt:"Roo Cline",sx:{width:20,height:20}}),value:"roo-cline",label:"Roo Cline"},{icon:e.jsx(s,{component:"img",src:`${n}/mcp/windsurf.png`,alt:"Windsurf",sx:{width:20,height:20}}),value:"windsurf",label:"Windsurf"},{icon:e.jsx(s,{component:"img",src:`${n}/mcp/witsy.png`,alt:"Witsy",sx:{width:20,height:20}}),value:"witsy",label:"Witsy"}],[n]),v=j.find(d=>d.value===t),b=l.useMemo(()=>u?.data?.accessKeySecret,[u]),R=l.useMemo(()=>!b&&t!=="mcp-link",[b,t]),I=d=>{const f=`npx @blocklet/install-mcp@latest i ${i} --client ${d} --streamableHTTP --oauth2Bearer ${b}`;switch(d){case"cursor":case"claude":case"cline":case"roo-cline":case"windsurf":case"witsy":return f;case"mcp-link":default:return i}};return e.jsxs(s,{className:"mcp-servers-container",children:[e.jsx(M,{tabs:j,current:t,onChange:a,scrollButtons:"auto",iconPosition:"start"}),e.jsxs(s,{children:[e.jsxs(s,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx(z,{component:"span",variant:"h6",sx:{fontWeight:"bold",my:2},children:t==="mcp-link"?v?.label:`${v?.label} ${c("installCommand")}`}),t!=="mcp-link"&&e.jsx(A,{href:`https://www.arcblock.io/docs/blocklet-developer/${p}/mcp-${t}`,target:"_blank",rel:"noopener noreferrer",children:e.jsx(K,{size:"small",children:e.jsx(N,{fontSize:"small"})})})]}),e.jsxs(s,{className:"mcp-servers-codeblock",sx:{position:"relative","& pre":{borderRadius:1},"& .codeblock__inner":{overflow:"auto !important",borderRadius:1}},children:[e.jsx(P,{code:I(t),language:"shell",style:{margin:0},showDefaultText:!1}),R&&e.jsx(s,{sx:{position:"absolute",top:0,right:0,left:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",bgcolor:"action.active",backdropFilter:"blur(3px)",WebkitBackdropFilter:"blur(3px)",zIndex:1},children:g?e.jsx(S,{}):e.jsx(F,{variant:"contained",color:"primary",onClick:o,size:"small",children:`${c("common.generate")} ${c("command")}`})})]})]})]})}T.propTypes={endpoint:U.string.isRequired};function ce(){const[i,t]=l.useState(null),{t:a,locale:x}=C(),h=`${window?.blocklet?.appUrl}${$.WELLKNOWN_SERVICE_PATH_PREFIX}/mcp/servers`,{data:m,loading:c,error:p}=y(()=>Promise.all([V.get(h)])),r=l.useMemo(()=>m?.[0]?.data?.servers||[],[m]);l.useEffect(()=>{r?.length&&t(r.find(o=>o.did===window?.blocklet?.did)||r[0])},[r]);const u=o=>{const g=o.target.value;t(r.find(n=>n.did===g))};return c?e.jsx(s,{children:e.jsx(S,{})}):p?e.jsx(w,{color:"error",children:p?.message}):r?.length?e.jsxs(W,{sx:{gap:2,maxWidth:1200},children:[e.jsx(q,{title:a("mcp.listTitle"),tooltipTitle:a("mcp.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${x}/mcp-server`}),e.jsxs(L,{fullWidth:!0,children:[e.jsx(_,{id:"server-select-label",children:a("mcp.available")}),e.jsx(B,{labelId:"server-select-label",value:i?.did||"",label:a("mcp.available"),onChange:u,children:r.map(o=>e.jsx(D,{value:o.did,children:e.jsxs(s,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(E,{variant:"rounded",shape:"square",did:o.did,src:o.logo,size:20}),e.jsx(s,{sx:{fontSize:14},children:o.name})]})},o.did))})]}),i&&e.jsx(T,{endpoint:i.endpoint})]}):e.jsx(w,{color:"warning",children:a("mcp.noServer")})}export{ce as default};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{j as e,W as u,a6 as z,T as j,at as _e,D as We,cI as
|
|
2
|
-
`)},backgroundColor:a.palette.background.paper,borderColor:a.palette.divider,textStyle:{color:a.palette.text.primary,fontSize:14},extraCssText:`box-shadow: ${a.shadows[2]}; border-radius: 4px;`,padding:[8,10]},visualMap:{show:!1,min:-12,max:12,pieces:[{min:Number.MIN_SAFE_INTEGER,max:-9,color:J[600]},{min:-9,max:-6,color:J[500]},{min:-6,max:-3,color:J[400]},{min:-3,max:-1,color:J[300]},{min:0,max:0,color:a.palette.grey[200]},{min:1,max:3,color:V[300]},{min:3,max:6,color:V[400]},{min:6,max:9,color:V[500]},{min:9,max:Number.MAX_SAFE_INTEGER,color:V[600]}],orient:"horizontal",left:"center",bottom:12,itemWidth:12,itemHeight:12,textStyle:{color:a.palette.text.secondary,fontSize:12}},calendar:{top:30,left:50,right:10,bottom:4,cellSize:[8,8],splitLine:{show:!1},itemStyle:{borderWidth:2,borderColor:a.palette.background.default,color:a.palette.background.default},dayLabel:{show:!0,firstDay:0,nameMap:["","Mon","","Wed","","Fri",""],position:"start",margin:4,fontSize:10,color:a.palette.text.primary,fontWeight:"400",width:20},monthLabel:{show:!0,nameMap:"cn",align:"left",color:a.palette.text.primary,fontWeight:"400",fontSize:12,position:"start",margin:4,width:30,padding:[0,2]},yearLabel:{show:!1},range:[E().subtract(11,"month").startOf("month").format("YYYY-MM-DD"),E().endOf("month").format("YYYY-MM-DD")],orient:"horizontal"},series:{type:"heatmap",coordinateSystem:"calendar",data:i.map(k=>[k.date,k.errorCount?-k.errorCount:k.successCount]),label:{show:!1},itemStyle:{borderWidth:2,borderColor:a.palette.background.default,borderRadius:4},emphasis:{itemStyle:{borderWidth:2,borderColor:Ke[200],color:"inherit"}}}}),[i,t,a]);return e.jsxs(e.Fragment,{children:[e.jsx(h,{ref:r,sx:{maxWidth:"1280px",border:"1px solid",borderColor:"divider",padding:"8px",overflowX:"auto"},children:e.jsx(h,{sx:{width:"1200px",height:"180px",position:"relative"},children:e.jsx(Et,{option:d,style:{height:"100%",width:"100%"},notMerge:!0,lazyUpdate:!1,opts:{renderer:"canvas"},onEvents:{click:l=>{l.componentType==="series"&&l.data&&c(l.data[0])}}})})}),e.jsx(h,{sx:{display:"flex",justifyContent:"flex-end",mt:1,mr:s?2:5,mb:2},children:e.jsxs(K,{direction:s?"column":"row",spacing:s?2:1,sx:{width:"100%",justifyContent:"flex-start",alignItems:s?"flex-start":"center"},children:[e.jsxs(K,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(h,{sx:{width:32,height:12,borderRadius:.5,background:"linear-gradient(90deg, #8B5000 0%, #A36200 33%, #C17700 66%, #E29000 100%)"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.failed")})]}),e.jsxs(K,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(h,{sx:{width:32,height:12,borderRadius:.5,bgcolor:"grey.200",border:"1px solid",borderColor:"grey.200"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.without")})]}),e.jsxs(K,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(h,{sx:{width:32,height:12,borderRadius:.5,background:"linear-gradient(90deg, #9be9a8 0%, #40c463 33%, #30a14e 66%, #216e39 100%)"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.succeeded")})]})]})})]})}const Nt=fe(({className:t,...n})=>e.jsx(ge,{...n,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function ve({status:t,message:n="",createdAt:o}){const{t:s}=D(),r=t===T.BACKUPS.STATUS.PROGRESS&&E().diff(o,"hours")>=T.BACKUPS.TIMEOUT_HOURS,a=r&&s("common.timeoutError"),c=t===T.BACKUPS.STATUS.PROGRESS&&!r,i=t===T.BACKUPS.STATUS.SUCCEEDED&&!r;return c?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(z,{sx:{marginRight:"4px"},size:"12px"}),s("common.progress")]}):i?e.jsx(q,{type:"success",children:s("common.succeeded")}):e.jsxs(h,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(q,{type:"error",children:s("common.failed")}),e.jsx(ge,{style:{display:"flex",alignItems:"center",flexShrink:0},title:n||a,children:e.jsx(be,{children:e.jsx(Ye,{style:{width:"24px",height:"24px"},color:"error"})})})]})}ve.propTypes={status:u.string.isRequired,message:u.string,createdAt:u.string.isRequired};function ze({metadata:t={}}){const{t:n}=D();if(H(t))return e.jsx(q,{type:"success",children:n("common.succeeded")});const o=t.count||0,s=t.size||0,r=It(s,{iec:!0}),a=e.jsxs(h,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:[e.jsxs(j,{variant:"body2",children:[n("common.fileCount"),": ",o]}),e.jsxs(j,{variant:"body2",children:[n("common.fileSize"),": ",r]})]});return e.jsxs(h,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(q,{type:"success",children:n("common.succeeded")}),e.jsx(Nt,{title:a,style:{display:"flex",alignItems:"center",flexShrink:0},placement:"left",children:e.jsx(be,{children:e.jsx(Fe,{style:{width:"24px",height:"24px"},color:"primary"})})})]})}ze.propTypes={metadata:u.object};function Oe(){const{t,locale:n}=D(),{spaceGateways:o,backups:s,backupsLoading:r}=U(),a=b.useMemo(()=>[{label:"DID Space",name:"target",options:{customBodyRenderLite:i=>{const{targetUrl:d,targetName:l,status:x,createdAt:g}=s[i],m=x===T.BACKUPS.STATUS.PROGRESS&&E().diff(g,"hours")>=T.BACKUPS.TIMEOUT_HOURS,p=x===T.BACKUPS.STATUS.SUCCEEDED&&!m,k=l||o.find(w=>d?.includes(xe(w?.endpoint)))?.name||"Unknown DID Space";return p?e.jsx(Ge,{href:d,target:"_blank",sx:{fontSize:"16px"},children:k}):e.jsx(j,{variant:"body1",sx:{fontSize:"16px"},children:k})}}},{label:t("common.strategy"),name:"strategy",options:{customBodyRender:i=>{const d=t(i===0?"common.auto":"common.manual");return e.jsx(q,{children:d})}}},{label:t("common.startTime"),name:"createdAt",options:{customBodyRender:i=>E(i).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.endTime"),name:"updatedAt",options:{customBodyRender:i=>H(i)?"":E(i).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.status"),name:"status",options:{customBodyRenderLite:i=>{const d=s?.[i]??{},{status:l,message:x,createdAt:g,metadata:m}=d,p=l===T.BACKUPS.STATUS.PROGRESS&&E().diff(g,"hours")>=T.BACKUPS.TIMEOUT_HOURS,k=l===T.BACKUPS.STATUS.PROGRESS&&!p,w=l===T.BACKUPS.STATUS.SUCCEEDED&&!p;return k?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(z,{sx:{marginRight:"4px"},size:"12px"}),t("common.progress")]}):w?e.jsx(ze,{metadata:m}):e.jsx(ve,{status:l,message:x,createdAt:g})}}}],[s,o,t]),c=b.useMemo(()=>!s?.length,[s]);return e.jsx(e.Fragment,{children:c?e.jsx(h,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100px",color:"#9397A1",marginTop:"16px",marginBottom:"24px"},children:t("storage.spaces.record.emptyData")}):e.jsx(rt,{title:"",loading:r,data:s,columns:a,emptyNode:t("storage.spaces.record.emptyData",n),options:{download:!1,filter:!1,print:!1,search:!1,viewColumns:!1}})})}function _t(){const{t}=D();return e.jsxs(h,{children:[e.jsxs(h,{sx:{display:"flex",gap:3,flexDirection:{xs:"column",md:"row"}},children:[e.jsxs(h,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",alignContent:"center",minWidth:240},children:[e.jsx(xt,{style:{cursor:"pointer",width:"150px",height:"100%",maxHeight:160}}),e.jsx(j,{sx:{my:2,textAlign:"center",color:"text.secondary"},children:t("storage.spaces.connect.provider")}),e.jsx(Re,{})]}),e.jsxs(h,{sx:{flexGrow:1,minWidth:0},children:[e.jsx(h,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:t("storage.spaces.backup.records")})}),e.jsx(Ae,{})]})]}),e.jsx(Oe,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2,mt:2},children:t("common.dataStorage")}),e.jsx(Pe,{})]})}function Le({spaceGateway:t,onConfirm:n=()=>{},onCancel:o=()=>{}}){const{t:s}=D(),[r,a]=b.useState(!1),[c,i]=b.useState(!1),d=(g,m)=>{g?.preventDefault(),g?.stopPropagation(),a(m)},l=async g=>{try{g?.stopPropagation(),i(!0),await n?.(t),a(!1)}catch(m){console.error(m),B.error(`${s("storage.space.gateway.delete.failed")}: ${Q(m)}`)}finally{a(!1),i(!1)}},x=g=>{d(g,!1),o?.(g)};return e.jsxs(e.Fragment,{children:[e.jsxs(F,{color:"red",onClick:g=>d(g,!0),children:[e.jsx(Y,{style:{minWidth:24,color:"red"},children:e.jsx($e,{fontSize:"small"})}),e.jsx($,{style:{color:"red"},children:s("common.disconnect")})]}),e.jsx(it,{title:s("storage.spaces.gateway.delete.title"),open:r,confirmButton:{text:s("common.confirm"),props:{size:"small",variant:"contained",color:"error",loading:c}},cancelButton:{text:s("common.cancel"),props:{size:"small",variant:"outlined",disabled:c}},onConfirm:l,onCancel:x,children:e.jsx(j,{sx:{wordWrap:"break-word"},children:s("storage.spaces.gateway.delete.descForBackup",{name:`${t?.name}`})})})]})}Le.propTypes={spaceGateway:u.shape({name:u.string.isRequired,url:u.string.isRequired,protected:u.bool}).isRequired,onConfirm:u.func,onCancel:u.func};function Ue({spaceGateway:t,selected:n,onDelete:o=()=>{},onConnect:s=()=>{},enableSwitchToSpace:r=!0,backupInProgress:a=!1,...c}){const{abortBlockletBackup:i}=U(),[d,l]=b.useState(null),{t:x}=D(),[g,m]=b.useState(!1),p=(S,y)=>{S.stopPropagation(),S.preventDefault(),l(y&&S.currentTarget)},k=async S=>{try{m(!0),p(S,!1),await s(t)}catch(y){console.error(y),B.error(y.message)}finally{m(!1)}},w=async S=>{try{m(!0),p(S,!1),await i()}catch(y){console.error(y),B.error(y.message)}finally{m(!1)}};return e.jsxs(e.Fragment,{children:[g||t?.loading?e.jsx(z,{sx:{ml:1},size:"24px"}):e.jsx(qe,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions",variant:"outlined",size:"small",onClick:S=>p(S,!0),...c,children:e.jsx(He,{})}),e.jsxs(Qe,{id:"simple-menu",anchorEl:d,keepMounted:!0,open:!!d,onClose:S=>p(S,!1),children:[e.jsxs(F,{onClick:S=>{p(S,!1),window.open(Se(t.endpoint?Ct(t.endpoint):t.url,{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Xe,{fontSize:"small"})}),e.jsx($,{children:x("common.open")})]}),e.jsxs(F,{onClick:S=>{p(S,!1),window.open(Se(wt(t.endpoint),{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Je,{fontSize:"small"})}),e.jsx($,{children:x("storage.spaces.strategy.viewBackupFiles")})]}),!n&&r&&e.jsxs(F,{onClick:k,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Ve,{fontSize:"small"})}),e.jsx($,{children:x("storage.spaces.connect.switchToSpace")})]}),a&&e.jsxs(F,{onClick:w,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Ze,{fontSize:"small"})}),e.jsx($,{children:x("storage.spaces.connect.abortBlockletBackup")})]}),!a&&e.jsx(Le,{spaceGateway:t,onConfirm:async()=>{l(null),await o?.(t)},onCancel:()=>l(null)})]})]})}Ue.propTypes={spaceGateway:u.shape({name:u.string.isRequired,url:u.string.isRequired,protected:u.bool,endpoint:u.string.isRequired,loading:u.bool}).isRequired,selected:u.bool.isRequired,enableSwitchToSpace:u.bool,onDelete:u.func,onConnect:u.func,backupInProgress:u.bool};const Wt=fe(({className:t,...n})=>e.jsx(ge,{...n,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function Me({spaceGateway:t,spaceStatus:n,selected:o,onConnected:s=()=>{},onDeleted:r=()=>{},onBackedUp:a=()=>{}}){const{t:c,locale:i}=D(),{blocklet:d}=O(),{api:l,info:{did:x}}=L(),{appDid:g,appName:m,appDescription:p,scopes:k,appUrl:w,referrer:S}=De({blocklet:d}),{backupProgress:y,updateSpaceGateway:Z,deleteSpaceGateway:ee,refreshBackupSummary:te,refreshBackups:se}=U(),[_,M]=b.useState(!1),[I,P]=b.useState({open:!1,action:"one-click-authorization",checkTimeout:1e3*300,messages:{title:c("storage.spaces.authorize.title",{appName:m},i),scan:c("storage.spaces.authorize.scan",{appName:m},i),confirm:"",success:e.jsx(j,{gutterBottom:!0,children:c("storage.spaces.authorize.success")})},onClose:()=>{P(C=>({...C,open:!1}))}}),ne=o&&!_&&n===de.DISCONNECTED,oe=o&&!_&&!t.loading&&n===de.CONNECTED,G=o&&_&&n===de.CONNECTED&&y?.progress>=0,X=async()=>{try{if(await Bt(t?.endpoint)){await l.configBlocklet({input:{did:[d.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:t.endpoint}]}}),B.success(c("storage.spaces.connect.switchToSpaceSucceeded",{name:t.name?`(${t.name})`:""})),s?.(null,t);return}}catch(C){console.error(C),s?.(C,t);return}P(C=>({...C,open:!0,prefix:me(t.url,"space/api/did"),baseUrl:new URL(t.url).origin,checkFn:we.create({baseURL:me(t.url,"space")}).get,extraParams:{appDid:g,appName:m,appDescription:p,scopes:k,appUrl:w,referrer:S,nodeDid:x,spaceDid:t.did}}))},ae=async(C,f)=>{const v=f(C.endpoint),R=xe(v),A=C.space?f(C.space):{};if(t.did&&R!==t.did){P(Ne=>({...Ne,open:!1}));const W=c("storage.spaces.gateway.switch.failedForMismatchSpace",{name:A?.name?A.name:""});B.error(W),s?.(new Error(W),t);return}const ce={...t,name:A.name??"DID Space",did:A.did??xe(v),endpoint:v};await Z(ce),P(W=>({...W,open:!1})),s?.(null,ce)},re=async()=>{try{if(_)return;M(!0),await l.backupBlocklet({input:{appDid:d.appDid,to:"spaces"}})}catch(C){console.error(C),B.error(C.message),a?.(C,t)}finally{M(!0)}},ie=async()=>{try{await ee(t),B.success(c("storage.spaces.gateway.delete.succeeded",{name:t.name?`(${t.name})`:""})),r?.(null,t)}catch(C){console.error(C),r?.(C,t)}};return b.useEffect(()=>{y?.completed?(o&&(y?.progress===100?(B.success(c("storage.spaces.backupSuccessfully")),a?.(null,t)):y.message&&a?.(new Error(y?.message),t),y.progress=0,y.message=""),M(!1),te(),se()):y.progress&&M(!0)},[y]),e.jsxs(e.Fragment,{children:[e.jsxs(h,{sx:{display:"flex",alignItems:"center",".action-btn":{borderRadius:1,marginLeft:1}},children:[oe&&e.jsx(le,{className:"action-btn",variant:"outlined",size:"small",onClick:re,children:c("storage.spaces.strategy.backupNow")}),ne&&e.jsx(le,{className:"action-btn",variant:"outlined",size:"small",onClick:X,children:c("storage.spaces.disconnected.reconnectNow")}),G&&e.jsx(Wt,{title:y?.message&&e.jsx(h,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:e.jsx(j,{variant:"body2",children:y.message})}),children:e.jsxs(le,{className:"action-btn",variant:"outlined",size:"small",sx:{minWidth:70},children:[e.jsx(z,{variant:"determinate",value:y?.progress,size:14,sx:{mr:1}}),y?.progress,"%"]})}),e.jsx(ot,{forceConnected:!1,saveConnect:!1,prefix:I.prefix,open:I.open,popup:!0,action:I.action,baseUrl:I.baseUrl,checkFn:I.checkFn,onSuccess:ae,onClose:I.onClose,checkTimeout:I.checkTimeout,extraParams:I.extraParams,messages:I.messages,locale:i},"get-endpoint")]}),e.jsx(Ue,{sx:{minWidth:32,padding:"2px 4px",ml:1},spaceGateway:t,selected:o,onDelete:ie,onConnect:X,enableSwitchToSpace:y?.completed||H(y?.message),backupInProgress:G})]})}Me.propTypes={spaceGateway:u.shape({did:u.string.isRequired,name:u.string.isRequired,url:u.string.isRequired,endpoint:u.string.isRequired,protected:u.bool,loading:u.bool}).isRequired,spaceStatus:u.string.isRequired,selected:u.bool.isRequired,onConnected:u.func,onDeleted:u.func,onBackedUp:u.func};function Kt({...t}){const{t:n}=D();return e.jsxs(h,{...t,children:[e.jsx(h,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:n("storage.spaces.backup.records")})}),e.jsx(Ae,{}),e.jsx(Oe,{})]})}function Gt({...t}){const{t:n}=D(),{autoBackup:o,updateAutoBackup:s}=U(),r=async()=>{try{const a=!o?.enabled;await s({enabled:a}),B.success(n(a?"storage.spaces.autoBackup.enabled":"storage.spaces.autoBackup.disabled"))}catch(a){B.error(a.message)}};return e.jsx(Tt,{checked:!!o?.enabled,onChange:r,name:"enableWelcomePage",labelProps:{label:e.jsx(j,{sx:{marginRight:"8px"},children:e.jsx("span",{children:n("storage.spaces.autoBackup.title")})})},style:{...t.style}})}function Ft(){const{t}=D(),{spaceGateways:n,spaceGatewaysLoading:o,spaceGatewayIsSelected:s}=U(),r=o&&!n?.length,a=({spaceGateway:c,spaceStatus:i,selected:d,refresh:l})=>e.jsx(Me,{spaceGateway:c,spaceStatus:i,selected:d,onConnected:()=>l(),onBackedUp:x=>x&&l()});return e.jsxs(h,{sx:{display:"flex",flexDirection:"column"},children:[e.jsxs(h,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},gap:{xs:1,md:2},justifyContent:{xs:"center",md:"flex-start"},alignItems:{xs:"flex-start",md:"center"}},children:[e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",flexGrow:1},children:t("storage.spaces.connected.title")}),e.jsx(Gt,{}),e.jsx(Re,{})]}),e.jsx(h,{sx:{mt:2},children:r?e.jsx(h,{sx:{display:"flex",justifyContent:"center"},children:e.jsx(z,{})}):e.jsx(he,{container:!0,spacing:2,children:e.jsx(e.Fragment,{children:n.map(c=>e.jsx(he,{size:{xs:12,md:6},children:e.jsx(ft,{endpoint:c.endpoint,selected:s(c),action:a},c.endpoint)},c.endpoint))})})}),e.jsx(Kt,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2},children:t("common.dataStorage")}),e.jsx(Pe,{})]})}function Yt(){const{spaceGatewaysFirstLoading:t,spaceGateways:n}=U();return t?e.jsx(Be,{relative:"parent",children:e.jsx(z,{})}):H(n)?e.jsx(_t,{}):e.jsx(Ft,{})}function $t(){return e.jsx(Te,{children:e.jsx(Yt,{})})}function qt(){const{spaceGateway:t,settingStorageEndpoint:n,updateSpaceGateway:o,hasStorageEndpoint:s,loading:r,storageEndpoint:a}=Pt(),c=ue(()=>({display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"16px"}));return r?e.jsx(Be,{relative:"parent",children:e.jsx(z,{})}):e.jsxs(h,{sx:{maxWidth:"md",position:"relative"},children:[s?e.jsx(gt,{spaceGateway:t,settingStorageEndpoint:n}):e.jsx(ht,{}),e.jsx(h,{sx:c,children:e.jsx(St,{onConnect:o,storageEndpoint:a})})]})}function Ht(){const{t}=D();return e.jsxs(Rt,{children:[e.jsxs(K,{spacing:1,sx:{marginBottom:2},children:[e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:t("storage.appLevel.title")}),e.jsx(j,{sx:{color:"text.secondary"},children:t("storage.appLevel.description")})]}),e.jsx(qt,{})]})}function Qt({navOrientation:t="vertical",...n}){const{t:o,locale:s}=D(),{blocklet:r}=O(),a=lt({key:"md"}),[c,i]=et(),d=c.get("tab")||"backup",l=a?"horizontal":t,x=ue(()=>{const w=[{label:o("common.backup"),value:"backup"}],S=r?.capabilities?.didSpace;return(S===N.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED||S===N.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP)&&w.push({label:o("common.storage"),value:"storage"}),w},[s,l]),m=ue(()=>({backup:e.jsx($t,{}),storage:e.jsx(Ht,{})}))[d],p=w=>{i(S=>(w==="backup"?S.delete("tab"):S.set("tab",w),S))};if(x.length<=1)return e.jsx(pe,{children:m});const k=e.jsx(ct,{tabs:x,current:d,orientation:l,onChange:p,sx:[{borderRight:1,height:"100%",borderColor:"divider"},l==="horizontal"&&{borderRight:0}]});if(l==="vertical")return e.jsx(h,{...n,children:e.jsxs(K,{direction:{md:"column",lg:"row"},sx:{gap:2},children:[e.jsx(h,{sx:{flexShrink:0},children:e.jsx(ye,{left:k})}),e.jsx(h,{sx:{flexGrow:1,minWidth:0},children:e.jsx(pe,{sx:{mt:1},children:m})})]})});if(l==="horizontal")return e.jsxs(h,{...n,children:[e.jsx(ye,{left:k}),e.jsx(pe,{sx:{mt:2},children:m})]})}Qt.propTypes={navOrientation:u.oneOf(["vertical","horizontal"])};const pe=fe(h)`
|
|
1
|
+
import{j as e,W as u,a6 as z,T as j,at as _e,D as We,cI as V,ao as J,cJ as Ke,ak as h,b1 as K,a$ as Ge,s as fe,cK as be,cp as Fe,am as ge,cr as Ye,M as F,aO as Y,bX as $e,aP as $,Q as qe,be as He,aR as Qe,cL as Xe,cM as Ve,cN as Je,cO as Ze,c2 as he}from"./vendor-mui-core-DHT36AZL.js";import{k as ke,j as je,a as ue}from"./vendor-hooks-fhL5FJET.js";import{r as b,u as et}from"./vendor-react-CUXIiAnY.js";import{ac as O,_ as L,a1 as E,Y as N,aQ as tt,aR as st,aI as nt,c as T,v as ot}from"./index-CN4lpn74.js";import{H as B,V as D,p as at,Q as q,h as rt,W as it,n as le,j as ct}from"./vendor-ux-sqP3hEhY.js";import{u as lt}from"./use-mobile-DoKVMODs.js";import{a as H,d as Ce,a0 as dt,c as pt,D as we,C as me}from"./vendor-utils-BSZ4yJws.js";import{o as Be}from"./vendor-arcblock-3xKfH3F1.js";import{b as ut,u as mt,D as xt,c as de,a as ft}from"./index-DQB7DBpQ.js";import"./index-bbu7QFpz.js";import"./index-BojVbZw0.js";import"./api-DIucIOLX.js";import{u as De,C as gt,D as ht,a as St}from"./connect-to-B-qzDPba.js";import{b as yt,c as bt,d as kt,i as jt,e as xe,f as Ct,h as wt,j as Bt}from"./spaces-B9YyAxJd.js";import{f as Q}from"./index-DBs9Ljax.js";import{v as Dt}from"./index-BF7MtybM.js";import{E as Et}from"./index-DA2Pny4B.js";import{x as It}from"./index-DRYJ0xIl.js";import{g as Se}from"./get-safe-url-DT47R_1b.js";import{S as Tt}from"./switch-control-DdOZdvsu.js";import{C as Rt,u as Pt}from"./config-space-BSBup5aB.js";import{L as ye}from"./list-header-CA-QkwGq.js";import"./lottie-web-4koyQiv_.js";import"./index-B9Igf2rm.js";async function vt({blockletDid:t,nodeApi:n,spaceGateways:o}){let s=!1;const r=await Promise.all(o.map(async a=>{let{name:c}=a;const i=await yt(a.endpoint);return!H(i)&&i!==c&&(c=i,s=!0),{...a,name:c}}));return s&&await Promise.all(r.filter(a=>a.did).map(a=>n.updateBlockletSpaceGateway({input:{did:t,where:{did:a.did},spaceGateway:{...a}}}))),r}function At({refresh:t}={}){const{blocklet:n}=O(),o=n?.meta?.did,{api:s}=L();return ke(async()=>{if(!o)return[];const{spaceGateways:r}=await s.getBlockletSpaceGateways({input:{did:o}});return await vt({blockletDid:o,nodeApi:s,spaceGateways:r})??[]},{refreshDeps:[o,t],onError(r){r?.message?.includes("not logged")?console.warn(r):(console.error(r),B.error(Q(r)))}})}function Ee({deps:t,setLoading:n,backupDate:o}={deps:[],setLoading:()=>{},backupDate:new Date}){const{blocklet:s}=O(),[r,a]=b.useState([]),{api:c}=L(),[i,d]=b.useMemo(()=>o?[E(o).startOf("day").toISOString(),E(o).endOf("day").toISOString()]:[E().startOf("year").toISOString(),E().endOf("day").toISOString()],[o]),l=Ce(async()=>{try{if(n(!0),!s){a([]);return}const{backups:x}=await c.getBlockletBackups({input:{did:s.meta.did,startTime:i,endTime:d}});a(x??[])}catch(x){console.error(x),B.error(Q(x))}finally{n(!1)}},1e3);return je(async()=>{l()},[s?.meta?.did].concat(t)),{backups:r}}function zt({appDid:t}){const{backups:n}=Ee(),[o,s]=b.useState({message:"",progress:0,completed:!1}),r=L(),{ws:{useSubscription:a}}=r;return a(N.BlockletEvents.backupProgress,c=>{t===c?.appDid&&s(()=>({...c}))},[t]),b.useEffect(()=>{if(n?.length&&dt(n[0]?.status)){const[c]=n;s(()=>({message:c.message,progress:c.progress,completed:c.progress>=100}))}},[n]),o}function Ot({deps:t=[],setLoading:n=()=>{}}={}){const{blocklet:o}=O(),[s,r]=b.useState([]),{api:a}=L(),c=b.useCallback(Ce(async()=>{if(!a||!o?.meta?.did){r([]);return}try{n(!0);const i=E(),d=i.subtract(1,"year"),{summary:l}=await a.getBlockletBackupSummary({input:{did:o.meta.did,startTime:d.toISOString(),endTime:i.toISOString()}});r(Array.isArray(l)?l:[])}catch(i){console.error("Failed to fetch backup summary:",i),B.error(Q(i)),r([])}finally{n(!1)}},1e3),[]);return je(async()=>(await c(),()=>{c.cancel()}),[o?.meta?.did].concat(t)),{backupSummary:s}}const Ie=b.createContext({}),{Provider:Lt,Consumer:bs}=Ie;function Te({children:t}){const{t:n}=D(),{api:o}=L(),{blocklet:s}=O(),[r,a]=b.useState(null),[c,i]=b.useState(!1),{data:d,loading:l,mutate:x}=At({refresh:c}),g=pt(d),m=zt({appDid:s?.appDid}),p=b.useMemo(()=>bt(s?.environments),[s?.environments]),[k,w]=b.useState(!1),[S,y]=b.useState(0),{backups:Z}=Ee({deps:[S,r],setLoading:w,backupDate:r}),[ee,te]=b.useState(0),{backupSummary:se}=Ot({deps:[ee]}),[_,M]=b.useState(d?.find(f=>f.endpoint===p)),I=s?.settings?.autoBackup,P=()=>{i(f=>!f)},ne=()=>{te(f=>f+1)},oe=()=>{y(f=>f+1)},G=async f=>{await o.updateAutoBackup({input:{did:s.meta.did,autoBackup:f}})},X=async()=>{await o.abortBlockletBackup({input:{appPid:s.meta.did}})},ae=async(f,A)=>{try{x(R=>{const v=[...R];return v.push({...f,loading:!0}),v}),await o.addBlockletSpaceGateway({input:{did:s.meta.did,spaceGateway:f}}),p!==A&&await o.configBlocklet({input:{did:[s.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:A}]}}),M(f),P(),B.success(n("storage.spaces.connectedWithName",{name:f?.name??"DID Spaces"}))}catch(R){throw console.error(R),x(v=>[...v].filter(W=>W.did!==f.did)),R}},re=async f=>{f&&(f.endpoint===p&&(await o.configBlocklet({input:{did:[s.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),I?.enabled&&await G({enabled:!1})),await o.deleteBlockletSpaceGateway({input:{did:s.meta.did,spaceGatewayDid:f?.did}}),x(A=>{const R=[...A];return R.splice(R.indexOf(f),1),R}),M(f),P())},ie=async f=>{await Promise.all([o.updateBlockletSpaceGateway({input:{did:s.meta.did,where:{did:f.did},spaceGateway:f}}),p!==f.endpoint&&o.configBlocklet({input:{did:[s.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:f.endpoint}]}})]),B.success(n("storage.spaces.connectedWithName",{name:f?.name??"DID Spaces"})),P()},C=f=>f?.endpoint===p;return e.jsx(Lt,{value:{spaceGateways:d||[],selectedSpaceGateway:_,addSpaceGateway:ae,deleteSpaceGateway:re,updateSpaceGateway:ie,refreshSpaceGateways:P,spaceGatewaysLoading:l,spaceGatewaysFirstLoading:g,spaceGatewayIsSelected:C,updateAutoBackup:G,abortBlockletBackup:X,backupEndpoint:p,backupProgress:m,backups:Z,backupSummary:se,refreshBackupSummary:ne,refreshBackups:oe,setBackupDate:a,backupsLoading:k,autoBackup:I},children:t})}Te.propTypes={children:u.any.isRequired};function U(){return b.useContext(Ie)}function Re({...t}){const{blocklet:n}=O(),{info:o}=L(),{t:s}=D(),r=De({blocklet:n}),a=tt(o),{spaceGateways:c,addSpaceGateway:i}=U(),d={checkFn:we.create({baseURL:me(window.location.origin,st())}).get,webWalletUrl:a,extraParams:{appPid:n.appPid,appDid:r.appDid,appName:r.appName,appDescription:r.appDescription,appUrl:r.appUrl,referrer:r.referrer,scopes:r.scopes,nodeDid:o.did}},l=async({endpoint:g,name:m,did:p})=>{const k=await kt(g);if(!await jt(k)){B.error(s("storage.spaces.gateway.add.invalidUrl"));return}if(c.some(y=>y.endpoint===g)){B.error(s("storage.spaces.gateway.add.duplicate",{name:m}));return}await i({name:m,did:p,url:k,endpoint:g},g)},x=async({spaceGateway:g})=>{try{await l(g)}catch(m){console.error(m),B.error(Q(m))}};return e.jsx(ut,{...t,connectScope:"app",options:d,onSuccess:x})}function Ut(){const{api:t}=L(),{blocklet:n}=O(),{data:o,loading:s}=ke(()=>t.getBlocklet({input:{did:n?.meta?.did,attachDiskInfo:!0,attachRuntimeInfo:!0}}),{ready:!!n?.meta?.did,refreshDeps:[n?.meta?.did]});return{blocklet:o?.blocklet??null,loading:s}}function Pe({...t}){const{t:n}=b.useContext(at),{blocklet:o,loading:s}=Ut();if(o?.diskInfo){const r=(i,d,l)=>e.jsxs(j,{children:[i," ",e.jsx("strong",{children:d?nt(d):"empty"})]}),a=o.environments.reduce((i,d)=>(i[d.key]=d.value,i),{}),c=[{key:"appDir",name:n("blocklet.diskInfo.appDir"),value:r(a.BLOCKLET_APP_DIR,o.diskInfo.app)},{key:"dataDir",name:n("blocklet.diskInfo.dataDir"),value:r(a.BLOCKLET_DATA_DIR,o.diskInfo.data)},{key:"logDir",name:n("blocklet.diskInfo.logDir"),value:r(a.BLOCKLET_LOG_DIR,o.diskInfo.log)},{key:"cacheDir",name:n("blocklet.diskInfo.cacheDir"),value:r(a.BLOCKLET_CACHE_DIR,o.diskInfo.cache)}];return e.jsx(Mt,{component:"div",...t,children:c.map(i=>e.jsx(Dt,{valueComponent:"div",nameWidth:120,name:i.name,children:i.value},i.key))})}return s?e.jsx(z,{}):e.jsx(j,{children:n("blocklet.diskInfo.empty")})}const Mt=_e(j)``;function ve(){const{t}=D(),{setBackupDate:n,backupSummary:o}=U(),s=mt({key:"lg"}),r=b.useRef(null),a=We(),c=b.useCallback(l=>{n(l)},[n]),i=b.useMemo(()=>{const l=E().add(1,"day"),x=l.subtract(1,"year"),g=new Map(o.map(p=>[p.date,{date:p.date,successCount:p.successCount,errorCount:p.errorCount}])),m=[];for(let p=x.clone();E(p).isBefore(l);p=p.add(1,"day")){const k=p.format("YYYY-MM-DD");m.push(g.get(k)||{date:k,successCount:0,errorCount:0})}return m},[o]),d=b.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:12},tooltip:{formatter:k=>{const{date:w,successCount:S,errorCount:y}=i[k.dataIndex]||{date:k.data[0],successCount:0,errorCount:0};return[`<div>${t("common.time")}: ${w}</div>`,`<div>${t("common.succeeded")}: ${S}</div>`,`<div>${t("common.failed")}: ${y}</div>`].join(`
|
|
2
|
+
`)},backgroundColor:a.palette.background.paper,borderColor:a.palette.divider,textStyle:{color:a.palette.text.primary,fontSize:14},extraCssText:`box-shadow: ${a.shadows[2]}; border-radius: 4px;`,padding:[8,10]},visualMap:{show:!1,min:-12,max:12,pieces:[{min:Number.MIN_SAFE_INTEGER,max:-9,color:V[600]},{min:-9,max:-6,color:V[500]},{min:-6,max:-3,color:V[400]},{min:-3,max:-1,color:V[300]},{min:0,max:0,color:a.palette.grey[200]},{min:1,max:3,color:J[300]},{min:3,max:6,color:J[400]},{min:6,max:9,color:J[500]},{min:9,max:Number.MAX_SAFE_INTEGER,color:J[600]}],orient:"horizontal",left:"center",bottom:12,itemWidth:12,itemHeight:12,textStyle:{color:a.palette.text.secondary,fontSize:12}},calendar:{top:30,left:50,right:10,bottom:4,cellSize:[8,8],splitLine:{show:!1},itemStyle:{borderWidth:2,borderColor:a.palette.background.default,color:a.palette.background.default},dayLabel:{show:!0,firstDay:0,nameMap:["","Mon","","Wed","","Fri",""],position:"start",margin:4,fontSize:10,color:a.palette.text.primary,fontWeight:"400",width:20},monthLabel:{show:!0,nameMap:"cn",align:"left",color:a.palette.text.primary,fontWeight:"400",fontSize:12,position:"start",margin:4,width:30,padding:[0,2]},yearLabel:{show:!1},range:[E().subtract(11,"month").startOf("month").format("YYYY-MM-DD"),E().endOf("month").format("YYYY-MM-DD")],orient:"horizontal"},series:{type:"heatmap",coordinateSystem:"calendar",data:i.map(k=>[k.date,k.errorCount?-k.errorCount:k.successCount]),label:{show:!1},itemStyle:{borderWidth:2,borderColor:a.palette.background.default,borderRadius:4},emphasis:{itemStyle:{borderWidth:2,borderColor:Ke[200],color:"inherit"}}}}),[i,t,a]);return e.jsxs(e.Fragment,{children:[e.jsx(h,{ref:r,sx:{maxWidth:"1280px",border:"1px solid",borderColor:"divider",padding:"8px",overflowX:"auto"},children:e.jsx(h,{sx:{width:"1200px",height:"180px",position:"relative"},children:e.jsx(Et,{option:d,style:{height:"100%",width:"100%"},notMerge:!0,lazyUpdate:!1,opts:{renderer:"canvas"},onEvents:{click:l=>{l.componentType==="series"&&l.data&&c(l.data[0])}}})})}),e.jsx(h,{sx:{display:"flex",justifyContent:"flex-end",mt:1,mr:s?2:5,mb:2},children:e.jsxs(K,{direction:s?"column":"row",spacing:s?2:1,sx:{width:"100%",justifyContent:"flex-start",alignItems:s?"flex-start":"center"},children:[e.jsxs(K,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(h,{sx:{width:32,height:12,borderRadius:.5,background:"linear-gradient(90deg, #8B5000 0%, #A36200 33%, #C17700 66%, #E29000 100%)"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.failed")})]}),e.jsxs(K,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(h,{sx:{width:32,height:12,borderRadius:.5,bgcolor:"grey.200",border:"1px solid",borderColor:"grey.200"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.without")})]}),e.jsxs(K,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(h,{sx:{width:32,height:12,borderRadius:.5,background:"linear-gradient(90deg, #9be9a8 0%, #40c463 33%, #30a14e 66%, #216e39 100%)"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.succeeded")})]})]})})]})}const Nt=fe(({className:t,...n})=>e.jsx(ge,{...n,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function Ae({status:t,message:n="",createdAt:o}){const{t:s}=D(),r=t===T.BACKUPS.STATUS.PROGRESS&&E().diff(o,"hours")>=T.BACKUPS.TIMEOUT_HOURS,a=r&&s("common.timeoutError"),c=t===T.BACKUPS.STATUS.PROGRESS&&!r,i=t===T.BACKUPS.STATUS.SUCCEEDED&&!r;return c?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(z,{sx:{marginRight:"4px"},size:"12px"}),s("common.progress")]}):i?e.jsx(q,{type:"success",children:s("common.succeeded")}):e.jsxs(h,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(q,{type:"error",children:s("common.failed")}),e.jsx(ge,{style:{display:"flex",alignItems:"center",flexShrink:0},title:n||a,children:e.jsx(be,{children:e.jsx(Ye,{style:{width:"24px",height:"24px"},color:"error"})})})]})}Ae.propTypes={status:u.string.isRequired,message:u.string,createdAt:u.string.isRequired};function ze({metadata:t={}}){const{t:n}=D();if(H(t))return e.jsx(q,{type:"success",children:n("common.succeeded")});const o=t.count||0,s=t.size||0,r=It(s,{iec:!0}),a=e.jsxs(h,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:[e.jsxs(j,{variant:"body2",children:[n("common.fileCount"),": ",o]}),e.jsxs(j,{variant:"body2",children:[n("common.fileSize"),": ",r]})]});return e.jsxs(h,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(q,{type:"success",children:n("common.succeeded")}),e.jsx(Nt,{title:a,style:{display:"flex",alignItems:"center",flexShrink:0},placement:"left",children:e.jsx(be,{children:e.jsx(Fe,{style:{width:"24px",height:"24px"},color:"primary"})})})]})}ze.propTypes={metadata:u.object};function Oe(){const{t,locale:n}=D(),{spaceGateways:o,backups:s,backupsLoading:r}=U(),a=b.useMemo(()=>[{label:"DID Space",name:"target",options:{customBodyRenderLite:i=>{const{targetUrl:d,targetName:l,status:x,createdAt:g}=s[i],m=x===T.BACKUPS.STATUS.PROGRESS&&E().diff(g,"hours")>=T.BACKUPS.TIMEOUT_HOURS,p=x===T.BACKUPS.STATUS.SUCCEEDED&&!m,k=l||o.find(w=>d?.includes(xe(w?.endpoint)))?.name||"Unknown DID Space";return p?e.jsx(Ge,{href:d,target:"_blank",sx:{fontSize:"16px"},children:k}):e.jsx(j,{variant:"body1",sx:{fontSize:"16px"},children:k})}}},{label:t("common.strategy"),name:"strategy",options:{customBodyRender:i=>{const d=t(i===0?"common.auto":"common.manual");return e.jsx(q,{children:d})}}},{label:t("common.startTime"),name:"createdAt",options:{customBodyRender:i=>E(i).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.endTime"),name:"updatedAt",options:{customBodyRender:i=>H(i)?"":E(i).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.status"),name:"status",options:{customBodyRenderLite:i=>{const d=s?.[i]??{},{status:l,message:x,createdAt:g,metadata:m}=d,p=l===T.BACKUPS.STATUS.PROGRESS&&E().diff(g,"hours")>=T.BACKUPS.TIMEOUT_HOURS,k=l===T.BACKUPS.STATUS.PROGRESS&&!p,w=l===T.BACKUPS.STATUS.SUCCEEDED&&!p;return k?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(z,{sx:{marginRight:"4px"},size:"12px"}),t("common.progress")]}):w?e.jsx(ze,{metadata:m}):e.jsx(Ae,{status:l,message:x,createdAt:g})}}}],[s,o,t]),c=b.useMemo(()=>!s?.length,[s]);return e.jsx(e.Fragment,{children:c?e.jsx(h,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100px",color:"#9397A1",marginTop:"16px",marginBottom:"24px"},children:t("storage.spaces.record.emptyData")}):e.jsx(rt,{title:"",loading:r,data:s,columns:a,emptyNode:t("storage.spaces.record.emptyData",n),options:{download:!1,filter:!1,print:!1,search:!1,viewColumns:!1}})})}function _t(){const{t}=D();return e.jsxs(h,{children:[e.jsxs(h,{sx:{display:"flex",gap:3,flexDirection:{xs:"column",md:"row"}},children:[e.jsxs(h,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",alignContent:"center",minWidth:240},children:[e.jsx(xt,{style:{cursor:"pointer",width:"150px",height:"100%",maxHeight:160}}),e.jsx(j,{sx:{my:2,textAlign:"center",color:"text.secondary"},children:t("storage.spaces.connect.provider")}),e.jsx(Re,{})]}),e.jsxs(h,{sx:{flexGrow:1,minWidth:0},children:[e.jsx(h,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:t("storage.spaces.backup.records")})}),e.jsx(ve,{})]})]}),e.jsx(Oe,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2,mt:2},children:t("common.dataStorage")}),e.jsx(Pe,{})]})}function Le({spaceGateway:t,onConfirm:n=()=>{},onCancel:o=()=>{}}){const{t:s}=D(),[r,a]=b.useState(!1),[c,i]=b.useState(!1),d=(g,m)=>{g?.preventDefault(),g?.stopPropagation(),a(m)},l=async g=>{try{g?.stopPropagation(),i(!0),await n?.(t),a(!1)}catch(m){console.error(m),B.error(`${s("storage.space.gateway.delete.failed")}: ${Q(m)}`)}finally{a(!1),i(!1)}},x=g=>{d(g,!1),o?.(g)};return e.jsxs(e.Fragment,{children:[e.jsxs(F,{color:"red",onClick:g=>d(g,!0),children:[e.jsx(Y,{style:{minWidth:24,color:"red"},children:e.jsx($e,{fontSize:"small"})}),e.jsx($,{style:{color:"red"},children:s("common.disconnect")})]}),e.jsx(it,{title:s("storage.spaces.gateway.delete.title"),open:r,confirmButton:{text:s("common.confirm"),props:{size:"small",variant:"contained",color:"error",loading:c}},cancelButton:{text:s("common.cancel"),props:{size:"small",variant:"outlined",disabled:c}},onConfirm:l,onCancel:x,children:e.jsx(j,{sx:{wordWrap:"break-word"},children:s("storage.spaces.gateway.delete.descForBackup",{name:`${t?.name}`})})})]})}Le.propTypes={spaceGateway:u.shape({name:u.string.isRequired,url:u.string.isRequired,protected:u.bool}).isRequired,onConfirm:u.func,onCancel:u.func};function Ue({spaceGateway:t,selected:n,onDelete:o=()=>{},onConnect:s=()=>{},enableSwitchToSpace:r=!0,backupInProgress:a=!1,...c}){const{abortBlockletBackup:i}=U(),[d,l]=b.useState(null),{t:x}=D(),[g,m]=b.useState(!1),p=(S,y)=>{S.stopPropagation(),S.preventDefault(),l(y&&S.currentTarget)},k=async S=>{try{m(!0),p(S,!1),await s(t)}catch(y){console.error(y),B.error(y.message)}finally{m(!1)}},w=async S=>{try{m(!0),p(S,!1),await i()}catch(y){console.error(y),B.error(y.message)}finally{m(!1)}};return e.jsxs(e.Fragment,{children:[g||t?.loading?e.jsx(z,{sx:{ml:1},size:"24px"}):e.jsx(qe,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions",variant:"outlined",size:"small",onClick:S=>p(S,!0),...c,children:e.jsx(He,{})}),e.jsxs(Qe,{id:"simple-menu",anchorEl:d,keepMounted:!0,open:!!d,onClose:S=>p(S,!1),children:[e.jsxs(F,{onClick:S=>{p(S,!1),window.open(Se(t.endpoint?Ct(t.endpoint):t.url,{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Xe,{fontSize:"small"})}),e.jsx($,{children:x("common.open")})]}),e.jsxs(F,{onClick:S=>{p(S,!1),window.open(Se(wt(t.endpoint),{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Ve,{fontSize:"small"})}),e.jsx($,{children:x("storage.spaces.strategy.viewBackupFiles")})]}),!n&&r&&e.jsxs(F,{onClick:k,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Je,{fontSize:"small"})}),e.jsx($,{children:x("storage.spaces.connect.switchToSpace")})]}),a&&e.jsxs(F,{onClick:w,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Ze,{fontSize:"small"})}),e.jsx($,{children:x("storage.spaces.connect.abortBlockletBackup")})]}),!a&&e.jsx(Le,{spaceGateway:t,onConfirm:async()=>{l(null),await o?.(t)},onCancel:()=>l(null)})]})]})}Ue.propTypes={spaceGateway:u.shape({name:u.string.isRequired,url:u.string.isRequired,protected:u.bool,endpoint:u.string.isRequired,loading:u.bool}).isRequired,selected:u.bool.isRequired,enableSwitchToSpace:u.bool,onDelete:u.func,onConnect:u.func,backupInProgress:u.bool};const Wt=fe(({className:t,...n})=>e.jsx(ge,{...n,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function Me({spaceGateway:t,spaceStatus:n,selected:o,onConnected:s=()=>{},onDeleted:r=()=>{},onBackedUp:a=()=>{}}){const{t:c,locale:i}=D(),{blocklet:d}=O(),{api:l,info:{did:x}}=L(),{appDid:g,appName:m,appDescription:p,scopes:k,appUrl:w,referrer:S}=De({blocklet:d}),{backupProgress:y,updateSpaceGateway:Z,deleteSpaceGateway:ee,refreshBackupSummary:te,refreshBackups:se}=U(),[_,M]=b.useState(!1),[I,P]=b.useState({open:!1,action:"one-click-authorization",checkTimeout:1e3*300,messages:{title:c("storage.spaces.authorize.title",{appName:m},i),scan:c("storage.spaces.authorize.scan",{appName:m},i),confirm:"",success:e.jsx(j,{gutterBottom:!0,children:c("storage.spaces.authorize.success")})},onClose:()=>{P(C=>({...C,open:!1}))}}),ne=o&&!_&&n===de.DISCONNECTED,oe=o&&!_&&!t.loading&&n===de.CONNECTED,G=o&&_&&n===de.CONNECTED&&y?.progress>=0,X=async()=>{try{if(await Bt(t?.endpoint)){await l.configBlocklet({input:{did:[d.meta.did],configs:[{key:N.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:t.endpoint}]}}),B.success(c("storage.spaces.connect.switchToSpaceSucceeded",{name:t.name?`(${t.name})`:""})),s?.(null,t);return}}catch(C){console.error(C),s?.(C,t);return}P(C=>({...C,open:!0,prefix:me(t.url,"space/api/did"),baseUrl:new URL(t.url).origin,checkFn:we.create({baseURL:me(t.url,"space")}).get,extraParams:{appDid:g,appName:m,appDescription:p,scopes:k,appUrl:w,referrer:S,nodeDid:x,spaceDid:t.did}}))},ae=async(C,f)=>{const A=f(C.endpoint),R=xe(A),v=C.space?f(C.space):{};if(t.did&&R!==t.did){P(Ne=>({...Ne,open:!1}));const W=c("storage.spaces.gateway.switch.failedForMismatchSpace",{name:v?.name?v.name:""});B.error(W),s?.(new Error(W),t);return}const ce={...t,name:v.name??"DID Space",did:v.did??xe(A),endpoint:A};await Z(ce),P(W=>({...W,open:!1})),s?.(null,ce)},re=async()=>{try{if(_)return;M(!0),await l.backupBlocklet({input:{appDid:d.appDid,to:"spaces"}})}catch(C){console.error(C),B.error(C.message),a?.(C,t)}finally{M(!0)}},ie=async()=>{try{await ee(t),B.success(c("storage.spaces.gateway.delete.succeeded",{name:t.name?`(${t.name})`:""})),r?.(null,t)}catch(C){console.error(C),r?.(C,t)}};return b.useEffect(()=>{y?.completed?(o&&(y?.progress===100?(B.success(c("storage.spaces.backupSuccessfully")),a?.(null,t)):y.message&&a?.(new Error(y?.message),t),y.progress=0,y.message=""),M(!1),te(),se()):y.progress&&M(!0)},[y]),e.jsxs(e.Fragment,{children:[e.jsxs(h,{sx:{display:"flex",alignItems:"center",".action-btn":{borderRadius:1,marginLeft:1}},children:[oe&&e.jsx(le,{className:"action-btn",variant:"outlined",size:"small",onClick:re,children:c("storage.spaces.strategy.backupNow")}),ne&&e.jsx(le,{className:"action-btn",variant:"outlined",size:"small",onClick:X,children:c("storage.spaces.disconnected.reconnectNow")}),G&&e.jsx(Wt,{title:y?.message&&e.jsx(h,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:e.jsx(j,{variant:"body2",children:y.message})}),children:e.jsxs(le,{className:"action-btn",variant:"outlined",size:"small",sx:{minWidth:70},children:[e.jsx(z,{variant:"determinate",value:y?.progress,size:14,sx:{mr:1}}),y?.progress,"%"]})}),e.jsx(ot,{forceConnected:!1,saveConnect:!1,prefix:I.prefix,open:I.open,popup:!0,action:I.action,baseUrl:I.baseUrl,checkFn:I.checkFn,onSuccess:ae,onClose:I.onClose,checkTimeout:I.checkTimeout,extraParams:I.extraParams,messages:I.messages,locale:i},"get-endpoint")]}),e.jsx(Ue,{sx:{minWidth:32,padding:"2px 4px",ml:1},spaceGateway:t,selected:o,onDelete:ie,onConnect:X,enableSwitchToSpace:y?.completed||H(y?.message),backupInProgress:G})]})}Me.propTypes={spaceGateway:u.shape({did:u.string.isRequired,name:u.string.isRequired,url:u.string.isRequired,endpoint:u.string.isRequired,protected:u.bool,loading:u.bool}).isRequired,spaceStatus:u.string.isRequired,selected:u.bool.isRequired,onConnected:u.func,onDeleted:u.func,onBackedUp:u.func};function Kt({...t}){const{t:n}=D();return e.jsxs(h,{...t,children:[e.jsx(h,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:n("storage.spaces.backup.records")})}),e.jsx(ve,{}),e.jsx(Oe,{})]})}function Gt({...t}){const{t:n}=D(),{autoBackup:o,updateAutoBackup:s}=U(),r=async()=>{try{const a=!o?.enabled;await s({enabled:a}),B.success(n(a?"storage.spaces.autoBackup.enabled":"storage.spaces.autoBackup.disabled"))}catch(a){B.error(a.message)}};return e.jsx(Tt,{checked:!!o?.enabled,onChange:r,name:"enableWelcomePage",labelProps:{label:e.jsx(j,{sx:{marginRight:"8px"},children:e.jsx("span",{children:n("storage.spaces.autoBackup.title")})})},style:{...t.style}})}function Ft(){const{t}=D(),{spaceGateways:n,spaceGatewaysLoading:o,spaceGatewayIsSelected:s}=U(),r=o&&!n?.length,a=({spaceGateway:c,spaceStatus:i,selected:d,refresh:l})=>e.jsx(Me,{spaceGateway:c,spaceStatus:i,selected:d,onConnected:()=>l(),onBackedUp:x=>x&&l()});return e.jsxs(h,{sx:{display:"flex",flexDirection:"column"},children:[e.jsxs(h,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},gap:{xs:1,md:2},justifyContent:{xs:"center",md:"flex-start"},alignItems:{xs:"flex-start",md:"center"}},children:[e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",flexGrow:1},children:t("storage.spaces.connected.title")}),e.jsx(Gt,{}),e.jsx(Re,{})]}),e.jsx(h,{sx:{mt:2},children:r?e.jsx(h,{sx:{display:"flex",justifyContent:"center"},children:e.jsx(z,{})}):e.jsx(he,{container:!0,spacing:2,children:e.jsx(e.Fragment,{children:n.map(c=>e.jsx(he,{size:{xs:12,md:6},children:e.jsx(ft,{endpoint:c.endpoint,selected:s(c),action:a},c.endpoint)},c.endpoint))})})}),e.jsx(Kt,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2},children:t("common.dataStorage")}),e.jsx(Pe,{})]})}function Yt(){const{spaceGatewaysFirstLoading:t,spaceGateways:n}=U();return t?e.jsx(Be,{relative:"parent",children:e.jsx(z,{})}):H(n)?e.jsx(_t,{}):e.jsx(Ft,{})}function $t(){return e.jsx(Te,{children:e.jsx(Yt,{})})}function qt(){const{spaceGateway:t,settingStorageEndpoint:n,updateSpaceGateway:o,hasStorageEndpoint:s,loading:r,storageEndpoint:a}=Pt(),c=ue(()=>({display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"16px"}));return r?e.jsx(Be,{relative:"parent",children:e.jsx(z,{})}):e.jsxs(h,{sx:{maxWidth:"md",position:"relative"},children:[s?e.jsx(gt,{spaceGateway:t,settingStorageEndpoint:n}):e.jsx(ht,{}),e.jsx(h,{sx:c,children:e.jsx(St,{onConnect:o,storageEndpoint:a})})]})}function Ht(){const{t}=D();return e.jsxs(Rt,{children:[e.jsxs(K,{spacing:1,sx:{marginBottom:2},children:[e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:t("storage.appLevel.title")}),e.jsx(j,{sx:{color:"text.secondary"},children:t("storage.appLevel.description")})]}),e.jsx(qt,{})]})}function Qt({navOrientation:t="vertical",...n}){const{t:o,locale:s}=D(),{blocklet:r}=O(),a=lt({key:"md"}),[c,i]=et(),d=c.get("tab")||"backup",l=a?"horizontal":t,x=ue(()=>{const w=[{label:o("common.backup"),value:"backup"}],S=r?.capabilities?.didSpace;return(S===N.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED||S===N.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP)&&w.push({label:o("common.storage"),value:"storage"}),w},[s,l]),m=ue(()=>({backup:e.jsx($t,{}),storage:e.jsx(Ht,{})}))[d],p=w=>{i(S=>(w==="backup"?S.delete("tab"):S.set("tab",w),S))};if(x.length<=1)return e.jsx(pe,{children:m});const k=e.jsx(ct,{tabs:x,current:d,orientation:l,onChange:p,sx:[{borderRight:1,height:"100%",borderColor:"divider"},l==="horizontal"&&{borderRight:0}]});if(l==="vertical")return e.jsx(h,{...n,children:e.jsxs(K,{direction:{md:"column",lg:"row"},sx:{gap:2},children:[e.jsx(h,{sx:{flexShrink:0},children:e.jsx(ye,{left:k})}),e.jsx(h,{sx:{flexGrow:1,minWidth:0},children:e.jsx(pe,{sx:{mt:1},children:m})})]})});if(l==="horizontal")return e.jsxs(h,{...n,children:[e.jsx(ye,{left:k}),e.jsx(pe,{sx:{mt:2},children:m})]})}Qt.propTypes={navOrientation:u.oneOf(["vertical","horizontal"])};const pe=fe(h)`
|
|
3
3
|
position: relative;
|
|
4
4
|
min-height: 66vh;
|
|
5
5
|
overflow: hidden;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as v,g as $e,a as qe}from"./vendor-react-CUXIiAnY.js";import{g as Ue,k as Z}from"./vendor-hooks-
|
|
1
|
+
import{r as v,g as $e,a as qe}from"./vendor-react-CUXIiAnY.js";import{g as Ue,k as Z}from"./vendor-hooks-fhL5FJET.js";import{j as e,ak as t,at as $,b1 as Y,a6 as B,aX as He,am as G,cp as Ge,U as Ye,T as F,a3 as Ke,W as S,z as O,M as Q,I as _,cq as ge,cb as je,A as Ve,x as Ze,c3 as Qe,c4 as ee,bw as Xe,F as Je,bc as es,s as ss}from"./vendor-mui-core-DHT36AZL.js";import{V as A,b as W,j as ts,h as ae,z as se,H as P,n as z,i as re,P as ye,x as ve,Q as as,a2 as rs}from"./vendor-ux-sqP3hEhY.js";import{_ as D,o as os,a1 as be,c as M,B as J,ac as ns,e as is,Y as ls,a2 as V,b5 as cs}from"./index-CN4lpn74.js";import{W as oe}from"./did-address-CihvGtuj.js";import{u as N}from"./team-BnNEVFdE.js";import{a as ne,r as ie,b as le,c as Se,d as X,e as ds,u as ps,f as us}from"./passport-item-BMa8rd85.js";import{p as Ce}from"./util-DzwOLYt5.js";import{u as ms}from"./use-mobile-DoKVMODs.js";import{v as H}from"./index-bbu7QFpz.js";import{w as q,P as fs}from"./permission-DLnMVuoy.js";import{C as xs}from"./Google-PoHjNVzr.js";import{c as hs}from"./create-passport-svg-BZVXsAoP.js";import{A as gs}from"./vendor-arcblock-3xKfH3F1.js";import{G as K,_ as js}from"./vendor-utils-BSZ4yJws.js";import{e as we}from"./edit.svg-Dz9cVo7r.js";import{H as ce,P as ys}from"./index-C0TbDTja.js";import{C as Te}from"./confirm-DPD7yjeR.js";import{L as Ie}from"./list-header-CA-QkwGq.js";import{f as te}from"./index-DBs9Ljax.js";import{u as vs}from"./useSetState-cWrp7qoX.js";import"./lottie-web-4koyQiv_.js";import"./session-DNlfWI2Z.js";import"./isURL-DskT4RKm.js";import"./use-app-logo-BWOYOuhG.js";import"./ua-parser-DP5omx3I.js";import"./base32-AX-I0UaR.js";import"./cloneDeep-B7kH4W7U.js";import"./lock.svg-BPCZ0CT3.js";const me="info";function Pe({createPassportSvg:c,passport:s,onCancel:p,onSwitchPassport:u=()=>{}}){const{t:f}=A(),i=Ue({tab:me}),d={info:{label:f("common.basicInfo"),value:me,component:()=>e.jsx(De,{passport:s,createPassportSvg:c})},logs:{label:f("common.logs"),value:"logs",component:()=>e.jsx(Ae,{passport:s})},related:{label:f("team.passport.related"),value:"related",component:()=>e.jsx(Le,{passport:s,onSwitchPassport:u})}},l=Object.values(d).map(({label:h,value:m})=>({label:h,value:m})).filter(h=>h.value==="related"?s.parentDid:!0),r=d[i.tab]||d.info,n=h=>{i.tab=h};return e.jsx(W,{title:f("common.passport"),onClose:p,open:!0,PaperProps:{style:{maxWidth:800,minHeight:"80vh"}},fullWidth:!0,children:e.jsxs(bs,{children:[e.jsx(t,{className:"tabs",children:e.jsx(ts,{tabs:l,current:i.tab,onChange:n,scrollButtons:"auto"})}),e.jsx(t,{className:"body",children:e.jsx(r.component,{})})]})})}Pe.propTypes={createPassportSvg:S.func.isRequired,passport:S.object.isRequired,onCancel:S.func.isRequired,onSwitchPassport:S.func};const bs=$(t)`
|
|
2
2
|
margin-top: -16px;
|
|
3
3
|
|
|
4
4
|
.tabs {
|
|
@@ -9,7 +9,7 @@ import{r as v,g as $e,a as qe}from"./vendor-react-CUXIiAnY.js";import{g as Ue,k
|
|
|
9
9
|
.body {
|
|
10
10
|
margin-top: 24px;
|
|
11
11
|
}
|
|
12
|
-
`;function
|
|
12
|
+
`;function De({createPassportSvg:c,passport:s}){const{t:p,locale:u}=A(),{teamDid:f}=N(),{inService:i}=D(),d=ms(),l=[{items:[{label:p("common.role"),content:ne(s.title)},{label:p("common.did"),content:e.jsx(oe,{did:s.id})},{label:p("team.passport.status"),content:le(s.status)},{label:p("common.type"),content:e.jsx(t,{sx:{display:"flex",gap:1,flexWrap:"wrap"},children:(s.type||[]).map(n=>e.jsx(Ye,{label:n,variant:"outlined",size:"small",sx:{borderRadius:1}},n))})}]}],r=[{title:p("team.passport.owner"),items:[{label:p("team.passport.owner"),content:e.jsx(t,{children:ie(s.user,i)})}]},{title:p("common.timeInfo"),items:[{label:p("team.passport.issuanceTime"),content:s.issuanceDate?e.jsx(se,{value:s.issuanceDate,type:"all",locale:u}):"-"},{label:p("team.member.lastLogin"),content:s.lastLoginAt?e.jsx(se,{value:s.lastLoginAt,type:"all",locale:u}):"-"},{label:p("common.expires"),content:s.expirationDate?e.jsx(se,{value:s.expirationDate,type:"all",locale:u}):"-"}]},{title:p("blocklet.overview.source"),items:[{label:p("blocklet.overview.source"),content:X(s.source)}]}];return e.jsxs(Ss,{gap:3,children:[e.jsxs(t,{sx:{display:"flex",flexDirection:d?"column":"row",alignItems:d?"flex-start":"center",justifyContent:d?"center":"flex-start",width:"100%",overflow:"hidden",gap:d?2:4},children:[e.jsx(t,{sx:{display:"flex",width:"180px"},className:"passport-image",dangerouslySetInnerHTML:{__html:c({scope:s.scope,role:s.role,title:s.scope==="kyc"?s.name:s.title,issuer:s.issuer&&s.issuer.name,issuerDid:s.issuer&&s.issuer.id,ownerName:s.user?.fullName,ownerDid:s.user?.did,ownerAvatarUrl:s.user?.avatar?Ce(s.user?.avatar,f,i):"",revoked:s.revoked,extra:s?.expirationDate?{key:"Exp",value:be(s.expirationDate).format("YYYY-MM-DD HH:mm:ss")}:null})}}),e.jsx(t,{className:"info-area",children:l.map(n=>e.jsxs(t,{children:[n.title&&e.jsx(F,{variant:"h6",sx:{mb:2},children:n.title}),e.jsx(t,{className:"info-grid",sx:{gap:"12px !important"},children:n.items.map(h=>e.jsxs(t,{className:"info-item",children:[e.jsx(t,{className:"info-label",sx:{maxWidth:40},children:e.jsx(F,{variant:"subtitle2",color:"textSecondary",children:h.label})}),e.jsx(t,{sx:{display:"flex",flexWrap:"wrap",gap:.5,minWidth:0},children:h.content})]},h.label))})]},n.title))})]}),e.jsx(Ke,{}),e.jsx(t,{className:"info-area",children:r.map(n=>e.jsxs(t,{children:[e.jsx(F,{variant:"h5",sx:{mb:1.5},children:n.title}),e.jsx(t,{className:"info-grid",children:n.items.map(h=>e.jsxs(t,{className:"info-item",children:[e.jsx(t,{className:"info-label",children:e.jsx(F,{variant:"subtitle2",color:"textSecondary",children:h.label})}),e.jsx(t,{sx:{minWidth:500},children:h.content})]},h.label))})]},n.title))})]})}De.propTypes={passport:S.object.isRequired,createPassportSvg:S.func.isRequired};const Ss=$(Y)`
|
|
13
13
|
.info-card {
|
|
14
14
|
margin-bottom: 24px;
|
|
15
15
|
overflow: hidden;
|
|
@@ -87,7 +87,7 @@ import{r as v,g as $e,a as qe}from"./vendor-react-CUXIiAnY.js";import{g as Ue,k
|
|
|
87
87
|
margin: 0;
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
`,ke=10,Re=1;function Ae({passport:c}){const{api:s}=
|
|
90
|
+
`,ke=10,Re=1;function Ae({passport:c}){const{api:s}=D(),{teamDid:p}=N(),{t:u,locale:f}=A(),[i,d]=v.useState({pageSize:ke,page:Re}),{data:l,loading:r}=Z(async()=>{const x={teamDid:p,query:{passportId:c.id},paging:{page:i.page,pageSize:i.pageSize}},a=await s.getPassportLogs({input:x});return{logs:a.passportLogs||[],total:a.paging.total}},{refreshDeps:[i.page,i.pageSize],onError:x=>P.error(x.message)}),n=v.useMemo(()=>l?.logs||[],[l?.logs]),h=x=>x.action===M.PASSPORT_LOG_ACTION.APPROVE||x.action===M.PASSPORT_LOG_ACTION.REVOKE?x?.metadata?.operator?.fullName?`${u("common.operator")}: ${x?.metadata?.operator?.fullName}`:null:x.action===M.PASSPORT_LOG_ACTION.ISSUE&&x.metadata?.action===M.PASSPORT_ISSUE_ACTION.ISSUE_ON_INVITE?x?.metadata?.inviter?.fullName?`${u("common.inviter")}: ${x?.metadata?.inviter?.fullName}`:null:`passportId: ${x.passportId}`,m=v.useMemo(()=>[{label:u("common.action"),name:"action",options:{customBodyRender:(x,{rowIndex:a})=>{const o=n[a];return e.jsx(G,{title:h(o),children:`${x} ${o.metadata?.action?`(${o.metadata.action})`:""}`})}}},{label:"IP",name:"operatorIp",options:{customBodyRender:x=>e.jsx(t,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsx("span",{children:x||"-"})})}},{label:"UA",width:250,name:"operatorUa",options:{customBodyRender:(x,{rowIndex:a})=>{const o=n[a];return e.jsxs(t,{sx:{display:"flex",alignItems:"center",gap:1},children:[o.operatorUa&&e.jsx(t,{children:ds(o.operatorUa)}),o.operatorUa&&e.jsx(G,{title:o.operatorUa,children:e.jsx(Ge,{fontSize:"small",color:"action",sx:{fontSize:16,cursor:"pointer"}})})]})}}},{label:u("common.createdAt"),name:"createdAt",options:{customBodyRender:x=>os(x,f)}}],[u,f,n]),g=({page:x,rowsPerPage:a})=>{i.pageSize!==a?d(o=>({...o,pageSize:a,page:1})):i.page!==x+1&&d(o=>({...o,page:x+1}))},T={sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,search:!1,page:i.page-1,rowsPerPage:i.pageSize,count:l?.total||0};return r?e.jsx(t,{sx:{py:2},children:e.jsx(Y,{direction:"row",spacing:1,sx:{position:"relative",pb:2},children:e.jsx(B,{})})}):e.jsx(t,{children:e.jsx(ae,{className:"logs-table",verticalKeyWidth:100,locale:f,data:n,columns:m,options:T,loading:r,onChange:g})})}Ae.propTypes={passport:S.object.isRequired};function Le({passport:c,onSwitchPassport:s}){const{api:p}=D(),{teamDid:u}=N(),{t:f,locale:i}=A(),[d,l]=v.useState({pageSize:ke,page:Re}),{data:r,loading:n}=Z(async()=>{const a={teamDid:u,passportId:c.parentDid,paging:{page:d.page,pageSize:d.pageSize}},o=await p.getRelatedPassports({input:a});return{passports:o.passports||[],total:o.paging.total}},{refreshDeps:[d.page,d.pageSize],onError:a=>P.error(a.message)}),h=v.useMemo(()=>r?.passports||[],[r?.passports]),m=v.useMemo(()=>[{label:f("team.passport.role"),name:"role",options:{customBodyRender:ne}},{label:f("team.passport.owner"),name:"user",options:{customBodyRender:ie}},{label:f("team.passport.status"),name:"status",options:{customBodyRender:le}},{label:f("team.member.lastLogin"),name:"lastLoginAt",options:{customBodyRender:a=>Se(a,i)}},{label:f("blocklet.overview.source"),name:"source",options:{customBodyRender:X}}],[f,i]),g=({page:a,rowsPerPage:o})=>{d.pageSize!==o?l(b=>({...b,pageSize:o,page:1})):d.page!==a+1&&l(b=>({...b,page:a+1}))},T=v.useRef(null),x={sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,search:!1,page:d.page-1,rowsPerPage:d.pageSize,count:r?.total||0,onRowClick(a,{dataIndex:o},b){if(T.current?.contains(b.target)){const y=h[o];s(y)}}};return n?e.jsx(t,{sx:{py:2},children:e.jsx(Y,{direction:"row",spacing:1,sx:{position:"relative",pb:2},children:e.jsx(B,{})})}):e.jsxs(Y,{spacing:1,children:[e.jsx(He,{severity:"warning",children:f("team.passport.relatedDescription")}),e.jsx(t,{ref:T,sx:{".MuiTableRow-root":{cursor:"pointer"}},children:e.jsx(ae,{className:"related-table",verticalKeyWidth:100,locale:i,data:h.filter(a=>a.id!==c.id),columns:m,options:x,loading:n,onChange:g})})]})}Le.propTypes={passport:S.object.isRequired,onSwitchPassport:S.func.isRequired};function de({onCancel:c,onSuccess:s}){const{api:p}=D(),{blocklet:u}=ns(),{t:f}=A(),[i,d]=v.useState(!1),l=(u.environments.find(g=>g.key==="BLOCKLET_PASSPORT_COLOR")||{}).value||"auto",r=l==="auto"?gs(u.appDid):l,[n,h]=v.useState(r),m=async()=>{const g=[{key:ls.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_PASSPORT_COLOR,value:n}];try{d(!0),await p.configBlocklet({input:{did:u.meta.did,configs:g}}),s()}catch(T){P.error(T.message)}finally{d(!1)}};return e.jsx(W,{title:f("team.passport.color"),onClose:c,open:!0,fullWidth:!0,actions:e.jsxs(e.Fragment,{children:[e.jsx(z,{onClick:c,color:"inherit",children:f("common.cancel")}),e.jsxs(z,{onClick:m,color:"primary",disabled:i,variant:"contained",autoFocus:!0,"data-cy":"color-btn-confirm",children:[i&&e.jsx(B,{size:16}),f("common.save")]})]}),children:e.jsxs(t,{className:"dialog-content",sx:{display:"flex",justifyContent:"center",alignItems:"center"},children:[e.jsx(xs,{disableAlpha:!0,color:n,onChange:g=>h(g.hex)}),e.jsx("div",{style:{width:220,marginLeft:24},dangerouslySetInnerHTML:{__html:hs({scope:"passport",role:"owner",title:"Owner",issuer:is.getDisplayName(u),issuerDid:u.appDid,ownerName:"Your Name",ownerDid:u.appDid,preferredColor:n})}})]})})}const Cs=q(de,"mutate_team"),ws=q(de,"",J);function Ts(c){const{inService:s}=D();return s?e.jsx(ws,{...c}):e.jsx(Cs,{...c})}de.propTypes={onCancel:S.func.isRequired,onSuccess:S.func.isRequired};var ze=function(s){return e.jsx("svg",{...s,children:e.jsx("path",{d:"M64.707 8.707a1 1 0 0 0 0-1.414L58.343.929a1 1 0 1 0-1.414 1.414L62.586 8l-5.657 5.657a1 1 0 0 0 1.414 1.414l6.364-6.364ZM0 9h64V7H0v2Z",fill:"#666"})})};ze.defaultProps={width:"65",height:"16",fill:"none",xmlns:"http://www.w3.org/2000/svg"};const Is=(c,s)=>c?!s.some(p=>!p.from.passport||!p.to.role):!1;function Ne({onCancel:c,onSuccess:s,data:p={},trustedPassports:u=[]}){const{api:f}=D(),{roles:i,teamDid:d}=N(),{t:l}=A(),[r,n]=v.useState(!1),[h,m]=v.useState(p.issuerDid||""),[g,T]=v.useState(p.remark||""),[x,a]=v.useState(K(p.mappings)||[]),o=u.findIndex(y=>y.issuerDid===p.issuerDid),b=async()=>{if(r)return;const y={issuerDid:h,remark:g,mappings:x.map(w=>({...w,to:{...w.to,ttl:w.to.ttl||0}}))},C=[...u];o===-1?C.unshift(y):C[o]=y;try{n(!0),await f.configTrustedPassports({input:{teamDid:d,trustedPassports:C}}),await V(800),n(!1),P.success(l("common.saveSuccess")),s()}catch(w){n(!1),P.error(te(w))}};return e.jsx(W,{title:l("team.passport.trustedIssuers"),open:!0,showCloseButton:!1,PaperProps:{style:{minHeight:"80vh"}},fullWidth:!0,prepend:e.jsx(_,{onClick:c,"data-cy":"trusted-issuer-close",size:"large",children:e.jsx(ge,{})}),actions:e.jsxs(e.Fragment,{children:[e.jsx(z,{onClick:c,color:"inherit",children:l("common.cancel")}),e.jsxs(z,{onClick:()=>b(),color:"primary",disabled:!Is(h,x)||!g||r,variant:"contained",autoFocus:!0,"data-cy":"save-mapping",children:[r&&e.jsx(B,{size:16}),l("common.save")]})]}),children:e.jsx(Ps,{children:e.jsxs("div",{className:"dialog-content",children:[e.jsx(O,{fullWidth:!0,"data-cy":"input-issuer-did",placeholder:l("team.passport.issuerDid"),value:h,onChange:y=>{m(y.target.value)}}),e.jsx(O,{style:{marginTop:16},fullWidth:!0,"data-cy":"input-issuer-remark",placeholder:l("common.remark"),value:g,onChange:y=>{T(y.target.value)}}),e.jsxs(t,{sx:{mt:"30px",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsx(t,{className:"dialog-h1",children:l("team.passport.mappingRule")}),e.jsx(t,{children:e.jsx(z,{variant:"outlined",color:"primary","data-cy":"add-mapping",onClick:()=>{a(y=>{const C=[...y];return C.unshift({from:{passport:""},to:{role:M.ROLES.GUEST}}),C})},children:l("team.add")})})]}),e.jsxs(t,{className:"list",sx:{mt:-.5},children:[x.map((y,C)=>e.jsxs(t,{className:"mapping-item",sx:{display:"flex",alignItems:"center",justifyContent:"space-between",my:1},children:[e.jsxs(t,{sx:{display:"flex",alignItems:"center",flexGrow:1},children:[e.jsx(t,{sx:{flexGrow:1,flexBasis:1},children:e.jsx(O,{fullWidth:!0,size:"small","data-cy":`input-${C}-from`,placeholder:"Issuer’s Passport Name/ID *",value:y.from.passport,onChange:w=>{const{value:k}=w.target;a(L=>{const U=[...L];return U[C].from.passport=k,U})},sx:{"& .MuiInputBase-input::placeholder":{fontSize:14},"& .Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"primary.main"}}})}),e.jsx(t,{sx:{flexShrink:0,mx:1,width:65,height:16},children:e.jsx(ze,{})}),e.jsx(t,{sx:{flexGrow:1,flexBasis:1},children:e.jsx(O,{fullWidth:!0,size:"small",select:!0,value:y.to.role,onChange:w=>{a(k=>{const L=[...k];return L[C].to.role=w.target.value,L})},variant:"outlined",children:i.filter(w=>w.name!=="owner").map(w=>e.jsx(Q,{value:w.name,"data-cy":`passport-mapping-select-option-${w.name}`,children:e.jsx("span",{children:w.title||w.name})},w.name))})})]}),e.jsx(t,{sx:{flexShrink:0},children:e.jsx(_,{onClick:()=>{a(w=>{const k=[...w];return k.splice(C,1),k})},size:"large",children:e.jsx(ce,{})})})]},`mapping-${C}`)),!x.length&&e.jsx(t,{sx:{my:2,color:"text.secondary",fontSize:"16px"},children:e.jsx(re,{children:l("common.empty")})})]})]})})})}Ne.propTypes={onCancel:S.func.isRequired,onSuccess:S.func.isRequired,trustedPassports:S.array,data:S.object};const Ps=$.div`
|
|
91
91
|
.dialog-h1 {
|
|
92
92
|
font-size: 18px;
|
|
93
93
|
}
|
|
@@ -99,7 +99,7 @@ import{r as v,g as $e,a as qe}from"./vendor-react-CUXIiAnY.js";import{g as Ue,k
|
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
-
`;function pe({onCancel:c,hasPermission:s=!1}){const{api:p}=
|
|
102
|
+
`;function pe({onCancel:c,hasPermission:s=!1}){const{api:p}=D(),{teamDid:u,trustedPassports:f}=N(),{t:i}=A(),[d,l]=v.useState(null),[r,n]=v.useState(!1),[h,m]=v.useState(!1),[g,T]=v.useState(""),x=async o=>{if(r)return;const b=f.findIndex(C=>C.issuerDid===o);b===-1&&P.error("Cannot find passports");const y=[...f];y.splice(b,1);try{n(!0),await p.configTrustedPassports({input:{teamDid:u,trustedPassports:y}}),await V(800),n(!1),P.success(i("common.saveSuccess")),l(!1)}catch(C){n(!1),P.error(C.message)}},a=f.filter(o=>!g||o.issuerDid.toLowerCase().includes(g.toLowerCase()));return e.jsxs(W,{title:i("team.passport.trustedIssuers"),open:!0,onClose:c,fullWidth:!0,PaperProps:{style:{minHeight:"80vh"}},children:[e.jsx(As,{children:e.jsxs("div",{className:"dialog-content",children:[e.jsx("div",{className:"dialog-h1",children:i("team.passport.trustedPassportIssuers")}),e.jsx(Ie,{sx:{mt:3},actions:e.jsxs(e.Fragment,{children:[e.jsx(ye,{options:{searchPlaceholder:i("team.passport.searchIssuerDid"),searchDebounceTime:600},search:g,searchText:g,searchTextUpdate:T,searchClose:()=>T(""),onSearchOpen:()=>{}}),s&&e.jsxs(z,{variant:"contained",color:"primary","data-cy":"add-trusted-issuer",onClick:()=>m({mode:"add"}),children:[e.jsx(je,{style:{fontSize:16,marginRight:4}}),i("team.add")]})]})}),e.jsxs("div",{className:"list",children:[a.map(o=>e.jsxs(t,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mt:"20px"},children:[e.jsxs(t,{sx:{flexShrink:0},children:[e.jsx(oe,{copyable:!1,size:16,did:ve.toAddress(o.issuerDid),showDidLogo:!1}),!!o.remark&&e.jsx(t,{sx:{fontSize:12,maxWidth:"300px"},children:o.remark})]}),e.jsx(t,{sx:{color:"gray",ml:"28px",flexGrow:1},children:o.mappings&&o.mappings.length?`${o.mappings.length} ${i("team.passport.mappingRule")}`:i("team.passport.defaultRule")}),e.jsxs(t,{sx:{flexShrink:0,display:"flex",alignItems:"center"},children:[e.jsx(_,{onClick:()=>m({mode:"update",data:K(o)}),"data-cy":"edit-mapping-rule",size:"large",children:e.jsx(we,{})}),e.jsx(_,{"data-cy":"delete-mapping-rule",onClick:()=>l({title:i("common.delete"),description:i("common.delConfirmDescription",{data:o.issuerDid}),confirm:i("common.delConfirm"),cancel:i("common.cancel"),onConfirm:()=>x(o.issuerDid),onCancel:()=>{n(!1),l(null)}}),size:"large",children:e.jsx(ce,{})})]})]},o.issuerDid)),!f.length&&e.jsx(re,{children:i("common.empty")})]})]})}),h&&e.jsx(Ne,{mode:h.mode,data:h.data,trustedPassports:K(f),onCancel:()=>m(null),onSuccess:()=>{m(null)}}),d&&e.jsx(Te,{title:d.title,description:d.description,confirm:d.confirm,cancel:d.cancel,params:d.params,onConfirm:d.onConfirm,onCancel:d.onCancel})]})}pe.propTypes={onCancel:S.func.isRequired,hasPermission:S.bool};const Ds=q(pe,"mutate_team"),ks=q(pe,"",J);function Rs(c){const{inService:s}=D();return s?e.jsx(ks,{...c}):e.jsx(Ds,{...c})}const As=$.div`
|
|
103
103
|
.list {
|
|
104
104
|
.MuiIconButton-root {
|
|
105
105
|
svg {
|
|
@@ -107,7 +107,7 @@ import{r as v,g as $e,a as qe}from"./vendor-react-CUXIiAnY.js";import{g as Ue,k
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
`;var Ls=
|
|
110
|
+
`;var Ls=js();const fe=$e(Ls);function Be({onCancel:c,onSuccess:s,data:p={},trustedFactories:u=[]}){const{api:f}=D(),{roles:i,teamDid:d}=N(),{t:l}=A(),[r,n]=vs({loading:!1,fetching:!1,fetched:[],errored:[],factoryAddress:p.factoryAddress||"",remark:p.remark||"",role:p.passport?.role||"member",ttlPolicy:p.passport?.ttlPolicy||"never",ttl:fe(+p.passport?.ttl||365*24*60*60*1e3),error:""}),h=u.findIndex(a=>a.factoryAddress===p.factoryAddress),m=async()=>{if(r.loading)return;const{factoryAddress:a,remark:o,role:b,ttlPolicy:y,ttl:C}=r,w={factoryAddress:a,remark:o,passport:{role:b,ttlPolicy:y,ttl:y==="never"?0:fe(C)}},k=[...u];h===-1?k.unshift(w):k[h]=w;try{n({loading:!0}),await f.configTrustedFactories({input:{teamDid:d,trustedFactories:k}}),await V(800),P.success(l("common.saveSuccess")),s()}catch(L){console.error(L),P.error(te(L))}finally{n({loading:!1})}};v.useEffect(()=>{const a=r.fetched.find(b=>b.address===r.factoryAddress),o=r.errored.find(b=>b.address===r.factoryAddress);ve.isValid(r.factoryAddress)&&!r.fetching&&!a&&!o&&(n({fetching:!0}),cs(M.MAIN_CHAIN_ENDPOINT).getFactoryState({address:r.factoryAddress}).then(y=>{y.state?n({fetching:!1,fetched:[...r.fetched.filter(C=>C.address!==r.factoryAddress),y.state],remark:y.state.name}):n({fetching:!1,errored:[...r.errored.filter(C=>C.address!==r.factoryAddress),{address:r.factoryAddress}],error:l("team.passport.factory404",r)})}).catch(y=>{console.error(y),n({fetching:!1,error:te(y)})}))},[r.factoryAddress,r.fetching]);let g=r.error;const T=r.factoryAddress?r.errored.find(a=>a.address===r.factoryAddress):null;!g&&T&&(g=l("team.passport.factory404",r));const x=r.factoryAddress?r.fetched.find(a=>a.address===r.factoryAddress):null;return!g&&x&&(g=x.description),g||(g=l("team.passport.factoryAddressTip")),e.jsx(W,{title:l("team.passport.trustedFactories"),open:!0,showCloseButton:!1,PaperProps:{style:{minHeight:"80vh"}},fullWidth:!0,prepend:e.jsx(_,{onClick:c,"data-cy":"close-trusted-factory",size:"large",children:e.jsx(ge,{})}),actions:e.jsxs(e.Fragment,{children:[e.jsx(z,{onClick:c,color:"inherit",children:l("common.cancel")}),e.jsxs(z,{onClick:()=>m(),color:"primary",disabled:!r.factoryAddress||!r.remark||!r.role||r.loading||r.error||T,variant:"contained",autoFocus:!0,"data-cy":"save-trusted-factory",children:[r.loading&&e.jsx(B,{size:16}),l("common.save")]})]}),children:e.jsx(zs,{children:e.jsxs("div",{className:"dialog-content",children:[e.jsx(O,{fullWidth:!0,error:!!r.error||!!T,"data-cy":"input-factory-address",label:l("team.passport.factoryAddress"),helperText:g,value:r.factoryAddress,onChange:a=>{n({factoryAddress:a.target.value,error:""})},slotProps:{input:{endAdornment:r.fetching?e.jsx(Ve,{position:"end",children:e.jsx(B,{size:16})}):null}}}),e.jsx(O,{style:{marginTop:32},fullWidth:!0,"data-cy":"input-factory-remark",label:l("common.remark"),value:r.remark,onChange:a=>{n({remark:a.target.value})}}),e.jsx(O,{style:{marginTop:32},fullWidth:!0,"data-cy":"input-passport-role",label:l("team.passport.role"),select:!0,value:r.role,onChange:a=>{n({role:a.target.value})},variant:"outlined",children:i.filter(a=>a.name!=="owner").map(a=>e.jsx(Q,{value:a.name,"data-cy":`passport-role-select-option-${a.name}`,children:e.jsx("span",{children:a.title||a.name})},a.name))}),e.jsxs("div",{style:{marginTop:32},children:[e.jsx(Ze,{children:l("team.passport.ttl")}),e.jsxs(Qe,{color:"primary",size:"small",value:r.ttlPolicy,exclusive:!0,style:{marginTop:16},onChange:(a,o)=>n({ttlPolicy:o}),"data-cy":"input-passport-ttl-since","aria-label":"Expire Policy",children:[e.jsx(ee,{value:"never","data-cy":"input-passport-ttl-never",children:e.jsx(G,{title:l("team.passport.ttlNeverTip"),children:e.jsx(F,{children:l("team.passport.ttlNever")})})}),e.jsx(ee,{value:"mint","data-cy":"input-passport-ttl-mint",children:e.jsx(G,{title:l("team.passport.ttlMintTip"),children:e.jsx(F,{children:l("team.passport.ttlMint")})})}),e.jsx(ee,{value:"exchange","data-cy":"input-passport-ttl-exchange",children:e.jsx(G,{title:l("team.passport.ttlExchangeTip"),children:e.jsx(F,{children:l("team.passport.ttlExchange")})})})]}),r.ttlPolicy!=="never"&&e.jsxs(e.Fragment,{children:[e.jsx(Xe,{fullWidth:!0,type:"text",style:{marginTop:16},"data-cy":"input-passport-ttl",value:r.ttl,onChange:a=>{n({ttl:a.target.value})}}),e.jsx(Je,{children:l("team.passport.ttlTip")})]})]})]})})})}Be.propTypes={onCancel:S.func.isRequired,onSuccess:S.func.isRequired,trustedFactories:S.array,data:S.object};const zs=$.div`
|
|
111
111
|
.dialog-h1 {
|
|
112
112
|
font-size: 18px;
|
|
113
113
|
}
|
|
@@ -119,7 +119,7 @@ import{r as v,g as $e,a as qe}from"./vendor-react-CUXIiAnY.js";import{g as Ue,k
|
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
-
`;function ue({onCancel:c,hasPermission:s=!1}){const{api:p}=
|
|
122
|
+
`;function ue({onCancel:c,hasPermission:s=!1}){const{api:p}=D(),{teamDid:u,trustedFactories:f}=N(),{t:i}=A(),[d,l]=v.useState(null),[r,n]=v.useState(!1),[h,m]=v.useState(null),[g,T]=v.useState(""),x=async o=>{if(!r)try{n(!0),await p.configTrustedFactories({input:{teamDid:u,trustedFactories:f.filter(b=>b.factoryAddress!==o)}}),await V(800),n(!1),P.success(i("common.saveSuccess")),l(null)}catch(b){n(!1),P.error(b.message)}},a=f.filter(o=>!g||o.factoryAddress.toLowerCase().includes(g.toLowerCase()));return e.jsxs(W,{title:i("team.passport.trustedFactories"),open:!0,onClose:c,fullWidth:!0,PaperProps:{style:{minHeight:"80vh"}},children:[e.jsx(Fs,{children:e.jsxs("div",{className:"dialog-content",children:[e.jsx("div",{className:"dialog-h1",children:i("team.passport.trustedFactoriesTip")}),e.jsx(Ie,{sx:{mt:3},actions:e.jsxs(e.Fragment,{children:[e.jsx(ye,{options:{searchPlaceholder:i("team.passport.searchFactoryAddress"),searchDebounceTime:600},search:g,searchText:g,searchTextUpdate:T,searchClose:()=>T(""),onSearchOpen:()=>{}}),s&&e.jsxs(z,{variant:"contained",color:"primary",size:"small","data-cy":"add-trusted-factory",onClick:()=>m({mode:"add"}),children:[e.jsx(je,{style:{fontSize:16,marginRight:4}}),i("team.add")]})]})}),e.jsxs("div",{className:"list",children:[a.map(o=>e.jsxs(t,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mt:"20px"},children:[e.jsxs(t,{sx:{flexGrow:1},children:[e.jsx(oe,{copyable:!1,did:o.factoryAddress,size:16,showDidLogo:!1}),!!o.remark&&e.jsx(t,{sx:{fontSize:12,maxWidth:"300px"},children:o.remark})]}),e.jsx(t,{sx:{color:"gray",mr:"24px"},children:e.jsx(as,{type:"success",children:o.passport.role})}),e.jsxs(t,{sx:{flexShrink:0,display:"flex",alignItems:"center"},children:[e.jsx(_,{onClick:()=>m({mode:"update",data:K(o)}),"data-cy":"edit-trusted-factory",size:"large",children:e.jsx(we,{})}),e.jsx(_,{"data-cy":"delete-trusted-factory",onClick:()=>l({title:i("common.delete"),description:i("common.delConfirmDescription",{data:o.factoryAddress}),confirm:i("common.delConfirm"),cancel:i("common.cancel"),onConfirm:()=>x(o.factoryAddress),onCancel:()=>{n(!1),l(null)}}),size:"large",children:e.jsx(ce,{})})]})]},o.factoryAddress)),!f.length&&e.jsx(re,{children:i("common.empty")})]})]})}),h&&e.jsx(Be,{data:h.data,trustedFactories:K(f),onCancel:()=>m(null),onSuccess:()=>{m(null)}}),d&&e.jsx(Te,{title:d.title,description:d.description,confirm:d.confirm,cancel:d.cancel,params:d.params,onConfirm:d.onConfirm,onCancel:d.onCancel})]})}ue.propTypes={onCancel:S.func.isRequired,hasPermission:S.bool};const Ns=q(ue,"mutate_team"),Bs=q(ue,"",J);function Es(c){const{inService:s}=D();return s?e.jsx(Bs,{...c}):e.jsx(Ns,{...c})}const Fs=$.div`
|
|
123
123
|
.list {
|
|
124
124
|
.MuiIconButton-root {
|
|
125
125
|
svg {
|
|
@@ -127,7 +127,7 @@ import{r as v,g as $e,a as qe}from"./vendor-react-CUXIiAnY.js";import{g as Ue,k
|
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
|
-
`;function Ee({createPassportSvg:c}){const{t:s}=A(),{api:p,inService:u}=
|
|
130
|
+
`;function Ee({createPassportSvg:c}){const{t:s}=A(),{api:p,inService:u}=D(),{teamDid:f,refresh:i,enablePassportIssuance:d,isNodeTeam:l}=N(),[r,n]=v.useState(!1),[h,m]=v.useState(!1),[g,T]=v.useState(!1),[x,a]=v.useState(!1),[o,b]=v.useState(!1),y=async C=>{if(C.stopPropagation(),!x){a(!0);try{await p.configPassportIssuance({input:{teamDid:f,enable:!d}}),i(),await V(800),P.success(s("common.configSuccess"))}catch(w){P.error(w.message)}finally{a(!1)}}};return e.jsxs(t,{sx:{display:"flex",alignItems:"center",gap:1,ml:1},children:[e.jsx(fs,{permission:u?"":"mutate_team",role:u?J:[],children:e.jsx(H,{variant:"outlined",menuButtonProps:{"data-cy":"trusted-issuers-more"},menu:e.jsxs(e.Fragment,{children:[e.jsx(H.Item,{onClick:()=>m(!0),"data-cy":"config-trusted-issuers",children:e.jsxs(t,{children:[s("team.passport.trustedPassportIssuers"),e.jsx(t,{sx:{fontSize:12,color:"#888"},children:s("team.passport.trustedPassportIssuersTip")})]})}),e.jsx(H.Item,{onClick:()=>T(!0),"data-cy":"config-show-trusted-factories",children:e.jsxs(t,{children:[s("team.passport.configFactories"),e.jsx(t,{sx:{fontSize:12,color:"#888"},children:s("team.passport.configFactoriesTip")})]})}),e.jsx(H.Item,{"data-cy":"config-show-issue-passport",onClick:y,children:e.jsxs(t,{sx:{display:"flex",alignItems:"center"},children:[x&&e.jsx(B,{size:16,style:{marginRight:8}}),e.jsxs(t,{children:[s(d?"team.passport.disableIssuance":"team.passport.enableIssuance"),e.jsx(t,{sx:{fontSize:12,color:"#888"},children:s(d?"team.passport.disableIssuanceTip":"team.passport.enableIssuanceTip")})]})]})}),!l&&e.jsx(H.Item,{onClick:()=>n(!0),"data-cy":"config-passport-color",children:e.jsxs(t,{children:[s("team.passport.configColor"),e.jsx(t,{sx:{fontSize:12,color:"#888"},children:s("team.passport.configColorTip")})]})})]}),children:()=>e.jsx(z,{variant:"outlined",onClick:()=>{b(!0)},children:s("team.passport.view")})})}),h&&e.jsx(Rs,{onCancel:()=>m(!1)}),g&&e.jsx(Es,{onCancel:()=>T(!1)}),r&&e.jsx(Ts,{onCancel:()=>n(!1),onSuccess:()=>n(!1)}),o&&e.jsx(W,{open:!0,maxWidth:"lg",onClose:()=>b(!1),onBackdropClick:()=>b(!1),onEscapeKeyDown:()=>b(!1),title:s("team.passport.view"),children:e.jsx(ys,{createPassportSvg:c,onCancel:()=>b(!1)})})]})}Ee.propTypes={createPassportSvg:S.func.isRequired};const xe="$all",he="",Fe=qe.memo(({createPassportSvg:c,passport:s,teamDid:p,inService:u})=>e.jsx(t,{sx:{display:"flex"},dangerouslySetInnerHTML:{__html:c({scope:s.scope,role:s.role,title:s.scope==="kyc"?s.name:s.title,issuer:s.issuer&&s.issuer.name,issuerDid:s.issuer&&s.issuer.id,ownerName:s.user?.fullName,ownerDid:s.user?.did,ownerAvatarUrl:s.user?.avatar?Ce(s.user?.avatar,p,u):"",revoked:s.revoked,width:"36px",extra:s?.expirationDate?{key:"Exp",value:be(s.expirationDate).format("YYYY-MM-DD HH:mm:ss")}:null})}}));Fe.propTypes={passport:S.object.isRequired,createPassportSvg:S.func.isRequired,teamDid:S.string.isRequired,inService:S.bool.isRequired};function Os({createPassportSvg:c}){const{api:s}=D(),{teamDid:p}=N(),{t:u,locale:f}=A(),{SYSTEM_ROLES:i}=ps(),{inService:d}=D(),[l,r]=v.useState(!1),n=`passports-${p}`,h=rs(n),[m,g]=v.useState({role:xe,status:he,searchText:h.searchText||"",pageSize:h.rowsPerPage||10,page:h.page?h.page+1:1}),{data:T,loading:x}=Z(async()=>(await s.getPassportRoleCounts({input:{teamDid:p}})).counts||[],{refreshDeps:[p]}),{data:a,loading:o}=Z(async()=>{const j={};m.role!==xe&&(j.role=m.role),m.status&&(j.status=m.status);const I=await s.getPassportsByRole({input:{teamDid:p,query:j,paging:{page:m.page,pageSize:m.pageSize}}});return{passports:I.passports||[],total:I.paging.total}},{refreshDeps:[m.role,m.status,m.page,m.pageSize],onError:j=>P.error(j.message)}),b=j=>T?.find(R=>R.key===j)?.value||0,y=v.useMemo(()=>Object.keys(i).map(j=>({name:j,title:i[j],num:b(j)})),[T,b]),C=v.useMemo(()=>[{label:u("team.passport.role"),name:"role",options:{customBodyRender:(j,{rowIndex:I})=>{const R=a?.passports[I];return e.jsxs(t,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(Fe,{createPassportSvg:c,passport:R,teamDid:p}),e.jsx(t,{children:ne(R.title)})]})}}},{label:u("team.passport.owner"),name:"user",options:{customBodyRender:j=>ie(j,d)}},{label:u("team.passport.status"),name:"status",options:{customBodyRender:le}},{label:u("team.member.lastLogin"),name:"lastLoginAt",options:{customBodyRender:j=>Se(j,f)}},{label:u("common.address"),name:"id",options:{customBodyRender:us}},{label:u("blocklet.overview.source"),name:"source",options:{customBodyRender:(j,{rowIndex:I})=>{const R=a?.passports[I];return R.parentDid?X("recover"):X(R.source)}}}],[u,f,a?.passports,p,c,d]),w=j=>{g(I=>({...I,role:j,page:1}))},k=({page:j,rowsPerPage:I,searchText:R})=>{m.pageSize!==I?g(E=>({...E,searchText:"",pageSize:I,page:1})):m.page!==j+1?g(E=>({...E,searchText:"",page:j+1})):m.searchText!==R&&g(E=>({...E,searchText:R,page:1}))},L=v.useRef(null),U=a?.passports||[],Oe=m.searchText?U.filter(j=>j.id.includes(m.searchText)||(j?.user?.fullName||"").includes(m.searchText)):U,Me={sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,onRowClick(j,{dataIndex:I},R){if(L.current?.contains(R.target)){const E=a?.passports[I];r(E)}},page:m.page-1,rowsPerPage:m.pageSize,count:a?.total||0,searchDebounceTime:600},_e=j=>{g(I=>({...I,status:j.target.value,page:1}))},We=e.jsxs(t,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsxs(t,{sx:{fontSize:16,fontWeight:400},children:[u("team.passport.status"),":"]}),e.jsxs(es,{size:"small",value:m.status,onChange:_e,displayEmpty:!0,sx:{minWidth:120,height:36,".MuiSelect-select":{py:.5,px:1.5}},children:[e.jsx(Q,{value:he,children:u("common.all")}),Object.values(M.PASSPORT_STATUS).map(j=>e.jsx(Q,{value:j,sx:{py:1},children:u(`team.passport.statusMap.${j}`)},j))]})]});return x?e.jsx(t,{sx:{py:2},children:e.jsx(Y,{direction:"row",spacing:1,sx:{justifyContent:"center",alignItems:"center",position:"relative",pb:2},children:e.jsx(B,{})})}):e.jsxs(Ms,{children:[e.jsxs(t,{className:"main",sx:{display:"flex",mt:0,gap:3},children:[e.jsx(t,{className:"left",children:e.jsx(t,{className:"tabs",children:y.map(j=>e.jsxs(t,{className:`tab ${m.role===j.name?"active":""}`,onClick:()=>w(j.name),children:[e.jsx("span",{className:"text",children:j.title}),e.jsx(t,{sx:{color:"text.secondary"},children:j.num})]},j.name))})}),e.jsx(t,{ref:L,className:"right",children:e.jsx(ae,{className:"main-table",verticalKeyWidth:100,locale:f,durable:n,durableKeys:["page","rowsPerPage"],data:Oe,columns:C,options:Me,loading:o,onChange:k,customButtons:[e.jsx(Ee,{createPassportSvg:c})],title:We})})]}),l&&e.jsx(Pe,{createPassportSvg:c,onCancel:()=>r(null),passport:l,onSwitchPassport:r})]})}Os.propTypes={createPassportSvg:S.func.isRequired};const Ms=ss(t)`
|
|
131
131
|
.main {
|
|
132
132
|
.left {
|
|
133
133
|
width: 256px;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{r as j,g as ge}from"./vendor-react-CUXIiAnY.js";import{j as o,T as H,z as $,x as ye,c3 as ve,c4 as Y,bw as je,F as Ce,bD as Te,aX as Fe,a6 as U,W as C,b6 as be,a5 as we,I as K,at as G,ak as B,J as Se,Q as Be,cb as De,am as Re}from"./vendor-mui-core-
|
|
1
|
+
import{r as j,g as ge}from"./vendor-react-CUXIiAnY.js";import{j as o,T as H,z as $,x as ye,c3 as ve,c4 as Y,bw as je,F as Ce,bD as Te,aX as Fe,a6 as U,W as C,b6 as be,a5 as we,I as K,at as G,ak as B,J as Se,Q as Be,cb as De,am as Re}from"./vendor-mui-core-DHT36AZL.js";import{_ as E,b6 as ae,B as le,c as Ne}from"./index-CN4lpn74.js";import{V as L,b as ce,n as _,H as z,E as ee,S as Pe}from"./vendor-ux-sqP3hEhY.js";import{e as ue}from"./edit.svg-Dz9cVo7r.js";import{C as He}from"./lock.svg-BPCZ0CT3.js";import{G as Ie,H as _e}from"./vendor-utils-BSZ4yJws.js";import{f as pe}from"./index-DBs9Ljax.js";import{u as de}from"./team-BnNEVFdE.js";import{w as me,P as Ee}from"./permission-DLnMVuoy.js";import{C as Le}from"./confirm-DPD7yjeR.js";const Me=u=>j.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...u},j.createElement("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"}));var A={exports:{}},W={exports:{}},te;function ke(){return te||(te=1,function(){var u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",m={rotl:function(a,c){return a<<c|a>>>32-c},rotr:function(a,c){return a<<32-c|a>>>c},endian:function(a){if(a.constructor==Number)return m.rotl(a,8)&16711935|m.rotl(a,24)&4278255360;for(var c=0;c<a.length;c++)a[c]=m.endian(a[c]);return a},randomBytes:function(a){for(var c=[];a>0;a--)c.push(Math.floor(Math.random()*256));return c},bytesToWords:function(a){for(var c=[],l=0,p=0;l<a.length;l++,p+=8)c[p>>>5]|=a[l]<<24-p%32;return c},wordsToBytes:function(a){for(var c=[],l=0;l<a.length*32;l+=8)c.push(a[l>>>5]>>>24-l%32&255);return c},bytesToHex:function(a){for(var c=[],l=0;l<a.length;l++)c.push((a[l]>>>4).toString(16)),c.push((a[l]&15).toString(16));return c.join("")},hexToBytes:function(a){for(var c=[],l=0;l<a.length;l+=2)c.push(parseInt(a.substr(l,2),16));return c},bytesToBase64:function(a){for(var c=[],l=0;l<a.length;l+=3)for(var p=a[l]<<16|a[l+1]<<8|a[l+2],d=0;d<4;d++)l*8+d*6<=a.length*8?c.push(u.charAt(p>>>6*(3-d)&63)):c.push("=");return c.join("")},base64ToBytes:function(a){a=a.replace(/[^A-Z0-9+\/]/ig,"");for(var c=[],l=0,p=0;l<a.length;p=++l%4)p!=0&&c.push((u.indexOf(a.charAt(l-1))&Math.pow(2,-2*p+8)-1)<<p*2|u.indexOf(a.charAt(l))>>>6-p*2);return c}};W.exports=m}()),W.exports}var V,re;function ne(){if(re)return V;re=1;var u={utf8:{stringToBytes:function(m){return u.bin.stringToBytes(unescape(encodeURIComponent(m)))},bytesToString:function(m){return decodeURIComponent(escape(u.bin.bytesToString(m)))}},bin:{stringToBytes:function(m){for(var a=[],c=0;c<m.length;c++)a.push(m.charCodeAt(c)&255);return a},bytesToString:function(m){for(var a=[],c=0;c<m.length;c++)a.push(String.fromCharCode(m[c]));return a.join("")}}};return V=u,V}/*!
|
|
2
2
|
* Determine if an object is a Buffer
|
|
3
3
|
*
|
|
4
4
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
5
5
|
* @license MIT
|
|
6
|
-
*/var O,se;function ke(){if(se)return O;se=1,O=function(a){return a!=null&&(u(a)||m(a)||!!a._isBuffer)};function u(a){return!!a.constructor&&typeof a.constructor.isBuffer=="function"&&a.constructor.isBuffer(a)}function m(a){return typeof a.readFloatLE=="function"&&typeof a.slice=="function"&&u(a.slice(0,0))}return O}var ie;function $e(){return ie||(ie=1,function(){var u=Me(),m=ne().utf8,a=ke(),c=ne().bin,l=function(p,d){p.constructor==String?d&&d.encoding==="binary"?p=c.stringToBytes(p):p=m.stringToBytes(p):a(p)?p=Array.prototype.slice.call(p,0):!Array.isArray(p)&&p.constructor!==Uint8Array&&(p=p.toString());for(var s=u.bytesToWords(p),f=p.length*8,n=1732584193,t=-271733879,r=-1732584194,e=271733878,i=0;i<s.length;i++)s[i]=(s[i]<<8|s[i]>>>24)&16711935|(s[i]<<24|s[i]>>>8)&4278255360;s[f>>>5]|=128<<f%32,s[(f+64>>>9<<4)+14]=f;for(var v=l._ff,g=l._gg,y=l._hh,h=l._ii,i=0;i<s.length;i+=16){var F=n,D=t,R=r,w=e;n=v(n,t,r,e,s[i+0],7,-680876936),e=v(e,n,t,r,s[i+1],12,-389564586),r=v(r,e,n,t,s[i+2],17,606105819),t=v(t,r,e,n,s[i+3],22,-1044525330),n=v(n,t,r,e,s[i+4],7,-176418897),e=v(e,n,t,r,s[i+5],12,1200080426),r=v(r,e,n,t,s[i+6],17,-1473231341),t=v(t,r,e,n,s[i+7],22,-45705983),n=v(n,t,r,e,s[i+8],7,1770035416),e=v(e,n,t,r,s[i+9],12,-1958414417),r=v(r,e,n,t,s[i+10],17,-42063),t=v(t,r,e,n,s[i+11],22,-1990404162),n=v(n,t,r,e,s[i+12],7,1804603682),e=v(e,n,t,r,s[i+13],12,-40341101),r=v(r,e,n,t,s[i+14],17,-1502002290),t=v(t,r,e,n,s[i+15],22,1236535329),n=g(n,t,r,e,s[i+1],5,-165796510),e=g(e,n,t,r,s[i+6],9,-1069501632),r=g(r,e,n,t,s[i+11],14,643717713),t=g(t,r,e,n,s[i+0],20,-373897302),n=g(n,t,r,e,s[i+5],5,-701558691),e=g(e,n,t,r,s[i+10],9,38016083),r=g(r,e,n,t,s[i+15],14,-660478335),t=g(t,r,e,n,s[i+4],20,-405537848),n=g(n,t,r,e,s[i+9],5,568446438),e=g(e,n,t,r,s[i+14],9,-1019803690),r=g(r,e,n,t,s[i+3],14,-187363961),t=g(t,r,e,n,s[i+8],20,1163531501),n=g(n,t,r,e,s[i+13],5,-1444681467),e=g(e,n,t,r,s[i+2],9,-51403784),r=g(r,e,n,t,s[i+7],14,1735328473),t=g(t,r,e,n,s[i+12],20,-1926607734),n=y(n,t,r,e,s[i+5],4,-378558),e=y(e,n,t,r,s[i+8],11,-2022574463),r=y(r,e,n,t,s[i+11],16,1839030562),t=y(t,r,e,n,s[i+14],23,-35309556),n=y(n,t,r,e,s[i+1],4,-1530992060),e=y(e,n,t,r,s[i+4],11,1272893353),r=y(r,e,n,t,s[i+7],16,-155497632),t=y(t,r,e,n,s[i+10],23,-1094730640),n=y(n,t,r,e,s[i+13],4,681279174),e=y(e,n,t,r,s[i+0],11,-358537222),r=y(r,e,n,t,s[i+3],16,-722521979),t=y(t,r,e,n,s[i+6],23,76029189),n=y(n,t,r,e,s[i+9],4,-640364487),e=y(e,n,t,r,s[i+12],11,-421815835),r=y(r,e,n,t,s[i+15],16,530742520),t=y(t,r,e,n,s[i+2],23,-995338651),n=h(n,t,r,e,s[i+0],6,-198630844),e=h(e,n,t,r,s[i+7],10,1126891415),r=h(r,e,n,t,s[i+14],15,-1416354905),t=h(t,r,e,n,s[i+5],21,-57434055),n=h(n,t,r,e,s[i+12],6,1700485571),e=h(e,n,t,r,s[i+3],10,-1894986606),r=h(r,e,n,t,s[i+10],15,-1051523),t=h(t,r,e,n,s[i+1],21,-2054922799),n=h(n,t,r,e,s[i+8],6,1873313359),e=h(e,n,t,r,s[i+15],10,-30611744),r=h(r,e,n,t,s[i+6],15,-1560198380),t=h(t,r,e,n,s[i+13],21,1309151649),n=h(n,t,r,e,s[i+4],6,-145523070),e=h(e,n,t,r,s[i+11],10,-1120210379),r=h(r,e,n,t,s[i+2],15,718787259),t=h(t,r,e,n,s[i+9],21,-343485551),n=n+F>>>0,t=t+D>>>0,r=r+R>>>0,e=e+w>>>0}return u.endian([n,t,r,e])};l._ff=function(p,d,s,f,n,t,r){var e=p+(d&s|~d&f)+(n>>>0)+r;return(e<<t|e>>>32-t)+d},l._gg=function(p,d,s,f,n,t,r){var e=p+(d&f|s&~f)+(n>>>0)+r;return(e<<t|e>>>32-t)+d},l._hh=function(p,d,s,f,n,t,r){var e=p+(d^s^f)+(n>>>0)+r;return(e<<t|e>>>32-t)+d},l._ii=function(p,d,s,f,n,t,r){var e=p+(s^(d|~f))+(n>>>0)+r;return(e<<t|e>>>32-t)+d},l._blocksize=16,l._digestsize=16,A.exports=function(p,d){if(p==null)throw new Error("Illegal argument "+p);var s=u.wordsToBytes(l(p,d));return d&&d.asBytes?s:d&&d.asString?c.bytesToString(s):u.bytesToHex(s)}}()),A.exports}var ze=$e();const Ae=ge(ze);function Z({teamDid:u,onCancel:m,onSuccess:a,onError:c=()=>{},mode:l="create",item:p={},orgId:d=""}){const{api:s}=q(),[f,n]=j.useState(!1),[t,r]=j.useState(""),{t:e}=E(),[i,v]=j.useState(p.title||""),[g,y]=j.useState(p.description||""),[h,F]=j.useState(p?.extra?.display||"builtin"),[D,R]=j.useState(p?.extra?.types?p.extra.types.join(","):""),w=async()=>{const x=i.trim();if(!x){r(e("team.passport.error.titleEmpty"));return}if(x.length>64){r(e("team.passport.error.titleTooLong",{length:64}));return}const N=g.replace(/\n/g," ");if(!N){r(e("team.passport.error.descriptionEmpty"));return}const I=l==="create"?Ae(d?`${d}-${x}`:x):p.name;r(null),n(!0);try{if(l==="create"){const S={teamDid:u,name:I,title:x,description:N,...d?{orgId:d}:{}};h==="custom"&&(S.extra=JSON.stringify({display:"custom",types:D.split(",")})),await s.createRole({input:S})}else{const S={teamDid:u,role:{name:I,title:x,description:N},...d?{orgId:d}:{}};await s.updateRole({input:S})}a()}catch(S){const M=pe(S);r(M),c(S)}finally{n(!1)}},L=o.jsxs("div",{children:[l==="update"&&o.jsx(H,{component:"div",style:{paddingTop:16},children:o.jsx($,{label:"ID",autoComplete:"off",variant:"outlined",name:"url","data-cy":"mutate-role-input-name",fullWidth:!0,autoFocus:!0,value:p.name,disabled:!0})}),o.jsx(H,{component:"div",style:{marginTop:16},children:o.jsx($,{label:e("common.title"),autoComplete:"off",variant:"outlined",name:"title","data-cy":"mutate-role-input-title",fullWidth:!0,autoFocus:!0,value:i,onChange:x=>{r(null),v(x.target.value)},disabled:l==="update"||f,helperText:e("team.passport.create.titleTip")})}),o.jsx(H,{component:"div",style:{marginTop:16,marginBottom:16},children:o.jsx($,{label:e("common.description"),autoComplete:"off",variant:"outlined",name:"description","data-cy":"mutate-role-input-description",fullWidth:!0,autoFocus:!0,value:g,onChange:x=>{r(null),y(x.target.value)},disabled:f,multiline:!0,rows:3})}),l==="create"&&o.jsxs("div",{style:{marginBottom:16},children:[o.jsx(ye,{children:e("common.display")}),o.jsxs(ve,{color:"primary",size:"small",value:h,exclusive:!0,style:{marginTop:16},disabled:f,onChange:(x,N)=>F(N),"data-cy":"input-role-display",children:[o.jsx(Y,{value:"builtin","data-cy":"input-role-display-builtin",children:o.jsx(H,{children:e("team.passport.displayBuiltin")})}),o.jsx(Y,{value:"custom","data-cy":"input-role-display-custom",children:o.jsx(H,{children:e("team.passport.displayCustom")})})]}),h==="custom"&&o.jsxs(o.Fragment,{children:[o.jsx(je,{fullWidth:!0,type:"text",style:{marginTop:16},"data-cy":"input-role-types",value:D,disabled:f,onChange:x=>{R(x.target.value)}}),o.jsx(Ce,{children:e("team.passport.typesTip")})]})]})]});return o.jsxs(ce,{title:l==="create"?e("team.passport.create.title"):"",fullWidth:!0,open:!0,onClose:m,showCloseButton:!1,actions:o.jsxs(o.Fragment,{children:[o.jsx(_,{onClick:m,color:"inherit",children:e("common.cancel")}),o.jsxs(_,{"data-cy":"mutate-role-confirm",onClick:w,color:"primary",disabled:f,variant:"contained",autoFocus:!0,children:[f&&o.jsx(U,{size:16}),e(l==="create"?"common.create":"common.update")]})]}),children:[o.jsx(Te,{component:"div",children:L}),!!t&&o.jsx(Fe,{severity:"error",style:{width:"100%",margin:0},children:t})]})}Z.propTypes={teamDid:C.string.isRequired,onCancel:C.func.isRequired,onSuccess:C.func.isRequired,onError:C.func,mode:C.oneOf(["create","update"]),item:C.object,orgId:C.string};function J({onCancel:u,onSuccess:m,onDelete:a,roleName:c,roles:l=void 0,hasPermission:p=!1,orgId:d=""}){const{api:s}=q(),{roles:f,permissions:n,teamDid:t,refresh:r,isNodeTeam:e}=de(),{t:i}=E(),[v,g]=j.useState([]),[y,h]=j.useState(!1),[F,D]=j.useState(null),[R,w]=j.useState(!1),L=j.useMemo(()=>l||f,[l,f]),x=Ie(L.find(T=>T.name===c)),N=ae(c),I=async T=>{if(!R)try{w(!0),await s.deleteRole({input:{teamDid:t,name:T}}),a()}catch(b){z.error(b.message)}finally{w(!1),D(null)}},S=async(T,b)=>{const fe=(await s.getPermissionsByRole({input:{teamDid:T,role:{name:b}}})).permissions||[],xe=n.map(X=>({...X,bind:fe.some(he=>he.name===X.name)}));g(xe)},M=async()=>{w(!0);const T=v.filter(b=>b.bind).map(b=>b.name);try{await s.updatePermissionsForRole({input:{teamDid:t,roleName:x.name,grantNames:T}}),z.success(i("common.saveSuccess")),m()}catch(b){z.error(pe(b))}finally{w(!1)}};j.useEffect(()=>{t&&c&&S(t,c)},[t,c]);const k=e||!p;let Q=null;return e&&(Q=o.jsxs("div",{className:"bind",children:[o.jsx("div",{className:"title",children:i("common.permission")}),o.jsx("div",{className:"list",children:v.filter(T=>k?T.bind:!0).map(T=>o.jsx("div",{className:"item",children:o.jsx(be,{control:o.jsx(we,{disabled:k,checked:T.bind,onChange:()=>{g(b=>b.map(P=>(P.name===T.name&&(P.bind=!P.bind),P)))},name:T.name}),label:T.description})}))})]})),o.jsxs(ce,{title:i("common.passport"),onClose:u,open:!0,fullWidth:!0,toolbar:p&&!N&&o.jsxs(o.Fragment,{children:[o.jsx(K,{onClick:()=>h(x),"data-cy":`edit-passport-${x.name}`,size:"large",children:o.jsx(ue,{fill:"#bfbfbf"})}),o.jsx(K,{onClick:()=>D({title:i("team.passport.delete.title"),description:i("team.passport.delete.description",{name:x.title}),confirm:i("common.delConfirm"),cancel:i("common.cancel"),onConfirm:()=>{I(x.name)},onCancel:()=>{w(!1),D(null)}}),"data-cy":`delete-passport-${x.name}`,size:"large",children:o.jsx(Le,{"data-cy":"close-passport-dialog",fill:"#bfbfbf"})})]}),actions:e&&!k&&o.jsxs(o.Fragment,{children:[o.jsx(_,{onClick:u,color:"inherit",children:i("common.cancel")}),o.jsxs(_,{onClick:M,color:"primary",disabled:R||!x,variant:"contained",autoFocus:!0,"data-cy":"bind-permission-btn-confirm",children:[R&&o.jsx(U,{size:16}),i("common.save")]})]}),children:[o.jsxs(Ue,{children:[!x&&o.jsx(Ge,{children:o.jsx(U,{})}),x&&o.jsxs("div",{className:"dialog-content",children:[o.jsxs("div",{className:"header",children:[o.jsx("div",{className:"title",children:x.title}),o.jsx("div",{className:"description",style:{marginTop:e?16:48},children:x.description})]}),Q]})]}),y&&o.jsx(Z,{teamDid:t,onCancel:()=>h(null),onSuccess:()=>{h(null),d?m():r()},mode:"update",roleName:y.name,item:y,orgId:d}),F&&o.jsx(Ee,{title:F.title,description:F.description,confirm:F.confirm,cancel:F.cancel,params:F.params,onConfirm:F.onConfirm,onCancel:F.onCancel})]})}const We=me(J,"mutate_team"),Ve=me(J,"",le);function Oe(u){const{inService:m}=q();return m?o.jsx(Ve,{...u}):o.jsx(We,{...u})}J.propTypes={roleName:C.string.isRequired,onCancel:C.func.isRequired,onSuccess:C.func.isRequired,onDelete:C.func.isRequired,hasPermission:C.bool,roles:C.array,orgId:C.string};const Ue=G.div`
|
|
6
|
+
*/var O,se;function qe(){if(se)return O;se=1,O=function(a){return a!=null&&(u(a)||m(a)||!!a._isBuffer)};function u(a){return!!a.constructor&&typeof a.constructor.isBuffer=="function"&&a.constructor.isBuffer(a)}function m(a){return typeof a.readFloatLE=="function"&&typeof a.slice=="function"&&u(a.slice(0,0))}return O}var ie;function $e(){return ie||(ie=1,function(){var u=ke(),m=ne().utf8,a=qe(),c=ne().bin,l=function(p,d){p.constructor==String?d&&d.encoding==="binary"?p=c.stringToBytes(p):p=m.stringToBytes(p):a(p)?p=Array.prototype.slice.call(p,0):!Array.isArray(p)&&p.constructor!==Uint8Array&&(p=p.toString());for(var s=u.bytesToWords(p),f=p.length*8,n=1732584193,t=-271733879,r=-1732584194,e=271733878,i=0;i<s.length;i++)s[i]=(s[i]<<8|s[i]>>>24)&16711935|(s[i]<<24|s[i]>>>8)&4278255360;s[f>>>5]|=128<<f%32,s[(f+64>>>9<<4)+14]=f;for(var v=l._ff,g=l._gg,y=l._hh,h=l._ii,i=0;i<s.length;i+=16){var F=n,D=t,R=r,w=e;n=v(n,t,r,e,s[i+0],7,-680876936),e=v(e,n,t,r,s[i+1],12,-389564586),r=v(r,e,n,t,s[i+2],17,606105819),t=v(t,r,e,n,s[i+3],22,-1044525330),n=v(n,t,r,e,s[i+4],7,-176418897),e=v(e,n,t,r,s[i+5],12,1200080426),r=v(r,e,n,t,s[i+6],17,-1473231341),t=v(t,r,e,n,s[i+7],22,-45705983),n=v(n,t,r,e,s[i+8],7,1770035416),e=v(e,n,t,r,s[i+9],12,-1958414417),r=v(r,e,n,t,s[i+10],17,-42063),t=v(t,r,e,n,s[i+11],22,-1990404162),n=v(n,t,r,e,s[i+12],7,1804603682),e=v(e,n,t,r,s[i+13],12,-40341101),r=v(r,e,n,t,s[i+14],17,-1502002290),t=v(t,r,e,n,s[i+15],22,1236535329),n=g(n,t,r,e,s[i+1],5,-165796510),e=g(e,n,t,r,s[i+6],9,-1069501632),r=g(r,e,n,t,s[i+11],14,643717713),t=g(t,r,e,n,s[i+0],20,-373897302),n=g(n,t,r,e,s[i+5],5,-701558691),e=g(e,n,t,r,s[i+10],9,38016083),r=g(r,e,n,t,s[i+15],14,-660478335),t=g(t,r,e,n,s[i+4],20,-405537848),n=g(n,t,r,e,s[i+9],5,568446438),e=g(e,n,t,r,s[i+14],9,-1019803690),r=g(r,e,n,t,s[i+3],14,-187363961),t=g(t,r,e,n,s[i+8],20,1163531501),n=g(n,t,r,e,s[i+13],5,-1444681467),e=g(e,n,t,r,s[i+2],9,-51403784),r=g(r,e,n,t,s[i+7],14,1735328473),t=g(t,r,e,n,s[i+12],20,-1926607734),n=y(n,t,r,e,s[i+5],4,-378558),e=y(e,n,t,r,s[i+8],11,-2022574463),r=y(r,e,n,t,s[i+11],16,1839030562),t=y(t,r,e,n,s[i+14],23,-35309556),n=y(n,t,r,e,s[i+1],4,-1530992060),e=y(e,n,t,r,s[i+4],11,1272893353),r=y(r,e,n,t,s[i+7],16,-155497632),t=y(t,r,e,n,s[i+10],23,-1094730640),n=y(n,t,r,e,s[i+13],4,681279174),e=y(e,n,t,r,s[i+0],11,-358537222),r=y(r,e,n,t,s[i+3],16,-722521979),t=y(t,r,e,n,s[i+6],23,76029189),n=y(n,t,r,e,s[i+9],4,-640364487),e=y(e,n,t,r,s[i+12],11,-421815835),r=y(r,e,n,t,s[i+15],16,530742520),t=y(t,r,e,n,s[i+2],23,-995338651),n=h(n,t,r,e,s[i+0],6,-198630844),e=h(e,n,t,r,s[i+7],10,1126891415),r=h(r,e,n,t,s[i+14],15,-1416354905),t=h(t,r,e,n,s[i+5],21,-57434055),n=h(n,t,r,e,s[i+12],6,1700485571),e=h(e,n,t,r,s[i+3],10,-1894986606),r=h(r,e,n,t,s[i+10],15,-1051523),t=h(t,r,e,n,s[i+1],21,-2054922799),n=h(n,t,r,e,s[i+8],6,1873313359),e=h(e,n,t,r,s[i+15],10,-30611744),r=h(r,e,n,t,s[i+6],15,-1560198380),t=h(t,r,e,n,s[i+13],21,1309151649),n=h(n,t,r,e,s[i+4],6,-145523070),e=h(e,n,t,r,s[i+11],10,-1120210379),r=h(r,e,n,t,s[i+2],15,718787259),t=h(t,r,e,n,s[i+9],21,-343485551),n=n+F>>>0,t=t+D>>>0,r=r+R>>>0,e=e+w>>>0}return u.endian([n,t,r,e])};l._ff=function(p,d,s,f,n,t,r){var e=p+(d&s|~d&f)+(n>>>0)+r;return(e<<t|e>>>32-t)+d},l._gg=function(p,d,s,f,n,t,r){var e=p+(d&f|s&~f)+(n>>>0)+r;return(e<<t|e>>>32-t)+d},l._hh=function(p,d,s,f,n,t,r){var e=p+(d^s^f)+(n>>>0)+r;return(e<<t|e>>>32-t)+d},l._ii=function(p,d,s,f,n,t,r){var e=p+(s^(d|~f))+(n>>>0)+r;return(e<<t|e>>>32-t)+d},l._blocksize=16,l._digestsize=16,A.exports=function(p,d){if(p==null)throw new Error("Illegal argument "+p);var s=u.wordsToBytes(l(p,d));return d&&d.asBytes?s:d&&d.asString?c.bytesToString(s):u.bytesToHex(s)}}()),A.exports}var ze=$e();const Ae=ge(ze);function Z({teamDid:u,onCancel:m,onSuccess:a,onError:c=()=>{},mode:l="create",item:p={},orgId:d=""}){const{api:s}=E(),[f,n]=j.useState(!1),[t,r]=j.useState(""),{t:e}=L(),[i,v]=j.useState(p.title||""),[g,y]=j.useState(p.description||""),[h,F]=j.useState(p?.extra?.display||"builtin"),[D,R]=j.useState(p?.extra?.types?p.extra.types.join(","):""),w=async()=>{const x=i.trim();if(!x){r(e("team.passport.error.titleEmpty"));return}if(x.length>64){r(e("team.passport.error.titleTooLong",{length:64}));return}const N=g.replace(/\n/g," ");if(!N){r(e("team.passport.error.descriptionEmpty"));return}const I=l==="create"?Ae(d?`${d}-${x}`:x):p.name;r(null),n(!0);try{if(l==="create"){const S={teamDid:u,name:I,title:x,description:N,...d?{orgId:d}:{}};h==="custom"&&(S.extra=JSON.stringify({display:"custom",types:D.split(",")})),await s.createRole({input:S})}else{const S={teamDid:u,role:{name:I,title:x,description:N},...d?{orgId:d}:{}};await s.updateRole({input:S})}a()}catch(S){const k=pe(S);r(k),c(S)}finally{n(!1)}},M=o.jsxs("div",{children:[l==="update"&&o.jsx(H,{component:"div",style:{paddingTop:16},children:o.jsx($,{label:"ID",autoComplete:"off",variant:"outlined",name:"url","data-cy":"mutate-role-input-name",fullWidth:!0,autoFocus:!0,value:p.name,disabled:!0})}),o.jsx(H,{component:"div",style:{marginTop:16},children:o.jsx($,{label:e("common.title"),autoComplete:"off",variant:"outlined",name:"title","data-cy":"mutate-role-input-title",fullWidth:!0,autoFocus:!0,value:i,onChange:x=>{r(null),v(x.target.value)},disabled:l==="update"||f,helperText:e("team.passport.create.titleTip")})}),o.jsx(H,{component:"div",style:{marginTop:16,marginBottom:16},children:o.jsx($,{label:e("common.description"),autoComplete:"off",variant:"outlined",name:"description","data-cy":"mutate-role-input-description",fullWidth:!0,autoFocus:!0,value:g,onChange:x=>{r(null),y(x.target.value)},disabled:f,multiline:!0,rows:3})}),l==="create"&&o.jsxs("div",{style:{marginBottom:16},children:[o.jsx(ye,{children:e("common.display")}),o.jsxs(ve,{color:"primary",size:"small",value:h,exclusive:!0,style:{marginTop:16},disabled:f,onChange:(x,N)=>F(N),"data-cy":"input-role-display",children:[o.jsx(Y,{value:"builtin","data-cy":"input-role-display-builtin",children:o.jsx(H,{children:e("team.passport.displayBuiltin")})}),o.jsx(Y,{value:"custom","data-cy":"input-role-display-custom",children:o.jsx(H,{children:e("team.passport.displayCustom")})})]}),h==="custom"&&o.jsxs(o.Fragment,{children:[o.jsx(je,{fullWidth:!0,type:"text",style:{marginTop:16},"data-cy":"input-role-types",value:D,disabled:f,onChange:x=>{R(x.target.value)}}),o.jsx(Ce,{children:e("team.passport.typesTip")})]})]})]});return o.jsxs(ce,{title:l==="create"?e("team.passport.create.title"):"",fullWidth:!0,open:!0,onClose:m,showCloseButton:!1,actions:o.jsxs(o.Fragment,{children:[o.jsx(_,{onClick:m,color:"inherit",children:e("common.cancel")}),o.jsxs(_,{"data-cy":"mutate-role-confirm",onClick:w,color:"primary",disabled:f,variant:"contained",autoFocus:!0,children:[f&&o.jsx(U,{size:16}),e(l==="create"?"common.create":"common.update")]})]}),children:[o.jsx(Te,{component:"div",children:M}),!!t&&o.jsx(Fe,{severity:"error",style:{width:"100%",margin:0},children:t})]})}Z.propTypes={teamDid:C.string.isRequired,onCancel:C.func.isRequired,onSuccess:C.func.isRequired,onError:C.func,mode:C.oneOf(["create","update"]),item:C.object,orgId:C.string};function J({onCancel:u,onSuccess:m,onDelete:a,roleName:c,roles:l=void 0,hasPermission:p=!1,orgId:d=""}){const{api:s}=E(),{roles:f,permissions:n,teamDid:t,refresh:r,isNodeTeam:e}=de(),{t:i}=L(),[v,g]=j.useState([]),[y,h]=j.useState(!1),[F,D]=j.useState(null),[R,w]=j.useState(!1),M=j.useMemo(()=>l||f,[l,f]),x=Ie(M.find(T=>T.name===c)),N=ae(c),I=async T=>{if(!R)try{w(!0),await s.deleteRole({input:{teamDid:t,name:T}}),a()}catch(b){z.error(b.message)}finally{w(!1),D(null)}},S=async(T,b)=>{const fe=(await s.getPermissionsByRole({input:{teamDid:T,role:{name:b}}})).permissions||[],xe=n.map(X=>({...X,bind:fe.some(he=>he.name===X.name)}));g(xe)},k=async()=>{w(!0);const T=v.filter(b=>b.bind).map(b=>b.name);try{await s.updatePermissionsForRole({input:{teamDid:t,roleName:x.name,grantNames:T}}),z.success(i("common.saveSuccess")),m()}catch(b){z.error(pe(b))}finally{w(!1)}};j.useEffect(()=>{t&&c&&S(t,c)},[t,c]);const q=e||!p;let Q=null;return e&&(Q=o.jsxs("div",{className:"bind",children:[o.jsx("div",{className:"title",children:i("common.permission")}),o.jsx("div",{className:"list",children:v.filter(T=>q?T.bind:!0).map(T=>o.jsx("div",{className:"item",children:o.jsx(be,{control:o.jsx(we,{disabled:q,checked:T.bind,onChange:()=>{g(b=>b.map(P=>(P.name===T.name&&(P.bind=!P.bind),P)))},name:T.name}),label:T.description})}))})]})),o.jsxs(ce,{title:i("common.passport"),onClose:u,open:!0,fullWidth:!0,toolbar:p&&!N&&o.jsxs(o.Fragment,{children:[o.jsx(K,{onClick:()=>h(x),"data-cy":`edit-passport-${x.name}`,size:"large",children:o.jsx(ue,{fill:"#bfbfbf"})}),o.jsx(K,{onClick:()=>D({title:i("team.passport.delete.title"),description:i("team.passport.delete.description",{name:x.title}),confirm:i("common.delConfirm"),cancel:i("common.cancel"),onConfirm:()=>{I(x.name)},onCancel:()=>{w(!1),D(null)}}),"data-cy":`delete-passport-${x.name}`,size:"large",children:o.jsx(Me,{"data-cy":"close-passport-dialog",fill:"#bfbfbf"})})]}),actions:e&&!q&&o.jsxs(o.Fragment,{children:[o.jsx(_,{onClick:u,color:"inherit",children:i("common.cancel")}),o.jsxs(_,{onClick:k,color:"primary",disabled:R||!x,variant:"contained",autoFocus:!0,"data-cy":"bind-permission-btn-confirm",children:[R&&o.jsx(U,{size:16}),i("common.save")]})]}),children:[o.jsxs(Ue,{children:[!x&&o.jsx(Ge,{children:o.jsx(U,{})}),x&&o.jsxs("div",{className:"dialog-content",children:[o.jsxs("div",{className:"header",children:[o.jsx("div",{className:"title",children:x.title}),o.jsx("div",{className:"description",style:{marginTop:e?16:48},children:x.description})]}),Q]})]}),y&&o.jsx(Z,{teamDid:t,onCancel:()=>h(null),onSuccess:()=>{h(null),d?m():r()},mode:"update",roleName:y.name,item:y,orgId:d}),F&&o.jsx(Le,{title:F.title,description:F.description,confirm:F.confirm,cancel:F.cancel,params:F.params,onConfirm:F.onConfirm,onCancel:F.onCancel})]})}const We=me(J,"mutate_team"),Ve=me(J,"",le);function Oe(u){const{inService:m}=E();return m?o.jsx(Ve,{...u}):o.jsx(We,{...u})}J.propTypes={roleName:C.string.isRequired,onCancel:C.func.isRequired,onSuccess:C.func.isRequired,onDelete:C.func.isRequired,hasPermission:C.bool,roles:C.array,orgId:C.string};const Ue=G.div`
|
|
7
7
|
.header {
|
|
8
8
|
.title {
|
|
9
9
|
font-weight: 400;
|
|
@@ -52,7 +52,7 @@ import{r as j,g as ge}from"./vendor-react-CUXIiAnY.js";import{j as o,T as H,z as
|
|
|
52
52
|
justify-content: center;
|
|
53
53
|
align-items: center;
|
|
54
54
|
height: 200px;
|
|
55
|
-
`,oe=j.memo(({field:u,value:m,copyable:a})=>{const{local:c}=
|
|
55
|
+
`,oe=j.memo(({field:u,value:m,copyable:a})=>{const{local:c}=L();return m?o.jsxs(B,{onClick:l=>l.stopPropagation(),sx:{display:"flex",alignItems:"center",gap:1},children:[u?o.jsxs(ee,{variant:"subtitle1",color:"textSecondary",sx:{width:50,textAlign:"right"},children:[u,":"]}):null,o.jsx(ee,{variant:"body1",children:o.jsxs(B,{sx:{display:"flex",alignItems:"center"},children:[o.jsx(Re,{title:m,children:o.jsx("span",{className:"value-ellipsis",children:m})}),a?o.jsx(Pe,{content:_e(m),locale:c,style:{marginLeft:"4px",color:"#999",fontSize:"0.8em",verticalAlign:"bottom"}}):null]})})]}):null}),Ze=j.memo(({role:u={},createPassportSvg:m,onUpdate:a,passportProps:c={},actions:l=null})=>{const{inService:p}=E(),d=Se(f=>f.breakpoints.down("md")),s=j.useMemo(()=>u.name&&!Ne.ROLES[u.name.toUpperCase()],[u]);return o.jsxs(B,{"data-cy":`passport-${u.name}`,className:"item",onClick:()=>a(u),sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[o.jsxs(B,{sx:{display:"flex",alignItems:"center"},children:[o.jsx("div",{style:{width:150},dangerouslySetInnerHTML:{__html:m({title:u.title,ownerName:"Your Name",width:"150px",...c})}}),o.jsxs(B,{className:"title",sx:{ml:3},children:[o.jsx(oe,{value:u.title}),s?o.jsx(oe,{value:u.name,copyable:!0}):null]})]}),!d&&o.jsx(B,{className:"description",children:u.description}),l||o.jsx(Ee,{permission:p?"":"mutate_team",role:p?le:[],children:o.jsx("div",{className:"action",children:ae(u.name)?o.jsx(He,{}):o.jsx(ue,{})})})]},u.name)});function Je({createPassportSvg:u}){const{roles:m,teamIssuerDid:a,teamName:c,refresh:l,passportColor:p,teamDid:d,isNodeTeam:s}=de(),{t:f}=L(),[n,t]=j.useState(!1),[r,e]=j.useState(!1);return o.jsxs(Qe,{sx:{mt:0},children:[o.jsx(B,{sx:{display:"flex",justifyContent:"flex-end"},children:!s&&o.jsxs(Be,{variant:"contained",edge:"end",color:"primary","data-cy":"create-role",onClick:()=>t(!0),children:[o.jsx(De,{style:{fontSize:16,marginRight:4}}),f("team.passport.create.title")]})}),o.jsx(B,{className:"list",children:m.map(i=>o.jsx(Ze,{role:i,createPassportSvg:u,onUpdate:e,passportProps:{issuer:c,issuerDid:a,ownerDid:a,preferredColor:p}}))}),r&&o.jsx(Oe,{onCancel:()=>e(!1),onSuccess:()=>{e(!1),l()},onDelete:()=>{e(!1),l()},mode:"update",roleName:r.name,item:r}),n&&o.jsx(Z,{teamDid:d,onCancel:()=>t(!1),onSuccess:()=>{t(!1),l()}})]})}const Qe=G(B)`
|
|
56
56
|
.list {
|
|
57
57
|
.item {
|
|
58
58
|
padding: 12px;
|
|
@@ -90,4 +90,4 @@ import{r as j,g as ge}from"./vendor-react-CUXIiAnY.js";import{j as o,T as H,z as
|
|
|
90
90
|
fill: ${({theme:u})=>u.palette.text.secondary};
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
|
-
`;Je.propTypes={createPassportSvg:C.func.isRequired};export{Qe as D,
|
|
93
|
+
`;Je.propTypes={createPassportSvg:C.func.isRequired};export{Qe as D,Me as H,Z as M,Je as P,Ze as a,J as b};
|