@abtnode/blocklet-services 1.16.45-beta-20250609-111118-0d252ebe → 1.16.45-beta-20250612-231219-481217be
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/cache.js +36 -21
- package/api/libs/connect/session.js +2 -2
- package/api/middlewares/proxy-to-daemon.js +6 -2
- package/api/routes/blocklet.js +25 -5
- package/api/routes/dns-resolver.js +1 -1
- package/api/routes/env.js +2 -1
- package/api/services/auth/connect/invite.js +1 -1
- package/api/services/auth/connect/issue-passport.js +1 -1
- package/api/services/auth/connect/verify-destroy.js +3 -6
- package/api/services/auth/connect/verify-elevated.js +8 -9
- package/api/services/auth/session.js +1 -1
- package/api/services/oauth/server.js +2 -1
- package/api/socket/channel/did.js +2 -2
- package/dist/assets/{AdapterDayjs-BXVfASrK.js → AdapterDayjs-BzjU9O7t.js} +1 -1
- package/dist/assets/{ArrowDropDown-Ce8TY3aP.js → ArrowDropDown-CrJjI_sT.js} +1 -1
- package/dist/assets/{CheckCircle-M9NlpTm_.js → CheckCircle-BcPSvH2E.js} +1 -1
- package/dist/assets/{ChevronLeft-02OWcWpH.js → ChevronLeft-Ch9iK6fF.js} +1 -1
- package/dist/assets/{ChevronRight-CB8w0u2n.js → ChevronRight-DclARA5k.js} +1 -1
- package/dist/assets/{Community-vE_QnoqV.js → Community-D4mv0jfL.js} +1 -1
- package/dist/assets/{DeleteOutline-1-hBNY1U.js → DeleteOutline-CnS2XiM1.js} +1 -1
- package/dist/assets/{Done-CcJLRcBY.js → Done-C9LPqADS.js} +1 -1
- package/dist/assets/{Download-HHknpEZd.js → Download-D9LfWoxF.js} +1 -1
- package/dist/assets/{Edit-hd-cDU5C.js → Edit-rPlryssW.js} +1 -1
- package/dist/assets/{EditIcon-DiM9RB8U.js → EditIcon-DfiDnAsm.js} +1 -1
- package/dist/assets/{Error-D0rGqAKE.js → Error-q_AhSCeT.js} +1 -1
- package/dist/assets/{ExpandLess-Fb-uW6u_.js → ExpandLess-Da2Rv9Ox.js} +1 -1
- package/dist/assets/{Google-WGwK551e.js → Google-Buu8u6PW.js} +1 -1
- package/dist/assets/{Holiday-BnL2IwX3.js → Holiday-DkzYmdt-.js} +1 -1
- package/dist/assets/{Home-DeTVRhMG.js → Home-DkCBzKe9.js} +1 -1
- package/dist/assets/{InfoOutlined-CLiL5VeK.js → InfoOutlined-C8ZBPUhD.js} +1 -1
- package/dist/assets/{Launch-BwVeOcBz.js → Launch-Nu8TBDKk.js} +1 -1
- package/dist/assets/{LaunchOutlined-CPurmWuM.js → LaunchOutlined-DQZ7S23O.js} +1 -1
- package/dist/assets/{LockIcon-QnxDGvZv.js → LockIcon-BEG59s5q.js} +1 -1
- package/dist/assets/{Meeting-BkjjPbp7.js → Meeting-KSUAdbzW.js} +1 -1
- package/dist/assets/{MoreHoriz-9E3q8aHi.js → MoreHoriz-Ba9rYlyz.js} +1 -1
- package/dist/assets/{OffSick-D2B01pyN.js → OffSick-B0VcZ-o0.js} +1 -1
- package/dist/assets/{PlayArrow-B_ZNrQDa.js → PlayArrow-RVSfCmrB.js} +1 -1
- package/dist/assets/{QuestionMarkCircle-BMcwgPWr.js → QuestionMarkCircle-jbhclAfX.js} +1 -1
- package/dist/assets/{TuneOutlined-0oMZE8a4.js → TuneOutlined-CwV20zYf.js} +1 -1
- package/dist/assets/{ViewList-ColSGL1_.js → ViewList-D1BI4ac9.js} +1 -1
- package/dist/assets/{WorkingRemotely-CxoGYC4d.js → WorkingRemotely-5Kw3C-_c.js} +1 -1
- package/dist/assets/{access-control-nyeEpwlF.js → access-control-C-kFaf9T.js} +1 -1
- package/dist/assets/{actions-DtL6bYnA.js → actions-DYQW2ChM.js} +1 -1
- package/dist/assets/{add-component-core-CaE3xcyT.js → add-component-core-UeQfX1b1.js} +37 -37
- package/dist/assets/add-resource-BdL-oJxe.js +1 -0
- package/dist/assets/{addon-e-JO0VU3.js → addon-DMedfvRj.js} +1 -1
- package/dist/assets/{advanced-yrYBgA5T.js → advanced-BZZToP_j.js} +2 -2
- package/dist/assets/api-87p2GGd0.js +1 -0
- package/dist/assets/{appearance-DB1QowgL.js → appearance-CYop22yw.js} +1 -1
- package/dist/assets/ar-D9QEDjY-.js +7 -0
- package/dist/assets/{audit-logs-BamIXrWh.js → audit-logs-BtBk6uAY.js} +3 -3
- package/dist/assets/{authorize-B9LP0G9q.js → authorize-CQZkUNyV.js} +1 -1
- package/dist/assets/{base-chart-BYonGucU.js → base-chart-C2FJuVG1.js} +1 -1
- package/dist/assets/{base32-CmYq1ikq.js → base32-DEjena1X.js} +1 -1
- package/dist/assets/{branding-OlEgtAUT.js → branding-7ppDxFZf.js} +2 -2
- package/dist/assets/branding-gXMozCeI.js +54 -0
- package/dist/assets/{bundle-avatar-C41ZXEbR.js → bundle-avatar-B5-ypzmO.js} +1 -1
- package/dist/assets/button-YPMo8IwK.js +1 -0
- package/dist/assets/{click-to-copy-BUVqg1RQ.js → click-to-copy-BMX2P5UB.js} +1 -1
- package/dist/assets/{cloneDeep-ro06l5HL.js → cloneDeep-Jl_OPbSo.js} +1 -1
- package/dist/assets/{collapse--nd2JDBL.js → collapse-9taxUXec.js} +1 -1
- package/dist/assets/{complete-gnnvUqGU.js → complete-C8T0HN-B.js} +1 -1
- package/dist/assets/{component-ClWADDCr.js → component-D6hOmRzO.js} +1 -1
- package/dist/assets/{config-2Sy6fCTJ.js → config-DcwlSddI.js} +1 -1
- package/dist/assets/{config-QpBBpp7d.js → config-Sq1CUTiJ.js} +1 -1
- package/dist/assets/{config-navigation-CsVa3Hf0.js → config-navigation-IR_yUgmM.js} +6 -6
- package/dist/assets/{config-space-B39Ur9Mf.js → config-space-C3fS58cn.js} +1 -1
- package/dist/assets/{confirm-Bay3BcpN.js → confirm-DApmnpvm.js} +1 -1
- package/dist/assets/{connect-T4cAO9om.js → connect-BF4GoRL-.js} +1 -1
- package/dist/assets/connect-Bf8y7fMm.js +5 -0
- package/dist/assets/{connect-to-Dac7orQh.js → connect-to-Bwfa2hMr.js} +1 -1
- package/dist/assets/{content-layout-DuPlKBe3.js → content-layout-BC2QkTYi.js} +1 -1
- package/dist/assets/dashboard-B2X6c8E8.js +239 -0
- package/dist/assets/{de-Dv_ApqsF.js → de-BOa43YBF.js} +2 -2
- package/dist/assets/{delete-confirm-B1F5wKdb.js → delete-confirm-BsEqJQRY.js} +1 -1
- package/dist/assets/{did-address-bJAfhuZx.js → did-address-L54dTMrT.js} +1 -1
- package/dist/assets/domain-BGh0GDuZ.js +9 -0
- package/dist/assets/{domain-action-card-yyZstsWL.js → domain-action-card-DWqnvzry.js} +2 -2
- package/dist/assets/domains-CdwErmIF.js +1 -0
- package/dist/assets/dot-iw3hN9HL.js +7 -0
- package/dist/assets/{email-CYOorZ7K.js → email-By_nAv9m.js} +1 -1
- package/dist/assets/{empty-spinner-DSwpCqdd.js → empty-spinner-BHwHZpq-.js} +1 -1
- package/dist/assets/es-A3ma-OJp.js +9 -0
- package/dist/assets/{exchange-passport-xHfEBrd8.js → exchange-passport-BsgMfRJS.js} +1 -1
- package/dist/assets/fr-I3xKp6I5.js +7 -0
- package/dist/assets/{fuel-CtSAk9S3.js → fuel-RMmgm9AQ.js} +1 -1
- package/dist/assets/{gen-access-key-CoOxXtqa.js → gen-access-key-4teK8Dys.js} +1 -1
- package/dist/assets/{get-safe-url-BWDUV79Q.js → get-safe-url-B8xlSMyD.js} +1 -1
- package/dist/assets/{get-safe-url-CwT4-jkw.js → get-safe-url-t1C0E5Ux.js} +1 -1
- package/dist/assets/{hi-Dqbq8i5Y.js → hi-DacRhM8A.js} +1 -1
- package/dist/assets/{home-D1kBU1RC.js → home-CmHUXg5q.js} +1 -1
- package/dist/assets/{id-Bxr8o3Uo.js → id-B7LQAHL7.js} +3 -3
- package/dist/assets/{iframe-DsIqy16E.js → iframe-Dj9NLHp2.js} +1 -1
- package/dist/assets/{index-BoQJXOtZ.js → index-B2NkqENf.js} +1 -1
- package/dist/assets/{index-BpvW-cUy.js → index-BCtTVvHw.js} +1 -1
- package/dist/assets/{index-Cx-ESLe9.js → index-Bb7iSrGO.js} +4 -4
- package/dist/assets/{index-CTfYMqG2.js → index-Be8E3hiQ.js} +5 -5
- package/dist/assets/{index-DQl2QJod.js → index-BeE0KRva.js} +2 -2
- package/dist/assets/{index-DWgnwzKO.js → index-Bv7OAPJU.js} +1 -1
- package/dist/assets/{index-BnR8uU0R.js → index-BzZuK-66.js} +1 -1
- package/dist/assets/{index-CyS4mBmV.js → index-C8uNNoMb.js} +6 -6
- package/dist/assets/{index-CI4cLtBE.js → index-CCOwwQoc.js} +1 -1
- package/dist/assets/{index-DMSe2Qjx.js → index-CJQbYw9E.js} +2 -2
- package/dist/assets/{index-Dntq1ezd.js → index-CKY4HT0P.js} +1 -1
- package/dist/assets/{index-B18R5SlV.js → index-CMYalRl2.js} +7 -7
- package/dist/assets/{index-BXjOxZPH.js → index-CTlzm-Mc.js} +1 -1
- package/dist/assets/{index-8kcb4Nom.js → index-Cs3-IS09.js} +1 -1
- package/dist/assets/{index-DU8cx_m6.js → index-DEZojGsm.js} +1 -1
- package/dist/assets/{index-B7qZ5OdP.js → index-DXeoVV9Y.js} +11 -11
- package/dist/assets/{index-B1fP-8KR.js → index-DaM-GRtb.js} +2 -2
- package/dist/assets/{index-DaMn1fo9.js → index-Dfw2EDXA.js} +10 -10
- package/dist/assets/{index-DO-a7P7z.js → index-Dgsq6V-N.js} +1 -1
- package/dist/assets/{index-B4wY8GsU.js → index-DtZg53T9.js} +3 -3
- package/dist/assets/{index-j6UAnd8n.js → index-F85lIJcp.js} +1 -1
- package/dist/assets/{index-CY9xLy04.js → index-Inc_KF9k.js} +3 -3
- package/dist/assets/{index-CZgWTJXl.js → index-Mzv6hCex.js} +1 -1
- package/dist/assets/{index-Brd3-BIC.js → index-NnUiYa0L.js} +1 -1
- package/dist/assets/{index-C5vFhD_w.js → index-SX_KWrQh.js} +1 -1
- package/dist/assets/{invitation-BsuZg3B2.js → invitation-Ck_kq3Tr.js} +3 -3
- package/dist/assets/{invite-YNiMO-nB.js → invite-89aeW4Ho.js} +1 -1
- package/dist/assets/{issue-passport-2R7-XHuR.js → issue-passport-4udVYVdq.js} +1 -1
- package/dist/assets/{item-DHMVgmIa.js → item-D0U5vYXJ.js} +1 -1
- package/dist/assets/{ja-CJfcqkdo.js → ja-DRQ4Eecl.js} +3 -1
- package/dist/assets/{ko-BxAazRix.js → ko-CzL3UzwL.js} +3 -1
- package/dist/assets/{launch-result-message-DNgJY11G.js → launch-result-message-AharZGq2.js} +1 -1
- package/dist/assets/{layout-BnunMkuP.js → layout-CQb1lhEv.js} +1 -1
- package/dist/assets/{list-h4Ed_myi.js → list-BOdwWlS0.js} +2 -2
- package/dist/assets/{list-DZwgo-zf.js → list-KVxvPXZu.js} +6 -6
- package/dist/assets/{list-header-D976e09p.js → list-header-C7gle0n0.js} +1 -1
- package/dist/assets/localization-OxVxEhoS.js +1 -0
- package/dist/assets/{log-6M_J_pon.js → log-DOIh9luu.js} +1 -1
- package/dist/assets/{logger-KwxABgLK.js → logger-Dhaq1LDX.js} +1 -1
- package/dist/assets/{login-C2ILZhOf.js → login-J6Bsrh3B.js} +1 -1
- package/dist/assets/{login-oauth-callback-Dt9V4GRH.js → login-oauth-callback-BRmEibAb.js} +1 -1
- package/dist/assets/{logo-uploader-Dhh7Un4G.js → logo-uploader-Dzebv-rF.js} +3 -3
- package/dist/assets/{lost-passport-JODD9Yck.js → lost-passport-p5ZuXjnG.js} +2 -2
- package/dist/assets/{omit-O1pUD7ku.js → omit-BlzmxIB5.js} +1 -1
- package/dist/assets/{open-window-Dn44K3ur.js → open-window-Byi7CkW_.js} +1 -1
- package/dist/assets/{overview-Bjj9JLCV.js → overview-ClOSCvvh.js} +1 -1
- package/dist/assets/{page-header-JH9JWGMg.js → page-header-C_KAJILy.js} +1 -1
- package/dist/assets/{passport-item-CoNRdRpk.js → passport-item-Du8-xENr.js} +1 -1
- package/dist/assets/{permission-B7ZHEOJv.js → permission-ClRym5FB.js} +1 -1
- package/dist/assets/preferences-B6Y0XpLo.js +1 -0
- package/dist/assets/profile-embed-C_hd_hMh.js +1 -0
- package/dist/assets/{pt-FpFCyI6v.js → pt-CHKumXYv.js} +3 -3
- package/dist/assets/publish-resource-kHaYkbDE.js +1 -0
- package/dist/assets/{react-beautiful-dnd.esm-DCPrD7-r.js → react-beautiful-dnd.esm-CHsohizU.js} +1 -1
- package/dist/assets/{ru-BuGIFp9h.js → ru-CvkEKhgU.js} +1 -1
- package/dist/assets/{runtime-1mGYl_p2.js → runtime-D5P_2uNM.js} +1 -1
- package/dist/assets/{sanitize-DbZs1H_T.js → sanitize-B18rcrOf.js} +1 -1
- package/dist/assets/sdk-CbugbTkF.js +1 -0
- package/dist/assets/search-4YYphs0l.js +1 -0
- package/dist/assets/section-BDMQAX_r.js +41 -0
- package/dist/assets/{security-C2l4SCkx.js → security-CXewZHyS.js} +1 -1
- package/dist/assets/{session-1k8BRnYA.js → session-Bkvl2PSP.js} +1 -1
- package/dist/assets/setup-TPtYDnBB.js +30 -0
- package/dist/assets/{shorten-label-CTSJhlwO.js → shorten-label-BQvbtscf.js} +1 -1
- package/dist/assets/{simple-select-cKQxVH3U.js → simple-select-0cjVFuay.js} +1 -1
- package/dist/assets/{slicedToArray-CRrLoxQ4.js → slicedToArray-DFQjSbCD.js} +1 -1
- package/dist/assets/{spaces-CpSu6mVL.js → spaces-C1lh7et6.js} +1 -1
- package/dist/assets/{start-BotjXVuZ.js → start-BgSlMXsE.js} +1 -1
- package/dist/assets/{starting-progress-a7uoLG-L.js → starting-progress-BikYigPA.js} +1 -1
- package/dist/assets/{status-DIJ9lK3F.js → status-DDvFiBxA.js} +1 -1
- package/dist/assets/{step-actions-DLZOEVat.js → step-actions-_23FIn8v.js} +1 -1
- package/dist/assets/{studio-Cua13-ul.js → studio-Db5oA_Tx.js} +1 -1
- package/dist/assets/{switch-control-CzaI2YNK.js → switch-control-BYqb8MZf.js} +1 -1
- package/dist/assets/{table-tips-Czrj7r52.js → table-tips-BW6G2sKO.js} +1 -1
- package/dist/assets/{th-BafLD2wR.js → th-B2BUfjNJ.js} +1 -1
- package/dist/assets/{traffic-fPCLOWN3.js → traffic-CUSLm0PX.js} +1 -1
- package/dist/assets/{transfer-BqCYXmCB.js → transfer-CSsXAviu.js} +1 -1
- package/dist/assets/{unsubscribe-BE77Etc2.js → unsubscribe-BA46-fTa.js} +1 -1
- package/dist/assets/{use-blocklet-logo-DGSQQmh2.js → use-blocklet-logo-CTCMbFiC.js} +1 -1
- package/dist/assets/{use-mobile-CXU9YBvX.js → use-mobile-CtTQsfXN.js} +1 -1
- package/dist/assets/{use-mobile-CiFFAdJf.js → use-mobile-DwzRjjku.js} +1 -1
- package/dist/assets/{use-server-logo-BbYHFDuK.js → use-server-logo-UTr-CyJD.js} +1 -1
- package/dist/assets/useAsync-DVHp96Uu.js +1 -0
- package/dist/assets/{useLocalStorage-BF3BqN1O.js → useLocalStorage-DyVGBDlt.js} +1 -1
- package/dist/assets/user-center-Cap4mg5H.js +77 -0
- package/dist/assets/{util-xXGeezrD.js → util-DlS4tWs9.js} +1 -1
- package/dist/assets/{util-CS4PqVkK.js → util-M3UFXQFT.js} +1 -1
- package/dist/assets/{vendor-arcblock-B4hgrXYM.js → vendor-arcblock-DiSm3oUX.js} +7 -7
- package/dist/assets/{vendor-hooks-BCm626KH.js → vendor-hooks-BFlOfe0M.js} +1 -1
- package/dist/assets/{vendor-mui-core-wlbruq2I.js → vendor-mui-core-Bq8gXTan.js} +1 -1
- package/dist/assets/{vendor-mui-x-BKgL6hAa.js → vendor-mui-x-1nqAyytV.js} +1 -1
- package/dist/assets/vendor-utils-BotmZdBm.js +208 -0
- package/dist/assets/{vendor-ux-did-connect-CX7qG3_M.js → vendor-ux-did-connect-DVX9lQ8a.js} +66 -66
- package/dist/assets/{vi-BMZxxaJ2.js → vi-BykmwIAT.js} +3 -3
- package/dist/assets/wrap-locale-B8EvOR-l.js +1 -0
- package/dist/assets/{zh-DusA4qAT.js → zh-CbCaOuAd.js} +3 -1
- package/dist/assets/{zh-tw-BO-QhSNP.js → zh-tw-C9JfiCVV.js} +3 -1
- package/dist/index.html +6 -6
- package/dist/service-worker.js +1 -1
- package/package.json +33 -33
- package/dist/assets/add-resource-CG8u25Lv.js +0 -1
- package/dist/assets/api-CQoRx33p.js +0 -1
- package/dist/assets/ar-0ZkmCCuq.js +0 -7
- package/dist/assets/branding-C2Dm2Z1c.js +0 -54
- package/dist/assets/button-C0Vra3Ak.js +0 -1
- package/dist/assets/connect-B77rXeVL.js +0 -5
- package/dist/assets/dashboard-k0XcV2m5.js +0 -239
- package/dist/assets/domain-CEwb0Lyz.js +0 -9
- package/dist/assets/domains-CRt4uYYF.js +0 -1
- package/dist/assets/dot-DR7_m3Np.js +0 -7
- package/dist/assets/es-D_uF0siv.js +0 -7
- package/dist/assets/fr-DVFSQfDp.js +0 -7
- package/dist/assets/localization-BNjdHo-G.js +0 -1
- package/dist/assets/preferences-DUSp_pAb.js +0 -1
- package/dist/assets/profile-embed-BIjwkrGW.js +0 -1
- package/dist/assets/publish-resource-AW43Z8jj.js +0 -1
- package/dist/assets/sdk-BJQcHaGO.js +0 -1
- package/dist/assets/section-Bb547IGJ.js +0 -41
- package/dist/assets/setup-DxzbFXmd.js +0 -30
- package/dist/assets/useAsync-BMCqtJH2.js +0 -1
- package/dist/assets/useAsync-CBEJDwr0.js +0 -1
- package/dist/assets/user-center-olJmefSX.js +0 -77
- package/dist/assets/vendor-utils-B3iZkn2R.js +0 -208
- package/dist/assets/wrap-locale-Byq7otyk.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as k}from"./vendor-react-DEoibe3W.js";import{a as D,$ as R,k as L,B as z,bb as ke,ar as pe,
|
|
1
|
+
import{r as k}from"./vendor-react-DEoibe3W.js";import{a as D,$ as R,k as L,B as z,bb as ke,ar as pe,bZ as M,a3 as Ke,aI as ce,br as me,bs as ue,bt as xe,bG as Te,ce as ve,bd as Ae,ac as we,a5 as Se}from"./vendor-ux-did-connect-DVX9lQ8a.js";import{d as De}from"./Edit-rPlryssW.js";import{f as Ie}from"./index-8eXqqyHQ.js";import{r as ye}from"./passport-item-Du8-xENr.js";import{D as _,n as F,aN as Re,G as $e,f as Be}from"./index-CMYalRl2.js";import{u as N}from"./dashboard-B2X6c8E8.js";import{j as e,H as u,bo as V,br as G,bn as X,q as Q,aa as y,al as Z,O,ab as _e,bs as Ne,bR as Ee,ah as E,T as B,ad as le,ak as Pe}from"./vendor-mui-core-Bq8gXTan.js";import{v as Le,K as We}from"./vendor-arcblock-DiSm3oUX.js";import{T as fe}from"./index-Dgsq6V-N.js";import{C as he}from"./confirm-DApmnpvm.js";import{a1 as qe}from"./vendor-utils-BotmZdBm.js";import{C as H}from"./click-to-copy-BMX2P5UB.js";import{D as Ue}from"./delete-confirm-BsEqJQRY.js";import{P as ze}from"./permission-ClRym5FB.js";import{B as Me}from"./bundle-avatar-B5-ypzmO.js";import{W as Fe}from"./did-address-L54dTMrT.js";import{A as Oe}from"./actions-DYQW2ChM.js";import{u as He}from"./use-mobile-DwzRjjku.js";import{T as de}from"./table-tips-BW6G2sKO.js";import{y as Ve}from"./vendor-hooks-BFlOfe0M.js";import"./lottie-web-jYmAQWuC.js";import"./util-M3UFXQFT.js";import"./base32-DEjena1X.js";import"./useLocalStorage-DyVGBDlt.js";import"./PlayArrow-RVSfCmrB.js";import"./get-safe-url-B8xlSMyD.js";import"./session-Bkvl2PSP.js";import"./use-blocklet-logo-CTCMbFiC.js";import"./InfoOutlined-C8ZBPUhD.js";import"./dot-iw3hN9HL.js";import"./useAsync-DVHp96Uu.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-CtTQsfXN.js";import"./vendor-mui-x-1nqAyytV.js";import"./AdapterDayjs-BzjU9O7t.js";import"./MoreHoriz-Ba9rYlyz.js";function J({value:t}){const{t:s,locale:l}=D(),r=new Date;return new Date(t)<r?e.jsxs("span",{style:{color:"red"},children:[e.jsx(R,{value:t,locale:l}),`${s("setting.accessKey.expired",{time:""})}`]}):e.jsx(R,{value:t,locale:l,type:"all"})}J.propTypes={value:u.string.isRequired};function Y({value:t,onChange:s,...l}){const{t:r}=D(),d=k.useMemo(()=>[{value:"signature",title:r("setting.accessKey.signature"),description:r("setting.accessKey.signatureDesc")},{value:"simple",title:r("setting.accessKey.simple"),description:r("setting.accessKey.simpleDesc")}],[r]);return e.jsxs(V,{style:{width:"100%"},variant:"outlined",...l,children:[e.jsx(G,{children:r("setting.accessKey.authType")}),e.jsx(X,{value:t,onChange:s,fullWidth:!0,label:r("setting.accessKey.authType"),children:d.map(n=>e.jsx(Q,{value:n.value,children:e.jsxs(y,{children:[e.jsx("span",{children:n.title}),e.jsx(y,{maxWidth:510,fontSize:12,color:"#999",whiteSpace:"normal",children:n.description})]})},n.value))})]})}Y.propTypes={value:u.string.isRequired,onChange:u.func.isRequired};const W=()=>{const t=L.RBAC_CONFIG.roles.filter(d=>d.passport),{inService:s}=_(),{roles:l}=N(),r=[...t,...s?l:[]];return qe(r,"name").filter(d=>d.name!==L.ROLES.OWNER)};function ee(t){const{remark:s,onCreate:l}=t,{api:r}=_(),{teamDid:d}=N(),{t:n}=D(),[K,j]=k.useState(!1),[x,C]=k.useState(null),p=W(),f=()=>{j(!1),C(null)},g=async i=>{const{remark:v,passport:h,authType:o}=i;j(!0);const m=await r.createAccessKey({input:{teamDid:d,remark:v.trim(),passport:h,expireAt:i.expireAt?new Date(i.expireAt).getTime():null,authType:o}}),{data:S}=m;l(S),C(null),j(!1)},b={title:`${n("common.create")} ${n("accessKey")}`,description:(i,v,h)=>e.jsxs(Z,{gap:3,children:[e.jsx(O,{label:n("setting.accessKey.tip"),autoComplete:"off",variant:"outlined",name:"remark",inputProps:{"data-cy":"remark-input"},fullWidth:!0,autoFocus:!0,margin:"dense",value:i.remark,onChange:o=>{v({...i,remark:o.target.value,__disableConfirm:!i.passport||!o.target.value.trim()}),o.target.value.trim()?h(""):h(n("setting.accessKey.remarkInvalid"))}}),e.jsxs(V,{style:{width:"100%"},variant:"outlined",children:[e.jsx(G,{children:n("setting.accessKey.passport")}),e.jsx(X,{"data-cy":"create-access-key-select-passport",value:i.passport,onChange:o=>{const m=o.target.value;h(null),v({...i,passport:m,__disableConfirm:!i.remark||!m})},fullWidth:!0,label:n("setting.accessKey.passport"),disabled:K,children:p.map(o=>e.jsx(Q,{value:o.name,"data-cy":`create-access-key-passport-option-${o.name}`,children:e.jsxs(y,{children:[e.jsx("span",{children:o.title||o.name}),e.jsx(y,{maxWidth:440,fontSize:12,color:"#999",whiteSpace:"normal",textAlign:"justify",children:o.description})]})},o.name))})]}),e.jsx(Y,{value:i.authType,onChange:o=>{v({...i,authType:o.target.value})}}),e.jsx(fe,{placeholder:n("setting.accessKey.expireTime"),value:i.expireAt,onChange:o=>{v({...i,expireAt:o,__disableConfirm:!i.passport||!i.remark||!o})}})]}),confirm:n("common.confirm"),cancel:n("common.cancel"),color:"primary",params:{remark:s,authType:"signature",__disableConfirm:!s.trim()},onConfirm:g,onCancel:f};return e.jsxs(e.Fragment,{children:[e.jsxs(z,{sx:{color:"common.white"},edge:"end",variant:"contained",color:"primary","data-cy":"add-access-key-btn",onClick:()=>C(b),className:"rule-action",children:[K?e.jsx(_e,{size:16}):e.jsx(Le,{style:{fontSize:16}}),n("common.create")]}),x&&e.jsx(he,{title:x.title,description:x.description,confirm:x.confirm,color:x.color,cancel:x.cancel,params:x.params,onConfirm:x.onConfirm,onCancel:x.onCancel})]})}ee.propTypes={remark:u.string,onCreate:u.func};ee.defaultProps={onCreate:()=>{},remark:""};function te(t){const{onConfirm:s,accessKeyId:l,accessKeySecret:r,hideSecret:d}=t,{t:n}=k.useContext(ke),[K,j]=k.useState(!1),[x,C]=k.useState(()=>d),p=()=>{C(!x)},f=i=>{j(i.target.checked)},g=k.useMemo(()=>{var i,v,h,o;return d?`const Client = require('@abtnode/client');
|
|
2
2
|
const ensureServerEndpoint = require('@abtnode/util/lib/ensure-server-endpoint');
|
|
3
3
|
const { joinURL } = require('ufo');
|
|
4
4
|
|
|
@@ -8,7 +8,7 @@ const fullEndpoint = joinURL(endpoint, '/api/gql');
|
|
|
8
8
|
const client = new Client(fullEndpoint);
|
|
9
9
|
client.setAuthAccessKey({
|
|
10
10
|
accessKeyId: "${l}",
|
|
11
|
-
accessKeySecret: "${
|
|
11
|
+
accessKeySecret: "${r}",
|
|
12
12
|
});
|
|
13
13
|
|
|
14
14
|
const rootDid = '${((h=window.blocklet)==null?void 0:h.appId)||((o=window.blocklet)==null?void 0:o.appPid)}';
|
|
@@ -16,7 +16,7 @@ const result = await client.getBlocklet(
|
|
|
16
16
|
{ input: { did: rootDid, attachRuntimeInfo: false } },
|
|
17
17
|
{ headers: { 'x-access-blocklet': rootDid } }
|
|
18
18
|
);
|
|
19
|
-
`:`curl -H "Authorization: Bearer ${
|
|
19
|
+
`:`curl -H "Authorization: Bearer ${r}" "${(i=window.blocklet)==null?void 0:i.appUrl}${L.WELLKNOWN_SERVICE_PATH_PREFIX}/api/did/session"`},[d,l,r]),b=k.useMemo(()=>{var i;return d?`blocklet deploy --endpoint ${(i=window.blocklet)==null?void 0:i.appUrl} --access-key ${l} --access-secret ${r} {blockletPath}/.blocklet/bundle;`:null},[d,l,r]);return e.jsxs(pe,{title:n("common.createSuccess"),fullWidth:!0,open:!0,disableEscapeKeyDown:!0,onClose:s,showCloseButton:!1,actions:e.jsx("div",{children:e.jsx(z,{disabled:d?!K:!1,onClick:s,color:"primary",autoFocus:!0,variant:"contained","data-cy":"submit-confirm-dialog",children:n("common.confirm")})}),"aria-labelledby":"simple-dialog-title",children:[e.jsx("div",{children:e.jsx(Ge,{children:n(d?"setting.accessKey.saveSecretTip":"setting.accessKey.viewSecret")})}),e.jsx("div",{style:{marginTop:"20px"}}),e.jsxs(U,{children:[e.jsx(q,{children:n("setting.accessKey.accessKeyId")}),e.jsx(H,{children:l})]}),e.jsxs(U,{children:[e.jsx(q,{children:n("setting.accessKey.accessKeySecret")}),x?e.jsx(z,{"data-cy":"show-secret-btn",color:"primary",onClick:p,children:n("setting.accessKey.showSecret")}):e.jsx(H,{children:r})]}),!x&&e.jsxs(U,{children:[e.jsx(q,{children:`Access Key ${n("setting.accessKey.usage")}`}),e.jsx(M,{code:g,language:"javascript"}),b&&e.jsx(M,{code:b,language:"bash"})]}),d&&e.jsx("div",{children:e.jsx(Ne,{value:"end",disabled:x,control:e.jsx(Ee,{checked:K,onChange:f}),label:n("setting.accessKey.iKnow"),labelPlacement:"end"})})]})}te.propTypes={accessKeyId:u.string.isRequired,accessKeySecret:u.string.isRequired,onConfirm:u.func,hideSecret:u.bool};te.defaultProps={onConfirm:()=>{},hideSecret:!0};const q=E.div`
|
|
20
20
|
display: flex;
|
|
21
21
|
justify-content: space-between;
|
|
22
22
|
align-items: center;
|
|
@@ -27,14 +27,14 @@ const result = await client.getBlocklet(
|
|
|
27
27
|
`,Ge=E.div`
|
|
28
28
|
font-size: 16px;
|
|
29
29
|
font-weight: bold;
|
|
30
|
-
`;function se(t){const{t:s,locale:l}=D(),{api:
|
|
30
|
+
`;function se(t){const{t:s,locale:l}=D(),{api:r}=_(),{teamDid:d}=N(),{accessKeyId:n,time:K,remark:j,onDelete:x=()=>{},onClose:C=()=>{}}=t,p=()=>{C()},f=async()=>{try{await r.deleteAccessKey({input:{teamDid:d,accessKeyId:n}}),x()}catch(i){Ke.error(i==null?void 0:i.message)}finally{p()}},g=i=>({key:`<b>${n}</b>`,name:`<b>${j}</b>`,time:F(i,l),timeAge:We(new Date(i),Re(l))}),b={keyName:j,title:s("setting.accessKey.title"),description:K?`${s("setting.accessKey.description",g(K))}`:`${s("setting.accessKey.descriptionNoTime",{key:`<b>${n}</b>`,name:`<b>${j}</b>`})}`,confirmPlaceholder:s("setting.accessKey.confirm_desc",{name:j}),confirm:s("common.delConfirm"),cancel:s("common.cancel"),onConfirm:f,onCancel:p};return e.jsx(Ue,{keyName:b.keyName,title:b.title,description:b.description,confirmPlaceholder:b.confirmPlaceholder,confirm:b.confirm,cancel:b.cancel,params:b.params,onConfirm:b.onConfirm,onCancel:b.onCancel})}se.propTypes={accessKeyId:u.string.isRequired,time:u.string.isRequired,remark:u.string.isRequired,onDelete:u.func,onClose:u.func};se.defaultProps={onDelete:()=>{},onClose:()=>{}};function ne(t){const{accessKeyId:s,remark:l,onUpdate:r,passport:d,expireAt:n,authType:K,onClose:j}=t,{api:x}=_(),{teamDid:C}=N(),{t:p}=D(),[f,g]=k.useState(!1),b=W(),i=()=>{g(!1),j()},v=async o=>{const{accessKeyId:m,remark:S="",passport:c,expireAt:I,authType:P}=o;g(!0),await x.updateAccessKey({input:{teamDid:C,accessKeyId:m,remark:S.trim(),passport:c,expireAt:I?new Date(I).getTime():null,authType:P}}),r(),i()},h={title:`${p("common.update")} ${p("accessKey")}`,description:(o,m,S)=>e.jsxs(Z,{gap:3,children:[e.jsx(O,{label:p("setting.accessKey.accessKeyId"),autoComplete:"off",variant:"outlined",name:"accessKeyId",fullWidth:!0,autoFocus:!0,margin:"dense",value:o.accessKeyId,disabled:!0}),e.jsx(O,{label:p("common.remark"),autoComplete:"off",variant:"outlined",name:"remark",fullWidth:!0,autoFocus:!0,value:o.remark,onChange:c=>{m({...o,remark:c.target.value,__disableConfirm:!c.target.value.trim()}),c.target.value.trim()?S(""):S(p("setting.accessKey.remarkInvalid"))}}),e.jsxs(V,{style:{width:"100%"},variant:"outlined",children:[e.jsx(G,{children:p("setting.accessKey.passport")}),e.jsx(X,{"data-cy":"update-access-key-select-passport",value:o.passport,onChange:c=>{const I=c.target.value;S(null),m({...o,passport:I,__disableConfirm:!o.remark||!I})},fullWidth:!0,label:p("setting.accessKey.passport"),disabled:f,children:b.map(c=>e.jsx(Q,{value:c.name,"data-cy":`update-access-key-passport-option-${c.name}`,children:e.jsxs(y,{children:[e.jsx("span",{children:c.title||c.name}),e.jsx(y,{maxWidth:440,fontSize:12,color:"#999",whiteSpace:"normal",textAlign:"justify",children:c.description})]})},c.name))})]}),e.jsx(Y,{disabled:!0,value:o.authType,onChange:c=>{m({...o,authType:c.target.value})}}),e.jsx(fe,{placeholder:p("setting.accessKey.expireTime"),value:o.expireAt,onChange:c=>{m({...o,expireAt:c,__disableConfirm:!o.passport||!o.remark||!c})}})]}),confirm:p("common.confirm"),cancel:p("common.cancel"),color:"primary",params:{accessKeyId:s,remark:l,passport:d,expireAt:n,authType:K},onConfirm:v,onCancel:i};return e.jsx(he,{title:h.title,description:h.description,confirm:h.confirm,color:h.color,cancel:h.cancel,params:h.params,onConfirm:h.onConfirm,onCancel:h.onCancel})}ne.propTypes={accessKeyId:u.string.isRequired,remark:u.string,passport:u.string,expireAt:u.string,authType:u.string,onUpdate:u.func,onClose:u.func};ne.defaultProps={onUpdate:()=>{},remark:"",passport:"",expireAt:"",authType:"signature",onClose:()=>{}};function oe({accessKey:t,onCancel:s}){const{t:l}=D();return e.jsx(pe,{title:l("accessKey"),onClose:s,open:!0,PaperProps:{style:{maxWidth:800}},fullWidth:!0,children:e.jsx(Xe,{children:e.jsx(ge,{accessKey:t})})})}oe.propTypes={accessKey:u.object.isRequired,onCancel:u.func.isRequired};oe.defaultProps={};const Xe=E(y)`
|
|
31
31
|
margin-top: -16px;
|
|
32
32
|
|
|
33
33
|
.tabs {
|
|
34
34
|
margin-left: 0;
|
|
35
35
|
margin-right: 0;
|
|
36
36
|
}
|
|
37
|
-
`;function ge({accessKey:t}){var C,p;const{t:s,locale:l}=D(),{blocklet:
|
|
37
|
+
`;function ge({accessKey:t}){var C,p;const{t:s,locale:l}=D(),{blocklet:r}=$e(),d=W(),n=((r==null?void 0:r.children)||[]).find(f=>{var g;return((g=f==null?void 0:f.meta)==null?void 0:g.did)===t.componentDid}),K=d.find(f=>f.name===t.passport),j=K?K.title:t.passport,x=[{title:s("common.baseInfo"),items:[{label:s("setting.accessKey.accessKeyId"),content:e.jsx(Fe,{did:t.accessKeyId,showQrcode:!0})},...t.authType==="simple"?[{label:s("setting.accessKey.accessKeySecret"),content:e.jsx(H,{children:`blocklet-${ce.toBase58(t.accessKeyPublic)}`})}]:[],{label:s("common.role"),content:e.jsx(y,{children:ye(j,t.passport)})},{label:s("common.createdVia"),content:t.createdVia},{label:s("common.createdBy"),content:t.createdBy?e.jsx(me,{showDid:!0,did:t.createdBy,cardType:ue.Detailed,infoType:xe.Minimal,sx:{border:0,padding:0}}):"-"}]},{title:s("common.timeInfo"),items:[{label:s("common.createdAt"),content:t.createdAt?e.jsx(R,{value:t.createdAt,type:"all",locale:l}):"-"},{label:s("common.lastUsedAt"),content:t.lastUsedAt?e.jsx(R,{value:t.lastUsedAt,type:"all",locale:l}):"-"},{label:s("common.expiredAt"),content:t.expireAt?e.jsx(J,{value:t.expireAt}):s("common.neverExpired")}]},{title:s("common.otherInfo"),items:[{label:s("setting.accessKey.authType"),content:t.authType},{label:s("common.remark"),content:t.remark},...t.authType!=="signature"?[{label:s("setting.accessKey.resourceType"),content:t.resourceType||"-"},{label:s("setting.accessKey.resourceId"),content:t.resourceId||"-"}]:[],...n?[{label:s("setting.accessKey.component"),content:e.jsxs(y,{width:{xs:250,sm:400},display:"flex",alignItems:"center",children:[e.jsx(Me,{blocklet:n,ancestors:[r]}),e.jsx(y,{ml:"16px",sx:{minWidth:0},children:e.jsxs(y,{className:"component-header",children:[e.jsx(y,{className:"component-name",children:Be.getDisplayName(n,!0)}),e.jsx(y,{className:"component-version",children:(C=n==null?void 0:n.meta)==null?void 0:C.version})]})})]},n)}]:[],t.authType!=="signature"?{label:s("setting.accessKey.usage"),content:e.jsx(M,{code:`curl -H "Authorization: Bearer blocklet-${ce.toBase58(t.accessKeyPublic)}" "${(p=window.blocklet)==null?void 0:p.appUrl}${L.WELLKNOWN_SERVICE_PATH_PREFIX}/api/did/session"`,language:"javascript"})}:null].filter(Boolean)}];return e.jsx(Qe,{gap:3,children:e.jsx(y,{className:"info-area",children:x.map(f=>e.jsxs(y,{mb:3,children:[e.jsx(B,{variant:"h6",sx:{mb:1.5},children:f.title}),e.jsx(y,{className:"info-grid",children:f.items.map(g=>e.jsxs(y,{className:"info-item",children:[e.jsx(y,{className:"info-label",children:e.jsx(B,{variant:"subtitle2",color:"textSecondary",children:g.label})}),e.jsx(y,{sx:{flex:1,minWidth:0},children:g.content})]},g.label))})]},f.title))})})}ge.propTypes={accessKey:u.object.isRequired};const Qe=E(Z)`
|
|
38
38
|
.info-card {
|
|
39
39
|
margin-bottom: 24px;
|
|
40
40
|
overflow: hidden;
|
|
@@ -107,4 +107,4 @@ const result = await client.getBlocklet(
|
|
|
107
107
|
margin: 0;
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
`;function _t(){var ie,
|
|
110
|
+
`;function _t(){var ie,re;const{t,locale:s}=D(),{api:l,inService:r}=_(),{teamDid:d}=N(),[n,K]=k.useState({}),[j,x]=k.useState(null),[C,p]=k.useState(null),[f,g]=k.useState(null),b=He(),i=W(),v=k.useRef(null),h=`access-keys-${d}`,o=Te(h),[m,S]=k.useState({searchText:o.searchText||"",pageSize:o.rowsPerPage||10,page:1}),c=Ve(async()=>await l.getAccessKeys({input:{teamDid:d,paging:{page:m.page,pageSize:m.pageSize}}}),[m.page,m.pageSize]),{loading:I,error:P}=c,$=k.useMemo(()=>{var a;return((a=c.value)==null?void 0:a.list)||[]},[(ie=c.value)==null?void 0:ie.list]),be=k.useMemo(()=>[{label:t("common.name"),name:"remark",options:{customBodyRender:(a,{rowIndex:A})=>{const w=$[A];return e.jsx(y,{display:"flex",alignItems:"center",gap:2,children:e.jsx(B,{children:w.remark||"N/A"})})}}},{label:"Access Key ID",name:"accessKeyId",options:{customBodyRender:a=>e.jsx(ve,{showDidLogo:!1,children:a})}},{label:t("common.role"),name:"passport",options:{customBodyRender:a=>{const A=i.find(T=>T.name===a),w=A?A.title:a;return e.jsx(y,{children:ye(w,a)})}}},{label:t("common.createdVia"),name:"createdVia",options:{customBodyRender:a=>e.jsx(B,{children:a})}},{label:t("setting.accessKey.authType"),name:"authType",options:{customBodyRender:a=>e.jsx(B,{children:t(`setting.accessKey.${a}`)})}},{label:t("common.createdAt"),name:"createdAt",options:{customBodyRender:a=>e.jsx(le,{title:F(a,s),children:a?e.jsx(R,{value:a,locale:s}):"-"})}},{label:t("common.lastUsedAt"),name:"lastUsedAt",options:{customBodyRender:a=>e.jsx(le,{title:F(a,s),children:a?e.jsx(R,{value:a,locale:s}):"-"})}},{label:t("common.expiredAt"),name:"expireAt",options:{customBodyRender:a=>a?e.jsx(J,{value:a}):t("common.neverExpired")}},{label:t("common.createdBy"),name:"createdBy",width:100,options:{customBodyRender:a=>a?e.jsx(me,{showDid:!0,did:a,cardType:ue.Detailed,infoType:xe.Minimal,sx:{border:0,padding:0}}):"-"}},{label:t("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRender:(a,{rowIndex:A})=>{const w=$[A];return e.jsx(Oe,{"data-cy":"access-key-actions",actions:[{icon:e.jsx(De,{}),text:t("common.edit"),onClick:T=>{T.stopPropagation(),g(w)}},{icon:e.jsx(Ae,{}),text:t("common.delete"),onClick:T=>{T.stopPropagation(),p(w)}}]})}}}],[$,s,t,i,p,g]),je=({page:a,rowsPerPage:A,searchText:w})=>{m.pageSize!==A?S(T=>({...T,searchText:"",pageSize:A,page:1})):m.page!==a+1?S(T=>({...T,searchText:"",page:a+1})):m.searchText!==w&&S(T=>({...T,searchText:w,page:1}))},ae=m.searchText?$.filter(a=>a.accessKeyId.toLowerCase().includes(m.searchText.toLowerCase())||(a.remark||"").toLowerCase().includes(m.searchText.toLowerCase())):$;return P?e.jsx(Pe,{severity:"error",children:Ie(P)}):e.jsxs(y,{ref:v,sx:{".custom-toobar-btns":{gap:"8px"},".custom-toobar-title .custom-toobar-title-inner>span":{display:"flex",alignItems:"center","white-space":"inherit",height:"100%"}},children:[b?e.jsx(de,{title:t("setting.accessKey.listTitle"),tooltipTitle:t("setting.accessKey.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${s}/access-key`}):null,e.jsx(we,{durable:h,durableKeys:["page","rowsPerPage"],data:ae,columns:be,options:{sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,page:m.page-1,rowsPerPage:m.pageSize,count:((re=c.value)==null?void 0:re.count)||0,searchDebounceTime:600,onRowClick(a,{dataIndex:A},w){var T;if((T=v.current)!=null&&T.contains(w.target)){const Ce=ae[A];x(Ce)}}},loading:I,onChange:je,title:b?null:e.jsx(de,{title:t("setting.accessKey.listTitle"),tooltipTitle:t("setting.accessKey.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${s}/access-key`}),customButtons:[e.jsx(ze,{permission:r?"":"mutate_accessKey",children:e.jsx(ee,{onCreate:a=>{const{accessKeyId:A,accessKeySecret:w,authType:T}=a;K({show:!0,accessKeyId:A,accessKeySecret:w,authType:T})}})})],emptyNode:e.jsx(Se,{children:t("oauth.client.empty")})}),n.show&&e.jsx(te,{hideSecret:n.authType==="signature",onConfirm:()=>{c.retry(),K({show:!1})},...n}),j&&e.jsx(oe,{onCancel:()=>x(null),accessKey:j}),C&&e.jsx(se,{accessKeyId:C.accessKeyId,time:C.lastUsedAt,remark:C.remark||"N/A",onDelete:c.retry,onClose:()=>p(null)}),f&&e.jsx(ne,{...f,onUpdate:c.retry,onClose:()=>g(null)})]})}export{_t as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as u}from"./vendor-react-DEoibe3W.js";import{H as o,j as e,aa as b,
|
|
1
|
+
import{r as u}from"./vendor-react-DEoibe3W.js";import{H as o,j as e,aa as b,b6 as A,O as K,c0 as B,I as O,ab as M,ah as W}from"./vendor-mui-core-Bq8gXTan.js";import{bb as X,aV as $,d as H}from"./vendor-ux-did-connect-DVX9lQ8a.js";import{d as G}from"./Done-C9LPqADS.js";import{A as U,a as Y,d as J,b as Q}from"./collapse-9taxUXec.js";import{C as Z}from"./Google-Buu8u6PW.js";import{ad as v,f as ee}from"./index-CMYalRl2.js";import{R as ne,F as te,L as re}from"./logo-uploader-Dzebv-rF.js";const S={description:o.string,editing:o.bool,onChange:o.func,required:o.bool,value:o.any,componentProps:o.object,render:o.func,renderFormItem:o.func};function T({editing:n,value:s,onChange:i}){const[a,d]=u.useState(!1),f=u.useRef(),m=u.useRef(s);u.useEffect(()=>{let l=null;return n&&(l=setTimeout(()=>{d(!0)},50)),()=>{clearTimeout(l)}},[n]);const x=l=>{m.current=l,i(l)},j=()=>{d(!1),i(m.current)},y=e.jsx(b,{className:"form-item-input slot",px:1,children:e.jsxs(b,{display:"flex",alignItems:"center",children:[s,s!=="auto"&&e.jsx("div",{style:{marginLeft:4,backgroundColor:s,width:"1em",height:"1em",borderRadius:"0.2em"}})]})}),p=e.jsxs(b,{display:"flex",flexGrow:1,alignItems:"center",height:"40px",onKeyDown:j,children:[e.jsx(b,{display:"flex",alignItems:"center",onClick:()=>d(!0),children:e.jsx("div",{ref:f,style:{flexShrink:0,marginLeft:"8px",backgroundColor:s,width:"32px",height:"32px",boxSizing:"border-box",borderRadius:"8px",border:"1px solid #eee",cursor:s==="auto"?"default":"pointer"}})}),e.jsx(A,{open:a,anchorEl:f.current,onClose:()=>d(!1),anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:e.jsx(Z,{color:s,onChange:l=>x(l.hex)})})]});return n?p:y}T.propTypes=S;function _({editing:n,description:s,value:i,onChange:a,componentProps:d,...f}){const{placeholder:m}=d,x=u.useRef(i),{t:j}=u.useContext(X),y=l=>{l.key==="Enter"&&a(x.current,"confirm")},p=l=>{x.current=l,a(l)};return n?e.jsx(K,{style:{flex:1},fullWidth:!0,value:i,onChange:l=>{l.persist(),p(l.target.value)},autoFocus:!0,size:"small",variant:"outlined",placeholder:s||m,onKeyDown:y,...f}):e.jsx(b,{px:1,className:"form-item-input slot",children:i||e.jsx("span",{className:"placeholder",children:j("common.requiredInputPlaceholder",{name:s||m})})})}_.propTypes=S;_.defaultProps={componentProps:{}};function D({editing:n,value:s,onChange:i,componentProps:a,...d}){const{blocklet:f}=a,m=s==="auto"?$.getPassportColorFromDid(f.appDid):s;return e.jsxs(b,{display:"flex",alignItems:"center",children:[e.jsx("div",{style:{width:96,marginRight:12},dangerouslySetInnerHTML:{__html:v({title:"Owner",issuer:ee.getDisplayName(f),issuerDid:f.appDid,ownerName:"Your Name",ownerDid:f.appDid,preferredColor:s||"auto"})}}),e.jsx(T,{...d,editing:n,value:n?m:s,onChange:i,componentProps:a})]})}D.propTypes={...S,componentProps:o.shape({blocklet:o.object.isRequired}).isRequired};D.defaultProps={};const oe=B`
|
|
2
2
|
0%, 100% {
|
|
3
3
|
transform: scale(1) translateX(0);
|
|
4
4
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as se,a3 as _,cc as Me,cd as Ve,I as K,ca as $e,cb as Ne,ai as He,ah as Je,ce as Ke,bd as Ce,k as oe,r as Ae,bb as G,cf as xe,ar as ge,B as z,b_ as Ge,ab as Ze,cg as Xe,ac as Ye,a8 as Qe,a5 as et,ax as De}from"./vendor-ux-did-connect-CX7qG3_M.js";import{u as p,a as ae,b as te,c as tt}from"./vendor-hooks-BCm626KH.js";import{r as P}from"./vendor-react-DEoibe3W.js";import{j as e,aa as u,bt as U,bp as E,O,y as $,H,T as ne,I as ie,X as le,ah as Oe,al as V,cG as nt,a9 as Be,e as je,ab as fe,a7 as ze,ad as st,ap as at}from"./vendor-mui-core-wlbruq2I.js";import{Z as rt,v as qe,B as ot,c as it}from"./vendor-arcblock-B4hgrXYM.js";import{J as Y,a9 as lt,c as Fe,D as ct,n as X,aJ as dt,A as ut,b as mt}from"./vendor-utils-B3iZkn2R.js";import{D as J,G as N,aC as re,aD as I,aL as Re}from"./index-B18R5SlV.js";import{S as ce}from"./switch-control-CzaI2YNK.js";import{S as C}from"./section-Bb547IGJ.js";import{K as pt}from"./keyboard-arrow-down-rounded-DadBVmpO.js";import{I as ht}from"./index-BnR8uU0R.js";import{b as xt}from"./base32-CmYq1ikq.js";import{u as ft}from"./use-mobile-CXU9YBvX.js";import"./lottie-web-jYmAQWuC.js";const de={enabled:!1,domain:"",clientId:"",clientSecret:""};function gt(){var v,S,i;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(v=o==null?void 0:o.meta)==null?void 0:v.did,w=Object.assign({...de},((i=(S=o==null?void 0:o.settings)==null?void 0:S.oauth)==null?void 0:i.auth0)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(de))}),d=h("enabled"),k=p(async r=>{var L,a;try{const{blocklet:b}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({auth0:r})}}),m=Object.assign({...de},((a=(L=b==null?void 0:b.settings)==null?void 0:L.oauth)==null?void 0:a.auth0)||{});l(m),_.success(n("oauth.saveSuccess"))}catch(b){_.error(b.message||n("oauth.saveFailed"))}}),T=p(r=>r!=null&&r.trim()?!0:n("oauth.auth0.domainDescription")),x=p(r=>r!=null&&r.trim()?!0:n("oauth.auth0.clientIdDescription")),g=p(r=>r!=null&&r.trim()?!0:n("oauth.auth0.clientSecretDescription")),y=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(C,{title:n("oauth.auth0.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:r})=>e.jsx(U,{control:e.jsx(ce,{sx:{ml:1},checked:r.value,...r})})})}),e.jsx(C,{title:n("oauth.auth0.domain"),children:e.jsx(I,{name:"domain",control:f,rules:{validate:d?T:y},render:({field:r})=>{var L;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...r,size:"small",label:n("oauth.auth0.domain"),error:!!c.errors[r.name],helperText:((L=c.errors[r.name])==null?void 0:L.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.auth0.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?x:y},render:({field:r})=>{var L;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...r,size:"small",label:n("oauth.auth0.clientId"),error:!!c.errors[r.name],helperText:((L=c.errors[r.name])==null?void 0:L.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.auth0.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?g:y},render:({field:r})=>{var L;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...r,size:"small",type:"password",label:n("oauth.auth0.clientSecret"),error:!!c.errors[r.name],helperText:((L=c.errors[r.name])==null?void 0:L.message)||" ",disabled:!d})})}})}),e.jsx($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const ue={enabled:!1,clientId:"",clientSecret:""};function jt(){var y,v,S;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(y=o==null?void 0:o.meta)==null?void 0:y.did,w=Object.assign({...ue},((S=(v=o==null?void 0:o.settings)==null?void 0:v.oauth)==null?void 0:S.github)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(ue))}),d=h("enabled"),k=p(async i=>{var r,L;try{const{blocklet:a}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({github:i})}}),b=Object.assign({...ue},((L=(r=a==null?void 0:a.settings)==null?void 0:r.oauth)==null?void 0:L.github)||{});l(b),_.success(n("oauth.saveSuccess"))}catch(a){_.error(a.message||n("oauth.saveFailed"))}}),T=p(i=>i!=null&&i.trim()?!0:n("oauth.github.clientIdDescription")),x=p(i=>i!=null&&i.trim()?!0:n("oauth.github.clientSecretDescription")),g=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(C,{title:n("oauth.github.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:i})=>e.jsx(U,{control:e.jsx(ce,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(C,{title:n("oauth.github.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?T:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.github.clientId"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.github.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?x:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",type:"password",label:n("oauth.github.clientSecret"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const me={enabled:!1,clientId:"",clientSecret:""};function bt(){var y,v,S;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(y=o==null?void 0:o.meta)==null?void 0:y.did,w=Object.assign({...me},((S=(v=o==null?void 0:o.settings)==null?void 0:v.oauth)==null?void 0:S.google)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(me))}),d=h("enabled"),k=p(async i=>{var r,L;try{const{blocklet:a}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({google:i})}}),b=Object.assign({...me},((L=(r=a==null?void 0:a.settings)==null?void 0:r.oauth)==null?void 0:L.google)||{});l(b),_.success(n("oauth.saveSuccess"))}catch(a){_.error(a.message||n("oauth.saveFailed"))}}),T=p(i=>i!=null&&i.trim()?!0:n("oauth.google.clientIdDescription")),x=p(i=>i!=null&&i.trim()?!0:n("oauth.google.clientSecretDescription")),g=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(C,{title:n("oauth.google.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:i})=>e.jsx(U,{control:e.jsx(ce,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(C,{title:n("oauth.google.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?T:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.google.clientId"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.google.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?x:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",type:"password",label:n("oauth.google.clientSecret"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const pe={enabled:!1,teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function vt(){var i,r,L;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(i=o==null?void 0:o.meta)==null?void 0:i.did,w=Object.assign({...pe},((L=(r=o==null?void 0:o.settings)==null?void 0:r.oauth)==null?void 0:L.apple)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(pe))}),d=h("enabled"),k=p(async a=>{var b,m;try{const{blocklet:R}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({apple:a})}}),A=Object.assign({...pe},((m=(b=R==null?void 0:R.settings)==null?void 0:b.oauth)==null?void 0:m.apple)||{});l(A),_.success(n("oauth.saveSuccess"))}catch(R){_.error(R.message||n("oauth.saveFailed"))}}),T=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.teamIdDescription")),x=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.serviceIdDescription")),g=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.keyIdDescription")),y=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.authKeyDescription")),v=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.bundleIdDescription")),S=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(C,{title:n("oauth.apple.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:a})=>e.jsx(U,{control:e.jsx(ce,{sx:{ml:1},checked:a.value,...a})})})}),e.jsx(C,{title:n("oauth.apple.teamId"),children:e.jsx(I,{name:"teamId",control:f,rules:{validate:d?T:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.teamId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.apple.bundleId"),children:e.jsx(I,{name:"bundleId",control:f,rules:{validate:d?v:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.bundleId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.apple.serviceId"),children:e.jsx(I,{name:"serviceId",control:f,rules:{validate:d?x:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.serviceId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.apple.keyId"),children:e.jsx(I,{name:"keyId",control:f,rules:{validate:d?g:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.keyId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.apple.authKey"),children:e.jsx(I,{name:"authKey",control:f,rules:{validate:d?y:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",type:"password",label:n("oauth.apple.authKey"),multiline:!0,rows:4,error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const yt={width:24,height:24,body:'<path fill="currentColor" d="M9 20q-.825 0-1.413-.588T7 18q0-.825.588-1.413T9 16q.825 0 1.413.588T11 18q0 .825-.588 1.413T9 20Zm6 0q-.825 0-1.413-.588T13 18q0-.825.588-1.413T15 16q.825 0 1.413.588T17 18q0 .825-.588 1.413T15 20Zm-6-6q-.825 0-1.413-.588T7 12q0-.825.588-1.413T9 10q.825 0 1.413.588T11 12q0 .825-.588 1.413T9 14Zm6 0q-.825 0-1.413-.588T13 12q0-.825.588-1.413T15 10q.825 0 1.413.588T17 12q0 .825-.588 1.413T15 14ZM9 8q-.825 0-1.413-.588T7 6q0-.825.588-1.413T9 4q.825 0 1.413.588T11 6q0 .825-.588 1.413T9 8Zm6 0q-.825 0-1.413-.588T13 6q0-.825.588-1.413T15 4q.825 0 1.413.588T17 6q0 .825-.588 1.413T15 8Z"/>'};function be({title:j,id:o,children:n,index:s,onMove:w,defaultExpand:t,onEnd:f}){const[c,h]=P.useState(t),l=P.useRef(null),d=P.useRef(null),[{handlerId:k},T]=Me({accept:"dragItem",collect(S){return{handlerId:S.getHandlerId()}},hover(S,i){var M,Q;if(!l.current)return;const r=S.index,L=s;if(r===L)return;const a=(M=l.current)==null?void 0:M.getBoundingClientRect(),b=(Q=d.current)==null?void 0:Q.getBoundingClientRect(),m=(b.bottom-b.top)/2,A=i.getClientOffset().y-a.top;r<L&&A<m||r>L&&A>m||(w(r,L),S.index=L)}}),[{isDragging:x},g]=Ve({item:{index:s,type:"dragItem"},collect:S=>({isDragging:S.isDragging()}),end:f});g(d),T(l);const y=x?.5:1,v=p(S=>{S.preventDefault(),S.stopPropagation(),h(!c)});return e.jsxs(u,{ref:l,children:[e.jsxs(u,{sx:{cursor:"pointer","&:hover":{backgroundColor:"grey.100"}},ref:d,"data-handler-id":k,children:[e.jsxs(u,{sx:{py:2,px:1,opacity:y,display:"flex",alignItems:"center",gap:.5},draggable:!1,onClick:v,children:[e.jsx(u,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:"text.hint","&:hover":{color:"text.secondary"}},children:e.jsx(K,{fontSize:20,icon:yt})}),e.jsx(ne,{sx:{flex:1},children:j}),e.jsx(ie,{size:"small",sx:{pointerEvents:"auto",transform:c?"":"rotate(180deg)",transition:"transform 0.3s ease"},children:e.jsx(K,{icon:pt,style:{transform:"scale(1.5)"}})})]}),e.jsx(le,{})]}),e.jsx(u,{sx:{pl:4,py:2.5,display:c?"block":"none"},children:n})]})}be.propTypes={title:H.string.isRequired,id:H.string.isRequired,children:H.node.isRequired,index:H.number.isRequired,onMove:H.func.isRequired,onEnd:H.func.isRequired,defaultExpand:H.bool};be.defaultProps={defaultExpand:!1};const St=[{name:"github",title:"GitHub",icon:e.jsx(K,{icon:rt}),component:e.jsx(jt,{})},{name:"google",title:"Google",icon:e.jsx(K,{icon:He}),component:e.jsx(bt,{})},{name:"apple",title:"Apple",icon:e.jsx(K,{icon:Je}),component:e.jsx(vt,{})},{name:"auth0",title:"Auth0",icon:e.jsx(K,{icon:Ke}),component:e.jsx(gt,{})}],wt=["github","google","apple","auth0"];function kt(){var k,T;const{api:j}=J(),{blocklet:o}=N(),n=(k=o==null?void 0:o.meta)==null?void 0:k.did,s=((T=o==null?void 0:o.settings)==null?void 0:T.oauth)||{},w=Object.keys(s).sort((x,g)=>{var y,v,S;return((y=s[x])==null?void 0:y.order)!==void 0&&((v=s[g])==null?void 0:v.order)!==void 0?s[x].order-s[g].order:((S=s[x])==null?void 0:S.order)!==void 0?-1:1});for(const x of wt)w.includes(x)||w.push(x);const t=ae(w.reduce((x,g,y)=>Object.assign(x,{[g]:y}),{})),f=te(()=>{const x=[...St];return x.sort((g,y)=>t[g.name]-t[y.name]),x},[t.auth0,t.github,t.google]),c={};typeof window<"u"&&(c.context=window);const h=p(async x=>{const g={};Object.keys(x).forEach(y=>{g[y]={order:x[y]}}),await j.configOAuth({input:{did:n,oauth:JSON.stringify(g)}})}),l=p((x,g)=>{const y=f[x],v=f[g];t[y.name]=g,t[v.name]=x}),d=p(async()=>{await h(t)});return e.jsx(u,{sx:{".section-left":{width:"160px"}},children:e.jsx($e,{backend:Ne,...c,children:f.map((x,g)=>e.jsx(be,{index:g,id:x.name,title:x.title,icon:x.icon,onMove:l,onEnd:d,defaultExpand:x.enabled,children:x.component},x.name))})})}const Z={ttl:oe.SESSION_TTL,cacheTtl:oe.SESSION_CACHE_TTL,email:{enabled:!1,requireVerified:!1,requireUnique:!1,trustOauthProviders:!1,trustedIssuers:[],enableDomainBlackList:!1,domainBlackList:[],enableDomainWhiteList:!1,domainWhiteList:[]},phone:{enabled:!1,requireVerified:!1,requireUnique:!1,regionBlackList:[],trustedIssuers:[]}};function W(j){return e.jsx(ot,{...j,sx:{transform:"scale(0.75)"}})}function he(j,o=!1){const n=o?j.ttl*86400:j.ttl/86400;return{...j,ttl:n}}function Lt(){var a,b;const{api:j}=J(),{blocklet:o}=N(),n=(a=o==null?void 0:o.meta)==null?void 0:a.did,s=lt({},Z,((b=o==null?void 0:o.settings)==null?void 0:b.session)||{});Fe(s.ttl)&&(s.ttl=Z.ttl),Fe(s.cacheTtl)&&(s.cacheTtl=Z.cacheTtl),s.phone||(s.phone=Z.phone),s.email||(s.email=Z.email);const{handleSubmit:w,control:t,formState:f,reset:c,watch:h}=re({defaultValues:Y(he(s),["ttl","cacheTtl","email","phone"])}),{t:l}=se(),d=h("email.enabled"),k=h("phone.enabled"),T=h("email.enableDomainBlackList"),x=h("email.enableDomainWhiteList"),{fields:g,append:y,remove:v}=Re({control:t,name:"email.domainBlackList"}),{fields:S,append:i,remove:r}=Re({control:t,name:"email.domainWhiteList"}),L=p(async m=>{var R;try{const{blocklet:A}=await j.updateAppSessionConfig({input:{did:n,config:ct(he(m,!0),["phone"])}}),M=Object.assign({},Z,Y(((R=A==null?void 0:A.settings)==null?void 0:R.session)||{},["ttl","cacheTtl","email","phone"]));c(he(M)),_.success(l("common.configSuccess"))}catch(A){_.error(A.message)}});return e.jsx(Tt,{onSubmit:w(L),children:e.jsxs(V,{direction:"column",gap:6,children:[e.jsxs(u,{children:[e.jsxs(u,{children:[e.jsx(ne,{variant:"h6",fontWeight:600,children:l("blocklet.config.session.profile")}),e.jsx(u,{component:le,my:3})]}),e.jsxs(V,{gap:2,children:[e.jsx(C,{title:l("blocklet.config.session.fullNameEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(W,{disabled:!0,checked:!0})})}),e.jsx(C,{title:l("blocklet.config.session.avatarEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(W,{disabled:!0,checked:!0})})}),e.jsx(C,{title:l("blocklet.config.session.emailEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enabled",control:t,render:({field:m})=>e.jsx(W,{...m,checked:m.value})})})}),d&&e.jsxs(V,{direction:"column",ml:2,children:[e.jsx(C,{title:l("blocklet.config.session.emailRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.requireVerified",control:t,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(C,{title:l("blocklet.config.session.emailRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.requireUnique",control:t,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(C,{title:l("blocklet.config.session.emailTrustOauthProviders"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.trustOauthProviders",control:t,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(C,{title:l("blocklet.config.session.enableDomainBlackList"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enableDomainBlackList",control:t,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),T&&e.jsxs(u,{children:[g.map((m,R)=>e.jsxs(V,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(I,{name:`email.domainBlackList.${R}`,control:t,render:A=>e.jsx(O,{...A.field,size:"small",fullWidth:!0})}),e.jsx(ie,{onClick:()=>v(R),children:e.jsx(Ce,{})})]},m.id)),e.jsx($,{startIcon:e.jsx(qe,{}),onClick:()=>y(""),children:l("blocklet.config.session.addDomain")})]}),e.jsx(C,{title:l("blocklet.config.session.enableDomainWhiteList"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enableDomainWhiteList",control:t,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),x&&e.jsxs(u,{children:[S.map((m,R)=>e.jsxs(V,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(I,{name:`email.domainWhiteList.${R}`,control:t,render:A=>e.jsx(O,{...A.field,size:"small",fullWidth:!0})}),e.jsx(ie,{onClick:()=>r(R),children:e.jsx(Ce,{})})]},m.id)),e.jsx($,{startIcon:e.jsx(qe,{}),onClick:()=>i(""),children:l("blocklet.config.session.addDomain")})]})]}),e.jsxs(u,{sx:{display:"none"},children:[e.jsx(C,{title:l("blocklet.config.session.phoneEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.enabled",control:t,disabled:!0,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),k&&e.jsxs(V,{direction:"column",ml:2,mt:1,children:[e.jsx(C,{title:l("blocklet.config.session.phoneRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.requireVerified",control:t,render:({field:m})=>e.jsx(U,{control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(C,{title:l("blocklet.config.session.phoneRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.requireUnique",control:t,render:({field:m})=>e.jsx(U,{control:e.jsx(W,{...m,checked:m.value})})})})})]})]})]})]}),e.jsxs(u,{children:[e.jsx(ne,{variant:"h6",fontWeight:600,children:l("blocklet.config.session.period")}),e.jsx(u,{component:le,my:3}),e.jsx(V,{direction:"column",spacing:2,children:e.jsx(I,{name:"ttl",control:t,rules:{min:1,max:30},render:({field:m})=>e.jsx(E,{fullWidth:!0,sx:{mb:2},children:e.jsx(C,{title:l("blocklet.config.session.ttl",{day:m.value}),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{width:"100%",maxWidth:500,px:1.5},children:e.jsx(nt,{...m,defaultValue:7,step:1,marks:[{value:1,label:l("blocklet.config.session.day",{day:1})},{value:7,label:l("blocklet.config.session.days",{day:7})},{value:14,label:l("blocklet.config.session.days",{day:14})},{value:21,label:l("blocklet.config.session.days",{day:21})},{value:30,label:l("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto"})})})})})})]}),e.jsx(u,{children:e.jsx($,{type:"submit",variant:"contained",disabled:!f.isDirty,children:l("oauth.save")})})]})})}const Tt=Oe.form`
|
|
1
|
+
import{a as se,a3 as U,cb as Me,cc as Ve,I as K,c9 as $e,ca as Ne,ai as He,ah as Je,cd as Ke,bd as Ce,k as oe,r as Ae,bb as G,ce as xe,ar as ge,B as z,bZ as Ge,ab as Ze,cf as Xe,ac as Ye,a8 as Qe,a5 as et,ax as De}from"./vendor-ux-did-connect-DVX9lQ8a.js";import{u as p,a as ae,b as te,c as tt}from"./vendor-hooks-BFlOfe0M.js";import{r as P}from"./vendor-react-DEoibe3W.js";import{j as e,aa as u,bs as _,bo as E,O,y as $,H,T as ne,I as ie,X as le,ah as Oe,al as V,cG as nt,a9 as Be,e as je,ab as fe,a7 as ze,ad as st,ap as at}from"./vendor-mui-core-Bq8gXTan.js";import{Z as rt,v as qe,B as ot,c as it}from"./vendor-arcblock-DiSm3oUX.js";import{J as Y,a9 as lt,c as Fe,D as ct,n as X,aJ as dt,A as ut,b as mt}from"./vendor-utils-BotmZdBm.js";import{D as J,G as N,aC as re,aD as I,aL as Re}from"./index-CMYalRl2.js";import{S as ce}from"./switch-control-BYqb8MZf.js";import{S as C}from"./section-BDMQAX_r.js";import{K as pt}from"./keyboard-arrow-down-rounded-DadBVmpO.js";import{I as ht}from"./index-BzZuK-66.js";import{b as xt}from"./base32-DEjena1X.js";import{u as ft}from"./use-mobile-DwzRjjku.js";import"./lottie-web-jYmAQWuC.js";const de={enabled:!1,domain:"",clientId:"",clientSecret:""};function gt(){var v,S,i;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(v=o==null?void 0:o.meta)==null?void 0:v.did,w=Object.assign({...de},((i=(S=o==null?void 0:o.settings)==null?void 0:S.oauth)==null?void 0:i.auth0)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(de))}),d=h("enabled"),k=p(async r=>{var L,a;try{const{blocklet:b}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({auth0:r})}}),m=Object.assign({...de},((a=(L=b==null?void 0:b.settings)==null?void 0:L.oauth)==null?void 0:a.auth0)||{});l(m),U.success(n("oauth.saveSuccess"))}catch(b){U.error(b.message||n("oauth.saveFailed"))}}),T=p(r=>r!=null&&r.trim()?!0:n("oauth.auth0.domainDescription")),x=p(r=>r!=null&&r.trim()?!0:n("oauth.auth0.clientIdDescription")),g=p(r=>r!=null&&r.trim()?!0:n("oauth.auth0.clientSecretDescription")),y=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(C,{title:n("oauth.auth0.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:r})=>e.jsx(_,{control:e.jsx(ce,{sx:{ml:1},checked:r.value,...r})})})}),e.jsx(C,{title:n("oauth.auth0.domain"),children:e.jsx(I,{name:"domain",control:f,rules:{validate:d?T:y},render:({field:r})=>{var L;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...r,size:"small",label:n("oauth.auth0.domain"),error:!!c.errors[r.name],helperText:((L=c.errors[r.name])==null?void 0:L.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.auth0.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?x:y},render:({field:r})=>{var L;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...r,size:"small",label:n("oauth.auth0.clientId"),error:!!c.errors[r.name],helperText:((L=c.errors[r.name])==null?void 0:L.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.auth0.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?g:y},render:({field:r})=>{var L;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...r,size:"small",type:"password",label:n("oauth.auth0.clientSecret"),error:!!c.errors[r.name],helperText:((L=c.errors[r.name])==null?void 0:L.message)||" ",disabled:!d})})}})}),e.jsx($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const ue={enabled:!1,clientId:"",clientSecret:""};function jt(){var y,v,S;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(y=o==null?void 0:o.meta)==null?void 0:y.did,w=Object.assign({...ue},((S=(v=o==null?void 0:o.settings)==null?void 0:v.oauth)==null?void 0:S.github)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(ue))}),d=h("enabled"),k=p(async i=>{var r,L;try{const{blocklet:a}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({github:i})}}),b=Object.assign({...ue},((L=(r=a==null?void 0:a.settings)==null?void 0:r.oauth)==null?void 0:L.github)||{});l(b),U.success(n("oauth.saveSuccess"))}catch(a){U.error(a.message||n("oauth.saveFailed"))}}),T=p(i=>i!=null&&i.trim()?!0:n("oauth.github.clientIdDescription")),x=p(i=>i!=null&&i.trim()?!0:n("oauth.github.clientSecretDescription")),g=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(C,{title:n("oauth.github.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:i})=>e.jsx(_,{control:e.jsx(ce,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(C,{title:n("oauth.github.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?T:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.github.clientId"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.github.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?x:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",type:"password",label:n("oauth.github.clientSecret"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const me={enabled:!1,clientId:"",clientSecret:""};function bt(){var y,v,S;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(y=o==null?void 0:o.meta)==null?void 0:y.did,w=Object.assign({...me},((S=(v=o==null?void 0:o.settings)==null?void 0:v.oauth)==null?void 0:S.google)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(me))}),d=h("enabled"),k=p(async i=>{var r,L;try{const{blocklet:a}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({google:i})}}),b=Object.assign({...me},((L=(r=a==null?void 0:a.settings)==null?void 0:r.oauth)==null?void 0:L.google)||{});l(b),U.success(n("oauth.saveSuccess"))}catch(a){U.error(a.message||n("oauth.saveFailed"))}}),T=p(i=>i!=null&&i.trim()?!0:n("oauth.google.clientIdDescription")),x=p(i=>i!=null&&i.trim()?!0:n("oauth.google.clientSecretDescription")),g=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(C,{title:n("oauth.google.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:i})=>e.jsx(_,{control:e.jsx(ce,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(C,{title:n("oauth.google.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?T:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.google.clientId"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.google.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?x:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",type:"password",label:n("oauth.google.clientSecret"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const pe={enabled:!1,teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function vt(){var i,r,L;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(i=o==null?void 0:o.meta)==null?void 0:i.did,w=Object.assign({...pe},((L=(r=o==null?void 0:o.settings)==null?void 0:r.oauth)==null?void 0:L.apple)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(pe))}),d=h("enabled"),k=p(async a=>{var b,m;try{const{blocklet:R}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({apple:a})}}),A=Object.assign({...pe},((m=(b=R==null?void 0:R.settings)==null?void 0:b.oauth)==null?void 0:m.apple)||{});l(A),U.success(n("oauth.saveSuccess"))}catch(R){U.error(R.message||n("oauth.saveFailed"))}}),T=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.teamIdDescription")),x=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.serviceIdDescription")),g=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.keyIdDescription")),y=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.authKeyDescription")),v=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.bundleIdDescription")),S=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(C,{title:n("oauth.apple.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:a})=>e.jsx(_,{control:e.jsx(ce,{sx:{ml:1},checked:a.value,...a})})})}),e.jsx(C,{title:n("oauth.apple.teamId"),children:e.jsx(I,{name:"teamId",control:f,rules:{validate:d?T:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.teamId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.apple.bundleId"),children:e.jsx(I,{name:"bundleId",control:f,rules:{validate:d?v:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.bundleId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.apple.serviceId"),children:e.jsx(I,{name:"serviceId",control:f,rules:{validate:d?x:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.serviceId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.apple.keyId"),children:e.jsx(I,{name:"keyId",control:f,rules:{validate:d?g:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.keyId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.apple.authKey"),children:e.jsx(I,{name:"authKey",control:f,rules:{validate:d?y:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",type:"password",label:n("oauth.apple.authKey"),multiline:!0,rows:4,error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const yt={width:24,height:24,body:'<path fill="currentColor" d="M9 20q-.825 0-1.413-.588T7 18q0-.825.588-1.413T9 16q.825 0 1.413.588T11 18q0 .825-.588 1.413T9 20Zm6 0q-.825 0-1.413-.588T13 18q0-.825.588-1.413T15 16q.825 0 1.413.588T17 18q0 .825-.588 1.413T15 20Zm-6-6q-.825 0-1.413-.588T7 12q0-.825.588-1.413T9 10q.825 0 1.413.588T11 12q0 .825-.588 1.413T9 14Zm6 0q-.825 0-1.413-.588T13 12q0-.825.588-1.413T15 10q.825 0 1.413.588T17 12q0 .825-.588 1.413T15 14ZM9 8q-.825 0-1.413-.588T7 6q0-.825.588-1.413T9 4q.825 0 1.413.588T11 6q0 .825-.588 1.413T9 8Zm6 0q-.825 0-1.413-.588T13 6q0-.825.588-1.413T15 4q.825 0 1.413.588T17 6q0 .825-.588 1.413T15 8Z"/>'};function be({title:j,id:o,children:n,index:s,onMove:w,defaultExpand:t,onEnd:f}){const[c,h]=P.useState(t),l=P.useRef(null),d=P.useRef(null),[{handlerId:k},T]=Me({accept:"dragItem",collect(S){return{handlerId:S.getHandlerId()}},hover(S,i){var M,Q;if(!l.current)return;const r=S.index,L=s;if(r===L)return;const a=(M=l.current)==null?void 0:M.getBoundingClientRect(),b=(Q=d.current)==null?void 0:Q.getBoundingClientRect(),m=(b.bottom-b.top)/2,A=i.getClientOffset().y-a.top;r<L&&A<m||r>L&&A>m||(w(r,L),S.index=L)}}),[{isDragging:x},g]=Ve({item:{index:s,type:"dragItem"},collect:S=>({isDragging:S.isDragging()}),end:f});g(d),T(l);const y=x?.5:1,v=p(S=>{S.preventDefault(),S.stopPropagation(),h(!c)});return e.jsxs(u,{ref:l,children:[e.jsxs(u,{sx:{cursor:"pointer","&:hover":{backgroundColor:"grey.100"}},ref:d,"data-handler-id":k,children:[e.jsxs(u,{sx:{py:2,px:1,opacity:y,display:"flex",alignItems:"center",gap:.5},draggable:!1,onClick:v,children:[e.jsx(u,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:"text.hint","&:hover":{color:"text.secondary"}},children:e.jsx(K,{fontSize:20,icon:yt})}),e.jsx(ne,{sx:{flex:1},children:j}),e.jsx(ie,{size:"small",sx:{pointerEvents:"auto",transform:c?"":"rotate(180deg)",transition:"transform 0.3s ease"},children:e.jsx(K,{icon:pt,style:{transform:"scale(1.5)"}})})]}),e.jsx(le,{})]}),e.jsx(u,{sx:{pl:4,py:2.5,display:c?"block":"none"},children:n})]})}be.propTypes={title:H.string.isRequired,id:H.string.isRequired,children:H.node.isRequired,index:H.number.isRequired,onMove:H.func.isRequired,onEnd:H.func.isRequired,defaultExpand:H.bool};be.defaultProps={defaultExpand:!1};const St=[{name:"github",title:"GitHub",icon:e.jsx(K,{icon:rt}),component:e.jsx(jt,{})},{name:"google",title:"Google",icon:e.jsx(K,{icon:He}),component:e.jsx(bt,{})},{name:"apple",title:"Apple",icon:e.jsx(K,{icon:Je}),component:e.jsx(vt,{})},{name:"auth0",title:"Auth0",icon:e.jsx(K,{icon:Ke}),component:e.jsx(gt,{})}],wt=["github","google","apple","auth0"];function kt(){var k,T;const{api:j}=J(),{blocklet:o}=N(),n=(k=o==null?void 0:o.meta)==null?void 0:k.did,s=((T=o==null?void 0:o.settings)==null?void 0:T.oauth)||{},w=Object.keys(s).sort((x,g)=>{var y,v,S;return((y=s[x])==null?void 0:y.order)!==void 0&&((v=s[g])==null?void 0:v.order)!==void 0?s[x].order-s[g].order:((S=s[x])==null?void 0:S.order)!==void 0?-1:1});for(const x of wt)w.includes(x)||w.push(x);const t=ae(w.reduce((x,g,y)=>Object.assign(x,{[g]:y}),{})),f=te(()=>{const x=[...St];return x.sort((g,y)=>t[g.name]-t[y.name]),x},[t.auth0,t.github,t.google]),c={};typeof window<"u"&&(c.context=window);const h=p(async x=>{const g={};Object.keys(x).forEach(y=>{g[y]={order:x[y]}}),await j.configOAuth({input:{did:n,oauth:JSON.stringify(g)}})}),l=p((x,g)=>{const y=f[x],v=f[g];t[y.name]=g,t[v.name]=x}),d=p(async()=>{await h(t)});return e.jsx(u,{sx:{".section-left":{width:"160px"}},children:e.jsx($e,{backend:Ne,...c,children:f.map((x,g)=>e.jsx(be,{index:g,id:x.name,title:x.title,icon:x.icon,onMove:l,onEnd:d,defaultExpand:x.enabled,children:x.component},x.name))})})}const Z={ttl:oe.SESSION_TTL,cacheTtl:oe.SESSION_CACHE_TTL,email:{enabled:!1,requireVerified:!1,requireUnique:!1,trustOauthProviders:!1,trustedIssuers:[],enableDomainBlackList:!1,domainBlackList:[],enableDomainWhiteList:!1,domainWhiteList:[]},phone:{enabled:!1,requireVerified:!1,requireUnique:!1,regionBlackList:[],trustedIssuers:[]}};function W(j){return e.jsx(ot,{...j,sx:{transform:"scale(0.75)"}})}function he(j,o=!1){const n=o?j.ttl*86400:j.ttl/86400;return{...j,ttl:n}}function Lt(){var a,b;const{api:j}=J(),{blocklet:o}=N(),n=(a=o==null?void 0:o.meta)==null?void 0:a.did,s=lt({},Z,((b=o==null?void 0:o.settings)==null?void 0:b.session)||{});Fe(s.ttl)&&(s.ttl=Z.ttl),Fe(s.cacheTtl)&&(s.cacheTtl=Z.cacheTtl),s.phone||(s.phone=Z.phone),s.email||(s.email=Z.email);const{handleSubmit:w,control:t,formState:f,reset:c,watch:h}=re({defaultValues:Y(he(s),["ttl","cacheTtl","email","phone"])}),{t:l}=se(),d=h("email.enabled"),k=h("phone.enabled"),T=h("email.enableDomainBlackList"),x=h("email.enableDomainWhiteList"),{fields:g,append:y,remove:v}=Re({control:t,name:"email.domainBlackList"}),{fields:S,append:i,remove:r}=Re({control:t,name:"email.domainWhiteList"}),L=p(async m=>{var R;try{const{blocklet:A}=await j.updateAppSessionConfig({input:{did:n,config:ct(he(m,!0),["phone"])}}),M=Object.assign({},Z,Y(((R=A==null?void 0:A.settings)==null?void 0:R.session)||{},["ttl","cacheTtl","email","phone"]));c(he(M)),U.success(l("common.configSuccess"))}catch(A){U.error(A.message)}});return e.jsx(Tt,{onSubmit:w(L),children:e.jsxs(V,{direction:"column",gap:6,children:[e.jsxs(u,{children:[e.jsxs(u,{children:[e.jsx(ne,{variant:"h6",fontWeight:600,children:l("blocklet.config.session.profile")}),e.jsx(u,{component:le,my:3})]}),e.jsxs(V,{gap:2,children:[e.jsx(C,{title:l("blocklet.config.session.fullNameEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(W,{disabled:!0,checked:!0})})}),e.jsx(C,{title:l("blocklet.config.session.avatarEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(W,{disabled:!0,checked:!0})})}),e.jsx(C,{title:l("blocklet.config.session.emailEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enabled",control:t,render:({field:m})=>e.jsx(W,{...m,checked:m.value})})})}),d&&e.jsxs(V,{direction:"column",ml:2,children:[e.jsx(C,{title:l("blocklet.config.session.emailRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.requireVerified",control:t,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(C,{title:l("blocklet.config.session.emailRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.requireUnique",control:t,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(C,{title:l("blocklet.config.session.emailTrustOauthProviders"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.trustOauthProviders",control:t,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(C,{title:l("blocklet.config.session.enableDomainBlackList"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enableDomainBlackList",control:t,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),T&&e.jsxs(u,{children:[g.map((m,R)=>e.jsxs(V,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(I,{name:`email.domainBlackList.${R}`,control:t,render:A=>e.jsx(O,{...A.field,size:"small",fullWidth:!0})}),e.jsx(ie,{onClick:()=>v(R),children:e.jsx(Ce,{})})]},m.id)),e.jsx($,{startIcon:e.jsx(qe,{}),onClick:()=>y(""),children:l("blocklet.config.session.addDomain")})]}),e.jsx(C,{title:l("blocklet.config.session.enableDomainWhiteList"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enableDomainWhiteList",control:t,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),x&&e.jsxs(u,{children:[S.map((m,R)=>e.jsxs(V,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(I,{name:`email.domainWhiteList.${R}`,control:t,render:A=>e.jsx(O,{...A.field,size:"small",fullWidth:!0})}),e.jsx(ie,{onClick:()=>r(R),children:e.jsx(Ce,{})})]},m.id)),e.jsx($,{startIcon:e.jsx(qe,{}),onClick:()=>i(""),children:l("blocklet.config.session.addDomain")})]})]}),e.jsxs(u,{sx:{display:"none"},children:[e.jsx(C,{title:l("blocklet.config.session.phoneEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.enabled",control:t,disabled:!0,render:({field:m})=>e.jsx(_,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),k&&e.jsxs(V,{direction:"column",ml:2,mt:1,children:[e.jsx(C,{title:l("blocklet.config.session.phoneRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.requireVerified",control:t,render:({field:m})=>e.jsx(_,{control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(C,{title:l("blocklet.config.session.phoneRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.requireUnique",control:t,render:({field:m})=>e.jsx(_,{control:e.jsx(W,{...m,checked:m.value})})})})})]})]})]})]}),e.jsxs(u,{children:[e.jsx(ne,{variant:"h6",fontWeight:600,children:l("blocklet.config.session.period")}),e.jsx(u,{component:le,my:3}),e.jsx(V,{direction:"column",spacing:2,children:e.jsx(I,{name:"ttl",control:t,rules:{min:1,max:30},render:({field:m})=>e.jsx(E,{fullWidth:!0,sx:{mb:2},children:e.jsx(C,{title:l("blocklet.config.session.ttl",{day:m.value}),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{width:"100%",maxWidth:500,px:1.5},children:e.jsx(nt,{...m,defaultValue:7,step:1,marks:[{value:1,label:l("blocklet.config.session.day",{day:1})},{value:7,label:l("blocklet.config.session.days",{day:7})},{value:14,label:l("blocklet.config.session.days",{day:14})},{value:21,label:l("blocklet.config.session.days",{day:21})},{value:30,label:l("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto"})})})})})})]}),e.jsx(u,{children:e.jsx($,{type:"submit",variant:"contained",disabled:!f.isDirty,children:l("oauth.save")})})]})})}const Tt=Oe.form`
|
|
2
2
|
max-width: 1536px;
|
|
3
3
|
|
|
4
4
|
.advanced-config {
|
|
@@ -38,7 +38,7 @@ import{a as se,a3 as _,cc as Me,cd as Ve,I as K,ca as $e,cb as Ne,ai as He,ah as
|
|
|
38
38
|
.form-item {
|
|
39
39
|
margin-top: 0;
|
|
40
40
|
}
|
|
41
|
-
`;var ve={},It=Be;Object.defineProperty(ve,"__esModule",{value:!0});var Ee=ve.default=void 0,Ct=It(Ae()),Pe=e;Ee=ve.default=(0,Ct.default)([(0,Pe.jsx)("path",{d:"M19 5v14H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2"},"0"),(0,Pe.jsx)("path",{d:"M14 17H7v-2h7zm3-4H7v-2h10zm0-4H7V7h10z"},"1")],"ArticleOutlined");var ye={},Dt=Be;Object.defineProperty(ye,"__esModule",{value:!0});var Se=ye.default=void 0,qt=Dt(Ae()),Ft=e;Se=ye.default=(0,qt.default)((0,Ft.jsx)("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2m4.24 16L12 15.45 7.77 18l1.12-4.81-3.73-3.23 4.92-.42L12 5l1.92 4.53 4.92.42-3.73 3.23z"}),"Stars");const Rt={width:24,height:24,body:'<path fill="currentColor" d="M6 12.05q0 1.125.425 2.188T7.75 16.2l.25.25V15q0-.425.288-.713T9 14q.425 0 .713.288T10 15v4q0 .425-.288.713T9 20H5q-.425 0-.713-.288T4 19q0-.425.288-.713T5 18h1.75l-.4-.35q-1.3-1.15-1.825-2.625T4 12.05Q4 9.7 5.2 7.787T8.425 4.85q.35-.2.738-.025t.512.575q.125.375-.013.75t-.487.575q-1.45.8-2.313 2.213T6 12.05Zm12-.1q0-1.125-.425-2.187T16.25 7.8L16 7.55V9q0 .425-.288.713T15 10q-.425 0-.713-.288T14 9V5q0-.425.288-.713T15 4h4q.425 0 .713.288T20 5q0 .425-.288.713T19 6h-1.75l.4.35q1.225 1.225 1.788 2.663T20 11.95q0 2.35-1.2 4.263t-3.225 2.937q-.35.2-.737.025t-.513-.575q-.125-.375.013-.75t.487-.575q1.45-.8 2.313-2.212T18 11.95Z"/>'},{DEFAULT_IP_DOMAIN_SUFFIX:Pt,SLOT_FOR_IP_DNS_SITE:At,DEFAULT_DID_DOMAIN:Ot}=oe,{encode:_e}=xt,Bt=j=>`${_e(j.meta.did)}-${At}.${Pt}`,zt=({did:j,didDomain:o=Ot})=>`${_e(j)}.${o}`;var Et={getIpDnsDomainForBlocklet:Bt,getDidDomainForBlocklet:zt};const _t=P.forwardRef((j,o)=>{var v,S;const{t:n}=P.useContext(G),{blocklet:s}=N(),{api:w}=J(),t=ae({loadingReject:!1,loadingApprove:!1,mode:"view",show:!1,data:{},callback:X}),f=je(),c=((S=(v=f==null?void 0:f.transitions)==null?void 0:v.duration)==null?void 0:S.leavingScreen)||300,h=p(()=>{t.mode="view",t.data={},t.callback=X}),l=p(()=>{t.show=!1,setTimeout(()=>{h()},c)}),d=p(i=>{t.mode="view",t.show=!0,t.data=i}),k=p((i,r=X)=>{t.mode="approve",t.show=!0,t.data=i,t.callback=r});P.useImperativeHandle(o,()=>({open:d,close:l,approve:k}),[d,l,k]);const T=te(()=>{if(!t.show)return[];t.data.migratedFrom=[t.data.appId,t.data.appPid];const i=["appName","appLogo","appId","appPid","migratedFrom","appDescription","appUrl","version","appliedAt","status","serverId","serverVersion"];return t.data.isMaster!==!1&&dt(i,"appliedAt","status"),i.map(r=>{const L=n(`federated.info.${r}`);let a=t.data[r];if(r==="appName"&&t.data.isMaster&&(a=e.jsxs(u,{children:[e.jsx(ze,{component:Se}),a]})),["appId","appPid","serverId"].includes(r)&&(a=e.jsx(xe,{children:a})),["appUrl"].includes(r)&&(a=e.jsx(u,{component:"a",href:a,target:"_blank",children:a})),["appLogo"].includes(r)){const b=ut(`https://${Et.getDidDomainForBlocklet({did:t.data.appPid})}`,oe.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo");try{const m=new URL(b);m.searchParams.set("imageFilter","resize"),m.searchParams.set("w","80"),m.searchParams.set("h","80"),a=e.jsx("img",{src:m.href,width:"60",height:"60",alt:t.data.appName})}catch{a=e.jsx("img",{src:b,width:"60",height:"60",alt:t.data.appName})}}return r==="status"&&(a=a&&n(`federated.status.${a}`)),r==="migratedFrom"&&(a=(t.data.migratedFrom||[]).filter(R=>![t.data.appId,t.data.appPid].includes(R)).map(R=>e.jsx(xe,{children:R}))),mt(a)&&(a="-"),{name:L,value:a}})},[t.data]),x=t.mode==="approve",g=p(async()=>{try{t.loadingReject=!0,await w.auditFederatedLogin({input:{memberPid:t.data.appPid,did:s.appPid,status:"rejected"}}),l(),t==null||t.callback(!1)}finally{t.loadingReject=!1}}),y=p(async()=>{try{t.loadingApprove=!0,await w.auditFederatedLogin({input:{memberPid:t.data.appPid,did:s.appPid,status:"approved"}}),l(),t==null||t.callback(!0)}finally{t.loadingApprove=!1}});return e.jsx(ge,{open:t.show,title:n(x?"federated.approveToJoinLogin":"federated.siteDetail"),onClose:l,actions:x?e.jsxs(e.Fragment,{children:[e.jsxs($,{color:"error",variant:"contained",onClick:g,disabled:t.loadingReject,children:[t.loadingReject?e.jsx(fe,{size:16,color:"grey"}):null,n("common.reject")]}),e.jsxs($,{variant:"contained",onClick:y,disabled:t.loadingApprove,children:[t.loadingApprove?e.jsx(fe,{size:16,color:"grey"}):null,n("common.approve")]})]}):e.jsx($,{variant:"outlined",onClick:l,children:n("common.close")}),children:T.map(i=>e.jsx(ht,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:180,name:i.name,children:i.value},i.name))})}),Ue=P.forwardRef((j,o)=>{var d,k;const n=je(),s=((k=(d=n==null?void 0:n.transitions)==null?void 0:d.duration)==null?void 0:k.leavingScreen)||300,{t:w}=P.useContext(G),t=ae({show:!1,data:{link:""}}),f=p(()=>{t.data.link=""}),c=p(()=>{t.show=!1,setTimeout(()=>{f()},s)}),h=p(({link:T})=>{t.show=!0,t.data.link=T});P.useImperativeHandle(o,()=>({open:h,close:c}),[h,c]);const l=p(()=>{tt(t.data.link),c()});return e.jsxs(ge,{open:t.show,title:w("federated.joinFederatedLogin"),onClose:c,PaperProps:{style:{minHeight:"unset"}},actions:e.jsx(z,{color:"primary",autoFocus:!0,variant:"contained",onClick:l,children:w("common.copyAndClose")}),children:[e.jsx(u,{mb:1,children:w("federated.inviteJoinFederatedLoginDescription")}),e.jsx(u,{sx:{"& .copy-button":{display:"none !important"}},children:e.jsx(Ge,{language:"shell",style:{marginBottom:0},children:t.data.link})})]})});function we({mode:j}){var Q,ke,Le,Te,Ie;const o=P.useRef(null),n=P.useRef(null),{t:s,locale:w}=P.useContext(G),{blocklet:t,actions:{refreshBlocklet:f}}=N(),{confirmApi:c,confirmHolder:h}=Ze(),{api:l}=J(),d=((Q=t.settings.federated)==null?void 0:Q.sites)||[],k=((ke=t.settings.federated)==null?void 0:ke.config)||{},T=k.isMaster!==!1,x=d.find(D=>D.appPid===t.appPid),g=ae({loadingSync:!1}),y=p(D=>{var q;(q=n.current)==null||q.open(D)}),v=p(D=>{var q;(q=n.current)==null||q.approve(D,f)}),S=p(D=>{c.open({title:s("federated.removeFederatedLogin"),content:s("federated.removeFederatedLoginDescription"),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(q){await l.quitFederatedLogin({input:{did:t.appPid,targetDid:D.appPid}}),q()}})}),i=p(D=>{c.open({title:s("federated.disableFederatedLogin"),content:s("federated.disableFederatedLoginDescription"),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(q){await l.auditFederatedLogin({input:{memberPid:D.appPid,did:t.appPid,status:"revoked"}}),q()}})}),r=p(D=>{c.open({title:s("federated.enableFederatedLogin"),content:s("federated.enableFederatedLoginDescription"),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),async onConfirm(q){await l.auditFederatedLogin({input:{memberPid:D.appPid,did:t.appPid,status:"approved"}}),q()}})}),L=te(()=>{const D=[{label:s("common.name"),name:"appName",options:{customBodyRenderLite:q=>{const F=d[q],ee=F.isMaster!==!1;return e.jsx(u,{display:"inline-block",children:e.jsxs(u,{component:"a",display:"flex",alignItems:"center",href:F.appUrl,target:"_blank",onClick:B=>{B.stopPropagation()},children:[ee&&e.jsx(ze,{component:Se,style:{marginRight:"4px"}}),F.appName]})})}}},{label:s("common.did"),name:"appId",options:{customBodyRenderLite:q=>{const F=d[q];return e.jsx(xe,{children:F.appId})}}},{label:s("common.status"),name:"status",options:{customBodyRenderLite:q=>{const F=d[q],ee=F.isMaster!==!1;return e.jsx(u,{children:ee?"-":s(`federated.status.${F.status}`)})}}}];return T&&D.push({label:s("common.actions"),name:"actions",options:{customBodyRenderLite:q=>{const F=d[q],ee=F.isMaster!==!1;return e.jsx(u,{display:"flex",gap:1,children:ee?e.jsxs(e.Fragment,{children:[F.status==="rejected"&&e.jsx(z,{variant:"contained",color:"error",size:"small",onClick:B=>{B.stopPropagation()},children:s("federated.status.rejected")}),F.status==="revoked"&&e.jsx(z,{variant:"contained",color:"secondary",size:"small",onClick:B=>{B.stopPropagation()},children:s("federated.status.revoked")})]}):e.jsxs(e.Fragment,{children:[e.jsx(z,{variant:"contained",color:"error",size:"small",onClick:B=>{B.stopPropagation(),S(F)},children:s("federated.quitMember")},"quiteSite"),F.status==="pending"&&e.jsx(z,{variant:"contained",color:"primary",size:"small",onClick:B=>{B.stopPropagation(),v(F)},children:s("federated.status.pending")},"auditSite"),F.status==="approved"&&e.jsx(z,{variant:"contained",color:"error",size:"small",onClick:B=>{B.stopPropagation(),i(F)},style:{whiteSpace:"nowrap"},children:s("federated.revoke")},"revokeSite"),F.status==="revoked"&&e.jsx(z,{variant:"contained",color:"warning",size:"small",onClick:B=>{B.stopPropagation(),r(F)},style:{whiteSpace:"nowrap"},children:s("federated.approve")},"approveSite")]})})}}}),D},[k.appId,d,T,s]),a=te(()=>({sort:!0,download:!1,filter:!1,print:!1,expandableRowsOnClick:!0,onRowClick(D,{dataIndex:q}){const F=d[q];y(F)}}),[]),b=p(()=>{var q;const D=t.environments.find(F=>F.key===it.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL);D!=null&&D.value?(q=o.current)==null||q.open({link:D.value}):_.error(s("federated.failedToGetFederatedLoginLink"))},[(Ie=(Te=(Le=t.site)==null?void 0:Le.domainAliases)==null?void 0:Te[0])==null?void 0:Ie.href]),m=p(()=>{c.open({title:s("federated.quitFederatedLogin"),content:s("federated.quitFederatedLoginDescription"),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(D){await l.quitFederatedLogin({input:{did:t.appPid}}),D()}})}),R=p(()=>{c.open({title:s("federated.disbandFederatedLogin"),content:s("federated.disbandFederatedLoginDescription"),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(D){await l.disbandFederatedLogin({input:{did:t.appPid}}),D()}})}),A=p(async()=>{try{g.loadingSync=!0,await Promise.all([await l.syncFederatedConfig({input:{did:t.appPid}}),Xe(500)]),_.success(s("common.succeeded"))}finally{g.loadingSync=!1}}),M=[];return x.status!=="pending"&&M.push(e.jsx(st,{title:s("federated.syncConfig"),children:e.jsx(ie,{size:"small",onClick:A,disabled:g.loadingSync,sx:[{"@keyframes spin":{from:{transform:"rotate(0deg)"},to:{transform:"rotate(360deg)"}}},g.loadingSync?{animation:"spin 1s linear infinite"}:{}],children:e.jsx(K,{icon:Rt,style:{fontSize:24}})},"syncConfig")})),j==="master"?(M.push(e.jsx(z,{size:"small",variant:"contained",onClick:b,sx:{ml:1},children:s("federated.inviteJoinFederatedLogin")},"inviteJoinFederatedLogin")),M.push(e.jsx(z,{color:"error",size:"small",variant:"contained",onClick:R,sx:{ml:1},children:s("federated.disbandFederatedLogin")},"disbandFederatedLogin"))):M.push(e.jsx(z,{size:"small",variant:"contained",color:"error",onClick:m,sx:{ml:1},children:s("federated.quitFederatedLogin")},"quitFederatedLogin")),e.jsxs(e.Fragment,{children:[e.jsx(Ye,{className:"main-table",locale:w,data:d,columns:L,customButtons:M,title:e.jsx(u,{className:"table-toolbar-left",children:s("oauth.federated")}),options:a}),h,e.jsx(Ue,{ref:o}),e.jsx(_t,{ref:n})]})}we.propTypes={mode:H.oneOf(["member","master"])};we.defaultProps={mode:"member"};const Ut=P.forwardRef((j,o)=>{var g,y;const{t:n}=P.useContext(G),{api:s}=J(),{blocklet:w}=N(),t=w==null?void 0:w.appPid,f=je(),c=((y=(g=f==null?void 0:f.transitions)==null?void 0:g.duration)==null?void 0:y.leavingScreen)||300,h=ae({loading:!1,show:!1,appUrl:"",appUrlError:"",callback:X}),l=p(()=>{h.appUrl="",h.appUrlError="",h.callback=X}),d=p(()=>{h.show=!1,setTimeout(()=>{l()},c)}),k=p((v=X)=>{h.show=!0,h.callback=v});P.useImperativeHandle(o,()=>({open:k,close:d}),[k,d]);const T=p(v=>{if(!v)throw new Error(n("federated.federatedJoinAppUrlRequired"));if(!Qe(v))throw new Error(n("federated.federatedJoinAppUrlInvalid"))}),x=p(async()=>{try{T(h.appUrl),h.loading=!0;const v=await s.joinFederatedLogin({input:{did:t,appUrl:h.appUrl}});h.show=!1,d(),h==null||h.callback(v)}catch(v){h.appUrlError=v.message}finally{h.loading=!1}});return e.jsxs(ge,{open:h.show,title:n("federated.joinFederatedLogin"),onClose:d,PaperProps:{style:{minHeight:"unset"}},actions:e.jsxs(z,{color:"primary",autoFocus:!0,variant:"contained",onClick:x,disabled:h.loading,children:[h.loading?e.jsx(fe,{size:16,sx:{mr:1},color:"grey"}):null,n("common.confirm")]}),children:[e.jsx(u,{mb:1,children:n("federated.joinFederatedLoginDescription")}),e.jsx(O,{fullWidth:!0,variant:"outlined",margin:"dense",placeholder:n("federated.federatedJoinAppUrl"),label:n("federated.federatedJoinAppUrl"),value:h.appUrl,error:!!h.appUrlError,helperText:h.appUrlError||"eg: https://www.arcblock.io",onChange:v=>{h.appUrl=v.target.value}})]})});function Wt(){const{t:j}=P.useContext(G);return e.jsxs(V,{direction:"row",spacing:2,alignItems:"flex-start",p:2,children:[e.jsx(Ee,{fontSize:"large",color:"primary"}),e.jsxs(u,{children:[e.jsx(ne,{variant:"h6",gutterBottom:!0,children:j("federated.title")}),e.jsx(ne,{variant:"body2",color:"text.secondary",children:j("federated.description")}),e.jsx(at,{href:"https://www.arcblock.io/blog/zh/did-connect-federated-login-support",underline:"hover",variant:"body2",color:"primary",target:"_blank",sx:{display:"inline-flex",alignItems:"center",mt:1},children:j("federated.link")})]})]})}function Mt(){var c,h,l,d,k;const j=P.useRef(null),o=P.useRef(null),{t:n}=P.useContext(G),{blocklet:s,actions:{refreshBlocklet:w}}=N(),t=p(()=>{var x,g,y,v;const T=(y=(g=(x=s.site)==null?void 0:x.domainAliases)==null?void 0:g[0])==null?void 0:y.href;if(T)try{const S=new URL(T);(v=j.current)==null||v.open({link:S.origin})}catch{_.error(n("federated.failedToGetFederatedLoginLink"))}},[(l=(h=(c=s.site)==null?void 0:c.domainAliases)==null?void 0:h[0])==null?void 0:l.href]),f=p(()=>{var T;(T=o.current)==null||T.open(()=>{w()})});if(((d=s.settings.federated)==null?void 0:d.sites.length)>0){const T=((k=s.settings.federated)==null?void 0:k.config.isMaster)!==!1;return e.jsx(we,{mode:T?"master":"member"})}return e.jsxs(e.Fragment,{children:[e.jsx(u,{display:"flex",flexDirection:"column",gap:2,justifyContent:"center",alignItems:"center",minHeight:"200px",children:e.jsxs(u,{sx:{maxWidth:400,borderRadius:2,border:"1px solid",borderColor:"divider"},children:[e.jsx(Wt,{}),e.jsx(le,{sx:{width:1}}),e.jsxs(V,{width:1,p:2,gap:1.5,children:[e.jsx(z,{variant:"contained",onClick:t,sx:{width:1},children:n("federated.inviteJoinFederatedLogin")}),e.jsx(z,{variant:"outlined",onClick:f,sx:{width:1},children:n("federated.joinFederatedLogin")})]})]})}),e.jsx(Ue,{ref:j}),e.jsx(Ut,{ref:o})]})}function We({orientation:j="horizontal"}){const{t:o}=P.useContext(G),n=ft({key:"lg"}),s=[{label:e.jsx(u,{textAlign:"center",width:"100%",children:o("oauth.commonSettings")}),value:"settings"},{label:e.jsx(u,{textAlign:"center",width:"100%",children:o("oauth.federated")}),value:"federated"},{label:e.jsx(u,{textAlign:"center",width:"100%",children:o("oauth.oauth")}),value:"oauth"},{label:e.jsx(u,{textAlign:"center",width:"100%",children:o("oauth.moreLogin")}),value:"more"}],[w,t]=P.useState(s[0].value),f=te(()=>({oauth:e.jsx(kt,{}),federated:e.jsx(Mt,{}),more:e.jsx(et,{children:o("oauth.comingSoon")}),settings:e.jsx(Lt,{})}),[o]);return j==="vertical"?e.jsx(Vt,{children:e.jsxs(V,{direction:{md:"column",lg:"row"},gap:2,children:[e.jsx(u,{sx:{minWidth:"240px",flexShrink:0},children:e.jsx(De,{tabs:s,current:w,orientation:n?"horizontal":"vertical",onChange:t,sx:{borderRight:n?0:1,height:"100%",borderColor:"divider"}})}),e.jsx(u,{sx:{flexGrow:1,minWidth:0},children:e.jsx(u,{maxWidth:"1200px",children:f[w]})})]})}):e.jsxs(u,{children:[e.jsx(De,{tabs:s,current:w,onChange:t}),e.jsx(u,{marginTop:"10px",children:f[w]})]})}We.propTypes={orientation:H.oneOf(["horizontal","vertical"])};We.defaultProps={orientation:"horizontal"};const Vt=Oe.div`
|
|
41
|
+
`;var ve={},It=Be;Object.defineProperty(ve,"__esModule",{value:!0});var Ee=ve.default=void 0,Ct=It(Ae()),Pe=e;Ee=ve.default=(0,Ct.default)([(0,Pe.jsx)("path",{d:"M19 5v14H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2"},"0"),(0,Pe.jsx)("path",{d:"M14 17H7v-2h7zm3-4H7v-2h10zm0-4H7V7h10z"},"1")],"ArticleOutlined");var ye={},Dt=Be;Object.defineProperty(ye,"__esModule",{value:!0});var Se=ye.default=void 0,qt=Dt(Ae()),Ft=e;Se=ye.default=(0,qt.default)((0,Ft.jsx)("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2m4.24 16L12 15.45 7.77 18l1.12-4.81-3.73-3.23 4.92-.42L12 5l1.92 4.53 4.92.42-3.73 3.23z"}),"Stars");const Rt={width:24,height:24,body:'<path fill="currentColor" d="M6 12.05q0 1.125.425 2.188T7.75 16.2l.25.25V15q0-.425.288-.713T9 14q.425 0 .713.288T10 15v4q0 .425-.288.713T9 20H5q-.425 0-.713-.288T4 19q0-.425.288-.713T5 18h1.75l-.4-.35q-1.3-1.15-1.825-2.625T4 12.05Q4 9.7 5.2 7.787T8.425 4.85q.35-.2.738-.025t.512.575q.125.375-.013.75t-.487.575q-1.45.8-2.313 2.213T6 12.05Zm12-.1q0-1.125-.425-2.187T16.25 7.8L16 7.55V9q0 .425-.288.713T15 10q-.425 0-.713-.288T14 9V5q0-.425.288-.713T15 4h4q.425 0 .713.288T20 5q0 .425-.288.713T19 6h-1.75l.4.35q1.225 1.225 1.788 2.663T20 11.95q0 2.35-1.2 4.263t-3.225 2.937q-.35.2-.737.025t-.513-.575q-.125-.375.013-.75t.487-.575q1.45-.8 2.313-2.212T18 11.95Z"/>'},{DEFAULT_IP_DOMAIN_SUFFIX:Pt,SLOT_FOR_IP_DNS_SITE:At,DEFAULT_DID_DOMAIN:Ot}=oe,{encode:Ue}=xt,Bt=j=>`${Ue(j.meta.did)}-${At}.${Pt}`,zt=({did:j,didDomain:o=Ot})=>`${Ue(j)}.${o}`;var Et={getIpDnsDomainForBlocklet:Bt,getDidDomainForBlocklet:zt};const Ut=P.forwardRef((j,o)=>{var v,S;const{t:n}=P.useContext(G),{blocklet:s}=N(),{api:w}=J(),t=ae({loadingReject:!1,loadingApprove:!1,mode:"view",show:!1,data:{},callback:X}),f=je(),c=((S=(v=f==null?void 0:f.transitions)==null?void 0:v.duration)==null?void 0:S.leavingScreen)||300,h=p(()=>{t.mode="view",t.data={},t.callback=X}),l=p(()=>{t.show=!1,setTimeout(()=>{h()},c)}),d=p(i=>{t.mode="view",t.show=!0,t.data=i}),k=p((i,r=X)=>{t.mode="approve",t.show=!0,t.data=i,t.callback=r});P.useImperativeHandle(o,()=>({open:d,close:l,approve:k}),[d,l,k]);const T=te(()=>{if(!t.show)return[];t.data.migratedFrom=[t.data.appId,t.data.appPid];const i=["appName","appLogo","appId","appPid","migratedFrom","appDescription","appUrl","version","appliedAt","status","serverId","serverVersion"];return t.data.isMaster!==!1&&dt(i,"appliedAt","status"),i.map(r=>{const L=n(`federated.info.${r}`);let a=t.data[r];if(r==="appName"&&t.data.isMaster&&(a=e.jsxs(u,{children:[e.jsx(ze,{component:Se}),a]})),["appId","appPid","serverId"].includes(r)&&(a=e.jsx(xe,{children:a})),["appUrl"].includes(r)&&(a=e.jsx(u,{component:"a",href:a,target:"_blank",children:a})),["appLogo"].includes(r)){const b=ut(`https://${Et.getDidDomainForBlocklet({did:t.data.appPid})}`,oe.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo");try{const m=new URL(b);m.searchParams.set("imageFilter","resize"),m.searchParams.set("w","80"),m.searchParams.set("h","80"),a=e.jsx("img",{src:m.href,width:"60",height:"60",alt:t.data.appName})}catch{a=e.jsx("img",{src:b,width:"60",height:"60",alt:t.data.appName})}}return r==="status"&&(a=a&&n(`federated.status.${a}`)),r==="migratedFrom"&&(a=(t.data.migratedFrom||[]).filter(R=>![t.data.appId,t.data.appPid].includes(R)).map(R=>e.jsx(xe,{children:R}))),mt(a)&&(a="-"),{name:L,value:a}})},[t.data]),x=t.mode==="approve",g=p(async()=>{try{t.loadingReject=!0,await w.auditFederatedLogin({input:{memberPid:t.data.appPid,did:s.appPid,status:"rejected"}}),l(),t==null||t.callback(!1)}finally{t.loadingReject=!1}}),y=p(async()=>{try{t.loadingApprove=!0,await w.auditFederatedLogin({input:{memberPid:t.data.appPid,did:s.appPid,status:"approved"}}),l(),t==null||t.callback(!0)}finally{t.loadingApprove=!1}});return e.jsx(ge,{open:t.show,title:n(x?"federated.approveToJoinLogin":"federated.siteDetail"),onClose:l,actions:x?e.jsxs(e.Fragment,{children:[e.jsxs($,{color:"error",variant:"contained",onClick:g,disabled:t.loadingReject,children:[t.loadingReject?e.jsx(fe,{size:16,color:"grey"}):null,n("common.reject")]}),e.jsxs($,{variant:"contained",onClick:y,disabled:t.loadingApprove,children:[t.loadingApprove?e.jsx(fe,{size:16,color:"grey"}):null,n("common.approve")]})]}):e.jsx($,{variant:"outlined",onClick:l,children:n("common.close")}),children:T.map(i=>e.jsx(ht,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:180,name:i.name,children:i.value},i.name))})}),_e=P.forwardRef((j,o)=>{var d,k;const n=je(),s=((k=(d=n==null?void 0:n.transitions)==null?void 0:d.duration)==null?void 0:k.leavingScreen)||300,{t:w}=P.useContext(G),t=ae({show:!1,data:{link:""}}),f=p(()=>{t.data.link=""}),c=p(()=>{t.show=!1,setTimeout(()=>{f()},s)}),h=p(({link:T})=>{t.show=!0,t.data.link=T});P.useImperativeHandle(o,()=>({open:h,close:c}),[h,c]);const l=p(()=>{tt(t.data.link),c()});return e.jsxs(ge,{open:t.show,title:w("federated.joinFederatedLogin"),onClose:c,PaperProps:{style:{minHeight:"unset"}},actions:e.jsx(z,{color:"primary",autoFocus:!0,variant:"contained",onClick:l,children:w("common.copyAndClose")}),children:[e.jsx(u,{mb:1,children:w("federated.inviteJoinFederatedLoginDescription")}),e.jsx(u,{sx:{"& .copy-button":{display:"none !important"}},children:e.jsx(Ge,{language:"shell",style:{marginBottom:0},children:t.data.link})})]})});function we({mode:j}){var Q,ke,Le,Te,Ie;const o=P.useRef(null),n=P.useRef(null),{t:s,locale:w}=P.useContext(G),{blocklet:t,actions:{refreshBlocklet:f}}=N(),{confirmApi:c,confirmHolder:h}=Ze(),{api:l}=J(),d=((Q=t.settings.federated)==null?void 0:Q.sites)||[],k=((ke=t.settings.federated)==null?void 0:ke.config)||{},T=k.isMaster!==!1,x=d.find(D=>D.appPid===t.appPid),g=ae({loadingSync:!1}),y=p(D=>{var q;(q=n.current)==null||q.open(D)}),v=p(D=>{var q;(q=n.current)==null||q.approve(D,f)}),S=p(D=>{c.open({title:s("federated.removeFederatedLogin"),content:s("federated.removeFederatedLoginDescription"),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(q){await l.quitFederatedLogin({input:{did:t.appPid,targetDid:D.appPid}}),q()}})}),i=p(D=>{c.open({title:s("federated.disableFederatedLogin"),content:s("federated.disableFederatedLoginDescription"),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(q){await l.auditFederatedLogin({input:{memberPid:D.appPid,did:t.appPid,status:"revoked"}}),q()}})}),r=p(D=>{c.open({title:s("federated.enableFederatedLogin"),content:s("federated.enableFederatedLoginDescription"),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),async onConfirm(q){await l.auditFederatedLogin({input:{memberPid:D.appPid,did:t.appPid,status:"approved"}}),q()}})}),L=te(()=>{const D=[{label:s("common.name"),name:"appName",options:{customBodyRenderLite:q=>{const F=d[q],ee=F.isMaster!==!1;return e.jsx(u,{display:"inline-block",children:e.jsxs(u,{component:"a",display:"flex",alignItems:"center",href:F.appUrl,target:"_blank",onClick:B=>{B.stopPropagation()},children:[ee&&e.jsx(ze,{component:Se,style:{marginRight:"4px"}}),F.appName]})})}}},{label:s("common.did"),name:"appId",options:{customBodyRenderLite:q=>{const F=d[q];return e.jsx(xe,{children:F.appId})}}},{label:s("common.status"),name:"status",options:{customBodyRenderLite:q=>{const F=d[q],ee=F.isMaster!==!1;return e.jsx(u,{children:ee?"-":s(`federated.status.${F.status}`)})}}}];return T&&D.push({label:s("common.actions"),name:"actions",options:{customBodyRenderLite:q=>{const F=d[q],ee=F.isMaster!==!1;return e.jsx(u,{display:"flex",gap:1,children:ee?e.jsxs(e.Fragment,{children:[F.status==="rejected"&&e.jsx(z,{variant:"contained",color:"error",size:"small",onClick:B=>{B.stopPropagation()},children:s("federated.status.rejected")}),F.status==="revoked"&&e.jsx(z,{variant:"contained",color:"secondary",size:"small",onClick:B=>{B.stopPropagation()},children:s("federated.status.revoked")})]}):e.jsxs(e.Fragment,{children:[e.jsx(z,{variant:"contained",color:"error",size:"small",onClick:B=>{B.stopPropagation(),S(F)},children:s("federated.quitMember")},"quiteSite"),F.status==="pending"&&e.jsx(z,{variant:"contained",color:"primary",size:"small",onClick:B=>{B.stopPropagation(),v(F)},children:s("federated.status.pending")},"auditSite"),F.status==="approved"&&e.jsx(z,{variant:"contained",color:"error",size:"small",onClick:B=>{B.stopPropagation(),i(F)},style:{whiteSpace:"nowrap"},children:s("federated.revoke")},"revokeSite"),F.status==="revoked"&&e.jsx(z,{variant:"contained",color:"warning",size:"small",onClick:B=>{B.stopPropagation(),r(F)},style:{whiteSpace:"nowrap"},children:s("federated.approve")},"approveSite")]})})}}}),D},[k.appId,d,T,s]),a=te(()=>({sort:!0,download:!1,filter:!1,print:!1,expandableRowsOnClick:!0,onRowClick(D,{dataIndex:q}){const F=d[q];y(F)}}),[]),b=p(()=>{var q;const D=t.environments.find(F=>F.key===it.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL);D!=null&&D.value?(q=o.current)==null||q.open({link:D.value}):U.error(s("federated.failedToGetFederatedLoginLink"))},[(Ie=(Te=(Le=t.site)==null?void 0:Le.domainAliases)==null?void 0:Te[0])==null?void 0:Ie.href]),m=p(()=>{c.open({title:s("federated.quitFederatedLogin"),content:s("federated.quitFederatedLoginDescription"),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(D){await l.quitFederatedLogin({input:{did:t.appPid}}),D()}})}),R=p(()=>{c.open({title:s("federated.disbandFederatedLogin"),content:s("federated.disbandFederatedLoginDescription"),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(D){await l.disbandFederatedLogin({input:{did:t.appPid}}),D()}})}),A=p(async()=>{try{g.loadingSync=!0,await Promise.all([await l.syncFederatedConfig({input:{did:t.appPid}}),Xe(500)]),U.success(s("common.succeeded"))}finally{g.loadingSync=!1}}),M=[];return x.status!=="pending"&&M.push(e.jsx(st,{title:s("federated.syncConfig"),children:e.jsx(ie,{size:"small",onClick:A,disabled:g.loadingSync,sx:[{"@keyframes spin":{from:{transform:"rotate(0deg)"},to:{transform:"rotate(360deg)"}}},g.loadingSync?{animation:"spin 1s linear infinite"}:{}],children:e.jsx(K,{icon:Rt,style:{fontSize:24}})},"syncConfig")})),j==="master"?(M.push(e.jsx(z,{size:"small",variant:"contained",onClick:b,sx:{ml:1},children:s("federated.inviteJoinFederatedLogin")},"inviteJoinFederatedLogin")),M.push(e.jsx(z,{color:"error",size:"small",variant:"contained",onClick:R,sx:{ml:1},children:s("federated.disbandFederatedLogin")},"disbandFederatedLogin"))):M.push(e.jsx(z,{size:"small",variant:"contained",color:"error",onClick:m,sx:{ml:1},children:s("federated.quitFederatedLogin")},"quitFederatedLogin")),e.jsxs(e.Fragment,{children:[e.jsx(Ye,{className:"main-table",locale:w,data:d,columns:L,customButtons:M,title:e.jsx(u,{className:"table-toolbar-left",children:s("oauth.federated")}),options:a}),h,e.jsx(_e,{ref:o}),e.jsx(Ut,{ref:n})]})}we.propTypes={mode:H.oneOf(["member","master"])};we.defaultProps={mode:"member"};const _t=P.forwardRef((j,o)=>{var g,y;const{t:n}=P.useContext(G),{api:s}=J(),{blocklet:w}=N(),t=w==null?void 0:w.appPid,f=je(),c=((y=(g=f==null?void 0:f.transitions)==null?void 0:g.duration)==null?void 0:y.leavingScreen)||300,h=ae({loading:!1,show:!1,appUrl:"",appUrlError:"",callback:X}),l=p(()=>{h.appUrl="",h.appUrlError="",h.callback=X}),d=p(()=>{h.show=!1,setTimeout(()=>{l()},c)}),k=p((v=X)=>{h.show=!0,h.callback=v});P.useImperativeHandle(o,()=>({open:k,close:d}),[k,d]);const T=p(v=>{if(!v)throw new Error(n("federated.federatedJoinAppUrlRequired"));if(!Qe(v))throw new Error(n("federated.federatedJoinAppUrlInvalid"))}),x=p(async()=>{try{T(h.appUrl),h.loading=!0;const v=await s.joinFederatedLogin({input:{did:t,appUrl:h.appUrl}});h.show=!1,d(),h==null||h.callback(v)}catch(v){h.appUrlError=v.message}finally{h.loading=!1}});return e.jsxs(ge,{open:h.show,title:n("federated.joinFederatedLogin"),onClose:d,PaperProps:{style:{minHeight:"unset"}},actions:e.jsxs(z,{color:"primary",autoFocus:!0,variant:"contained",onClick:x,disabled:h.loading,children:[h.loading?e.jsx(fe,{size:16,sx:{mr:1},color:"grey"}):null,n("common.confirm")]}),children:[e.jsx(u,{mb:1,children:n("federated.joinFederatedLoginDescription")}),e.jsx(O,{fullWidth:!0,variant:"outlined",margin:"dense",placeholder:n("federated.federatedJoinAppUrl"),label:n("federated.federatedJoinAppUrl"),value:h.appUrl,error:!!h.appUrlError,helperText:h.appUrlError||"eg: https://www.arcblock.io",onChange:v=>{h.appUrl=v.target.value}})]})});function Wt(){const{t:j}=P.useContext(G);return e.jsxs(V,{direction:"row",spacing:2,alignItems:"flex-start",p:2,children:[e.jsx(Ee,{fontSize:"large",color:"primary"}),e.jsxs(u,{children:[e.jsx(ne,{variant:"h6",gutterBottom:!0,children:j("federated.title")}),e.jsx(ne,{variant:"body2",color:"text.secondary",children:j("federated.description")}),e.jsx(at,{href:"https://www.arcblock.io/blog/zh/did-connect-federated-login-support",underline:"hover",variant:"body2",color:"primary",target:"_blank",sx:{display:"inline-flex",alignItems:"center",mt:1},children:j("federated.link")})]})]})}function Mt(){var c,h,l,d,k;const j=P.useRef(null),o=P.useRef(null),{t:n}=P.useContext(G),{blocklet:s,actions:{refreshBlocklet:w}}=N(),t=p(()=>{var x,g,y,v;const T=(y=(g=(x=s.site)==null?void 0:x.domainAliases)==null?void 0:g[0])==null?void 0:y.href;if(T)try{const S=new URL(T);(v=j.current)==null||v.open({link:S.origin})}catch{U.error(n("federated.failedToGetFederatedLoginLink"))}},[(l=(h=(c=s.site)==null?void 0:c.domainAliases)==null?void 0:h[0])==null?void 0:l.href]),f=p(()=>{var T;(T=o.current)==null||T.open(()=>{w()})});if(((d=s.settings.federated)==null?void 0:d.sites.length)>0){const T=((k=s.settings.federated)==null?void 0:k.config.isMaster)!==!1;return e.jsx(we,{mode:T?"master":"member"})}return e.jsxs(e.Fragment,{children:[e.jsx(u,{display:"flex",flexDirection:"column",gap:2,justifyContent:"center",alignItems:"center",minHeight:"200px",children:e.jsxs(u,{sx:{maxWidth:400,borderRadius:2,border:"1px solid",borderColor:"divider"},children:[e.jsx(Wt,{}),e.jsx(le,{sx:{width:1}}),e.jsxs(V,{width:1,p:2,gap:1.5,children:[e.jsx(z,{variant:"contained",onClick:t,sx:{width:1},children:n("federated.inviteJoinFederatedLogin")}),e.jsx(z,{variant:"outlined",onClick:f,sx:{width:1},children:n("federated.joinFederatedLogin")})]})]})}),e.jsx(_e,{ref:j}),e.jsx(_t,{ref:o})]})}function We({orientation:j="horizontal"}){const{t:o}=P.useContext(G),n=ft({key:"lg"}),s=[{label:e.jsx(u,{textAlign:"center",width:"100%",children:o("oauth.commonSettings")}),value:"settings"},{label:e.jsx(u,{textAlign:"center",width:"100%",children:o("oauth.federated")}),value:"federated"},{label:e.jsx(u,{textAlign:"center",width:"100%",children:o("oauth.oauth")}),value:"oauth"},{label:e.jsx(u,{textAlign:"center",width:"100%",children:o("oauth.moreLogin")}),value:"more"}],[w,t]=P.useState(s[0].value),f=te(()=>({oauth:e.jsx(kt,{}),federated:e.jsx(Mt,{}),more:e.jsx(et,{children:o("oauth.comingSoon")}),settings:e.jsx(Lt,{})}),[o]);return j==="vertical"?e.jsx(Vt,{children:e.jsxs(V,{direction:{md:"column",lg:"row"},gap:2,children:[e.jsx(u,{sx:{minWidth:"240px",flexShrink:0},children:e.jsx(De,{tabs:s,current:w,orientation:n?"horizontal":"vertical",onChange:t,sx:{borderRight:n?0:1,height:"100%",borderColor:"divider"}})}),e.jsx(u,{sx:{flexGrow:1,minWidth:0},children:e.jsx(u,{maxWidth:"1200px",children:f[w]})})]})}):e.jsxs(u,{children:[e.jsx(De,{tabs:s,current:w,onChange:t}),e.jsx(u,{marginTop:"10px",children:f[w]})]})}We.propTypes={orientation:H.oneOf(["horizontal","vertical"])};We.defaultProps={orientation:"horizontal"};const Vt=Oe.div`
|
|
42
42
|
.MuiTab-root {
|
|
43
43
|
text-align: left;
|
|
44
44
|
align-items: flex-start;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{B as tT,D as qm,E as Km,F as jm}from"./vendor-hooks-
|
|
1
|
+
import{B as tT,D as qm,E as Km,F as jm}from"./vendor-hooks-BFlOfe0M.js";import{B as Jm}from"./vendor-utils-BotmZdBm.js";import{g as s2,b as l2,r as u2}from"./vendor-react-DEoibe3W.js";/*! *****************************************************************************
|
|
2
2
|
Copyright (c) Microsoft Corporation.
|
|
3
3
|
|
|
4
4
|
Permission to use, copy, modify, and/or distribute this software for any
|