@abtnode/blocklet-services 1.16.47-beta-20250729-133234-77359596 → 1.16.47-beta-20250731-014139-e860268f
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/index.js +16 -3
- package/api/libs/auth/adapters/twitter.js +1 -1
- package/api/routes/csp-proxy.js +127 -12
- package/api/routes/oauth/client.js +9 -2
- package/dist/assets/{AdapterDayjs-BEkLDdDJ.js → AdapterDayjs-Dx6irzR8.js} +1 -1
- package/dist/assets/{Google-kE2qbn1K.js → Google-JeDCA1Ra.js} +1 -1
- package/dist/assets/{access-control-DYSDECUw.js → access-control-CqcbwJmg.js} +1 -1
- package/dist/assets/{actions-DvIZNF27.js → actions-CJMVMPKl.js} +1 -1
- package/dist/assets/{add-component-core-ofLBd0tu.js → add-component-core-DycwSgX5.js} +1 -1
- package/dist/assets/{add-resource-BJEI6PbV.js → add-resource-B2NC98Ho.js} +1 -1
- package/dist/assets/{addon-yoa0x6-0.js → addon-BaoB37xg.js} +1 -1
- package/dist/assets/{advanced-C40fcsMj.js → advanced-D8HEmDva.js} +1 -1
- package/dist/assets/aigne-B7-KeQ-z.js +10 -0
- package/dist/assets/api-B6VBwg-Z.js +1 -0
- package/dist/assets/{appearance-ChoNlV7r.js → appearance-B497VXFd.js} +1 -1
- package/dist/assets/{ar-7eC8LKj2.js → ar-DKohTs5n.js} +1 -1
- package/dist/assets/{arrow-down.svg-CW9W9wI1.js → arrow-down.svg-CVjG1TNQ.js} +1 -1
- package/dist/assets/{audit-logs-DjxskWcd.js → audit-logs-Dl8A9oRq.js} +1 -1
- package/dist/assets/authorize-Dq_NLQNa.js +1 -0
- package/dist/assets/{base-chart-Dhrxq8mT.js → base-chart-Bq5ougoU.js} +1 -1
- package/dist/assets/{base32-B9yl211y.js → base32-DdRv86ir.js} +1 -1
- package/dist/assets/{branding-M86FUBw6.js → branding-BoSGCdxD.js} +2 -2
- package/dist/assets/{branding-Da8E_HdC.js → branding-DGrOIsAX.js} +1 -1
- package/dist/assets/{bundle-avatar-JsO8Rdzw.js → bundle-avatar-CbWsxcdV.js} +1 -1
- package/dist/assets/button-NakGdoSQ.js +1 -0
- package/dist/assets/{click-to-copy-C43vd7DG.js → click-to-copy-D2vDgDFL.js} +1 -1
- package/dist/assets/{cloneDeep-DwV-xVQF.js → cloneDeep-Bp5oPxU3.js} +1 -1
- package/dist/assets/{collapse-B0wJmKRl.js → collapse-C3V-lD7M.js} +1 -1
- package/dist/assets/{complete-D_rU8GhU.js → complete-cbrNEz02.js} +1 -1
- package/dist/assets/{component-CYmSwtxC.js → component-Cpwp1opW.js} +56 -72
- package/dist/assets/{config-BICnV2kA.js → config-BVstS2Nm.js} +1 -1
- package/dist/assets/{config-Bel7KIi4.js → config-G8speQtC.js} +1 -1
- package/dist/assets/config-W238rhTW.js +263 -0
- package/dist/assets/{config-navigation-D8OXRCt9.js → config-navigation-C1cOMpGw.js} +3 -3
- package/dist/assets/{config-space-ODrN5Rt0.js → config-space-DkL2gOSr.js} +1 -1
- package/dist/assets/{confirm-CXK9v894.js → confirm-CRV2RKnN.js} +1 -1
- package/dist/assets/{connect-ig-5oJbW.js → connect-B1rcOd6B.js} +1 -1
- package/dist/assets/{connect-yrGsuleV.js → connect-DeAtTJ1r.js} +1 -1
- package/dist/assets/{connect-to-BpYFEl7i.js → connect-to-B8zygJqK.js} +1 -1
- package/dist/assets/{content-layout--aahhgT-.js → content-layout-CT98QJfh.js} +1 -1
- package/dist/assets/{createClass-BuE_i6UP.js → createClass-D_MAnszY.js} +1 -1
- package/dist/assets/dashboard-BDI5arRX.js +106 -0
- package/dist/assets/{de-DgwOa_mf.js → de-CYm7FmiN.js} +1 -1
- package/dist/assets/{delete-confirm-CpZStjie.js → delete-confirm-za4gd8zO.js} +1 -1
- package/dist/assets/{did-address-DrmEnz9K.js → did-address-DM13r0GC.js} +1 -1
- package/dist/assets/{domain-action-card-2vqk_Ni_.js → domain-action-card-Dt77CLty.js} +1 -1
- package/dist/assets/{domain-DbJ3kJI3.js → domain-nJ5cWvRr.js} +1 -1
- package/dist/assets/domains-BZ81E9og.js +1 -0
- package/dist/assets/{dot-BaR-8Dj-.js → dot-BD1gx_6x.js} +1 -1
- package/dist/assets/{email-D_7GvtZA.js → email-CvXCF8HC.js} +2 -2
- package/dist/assets/{empty-spinner-D6ajz4La.js → empty-spinner-BMuZ6jkU.js} +1 -1
- package/dist/assets/engine-B2vjFFt9.js +1 -0
- package/dist/assets/{es-B_gBSKp3.js → es-5zob_8Of.js} +1 -1
- package/dist/assets/{exchange-passport-BGTYcBca.js → exchange-passport-T_o_EXW7.js} +1 -1
- package/dist/assets/{form-CjYT8hk5.js → form-CXNMlv2k.js} +1 -1
- package/dist/assets/{form-text-input-x3g3qd72.js → form-text-input-CFrnnbRX.js} +1 -1
- package/dist/assets/{form-wrapper-DimyA4Kf.js → form-wrapper-CpayHdi1.js} +1 -1
- package/dist/assets/{fr-Bm0AhLrO.js → fr-GNzEzJIo.js} +1 -1
- package/dist/assets/{fuel-CBt1g8zp.js → fuel-LAjBSdqB.js} +1 -1
- package/dist/assets/{gen-access-key-DPNQGDvj.js → gen-access-key-BTl89uBT.js} +1 -1
- package/dist/assets/{gen-simple-access-key-Ctn_w0mo.js → gen-simple-access-key-CSNG83XC.js} +1 -1
- package/dist/assets/get-safe-url-BSYF437j.js +1 -0
- package/dist/assets/{hi-DO31L4at.js → hi-BMaS53lF.js} +1 -1
- package/dist/assets/{home-USnWZhK5.js → home-77gIsxv7.js} +1 -1
- package/dist/assets/{id-BYCjnoK8.js → id-CbyxMpli.js} +1 -1
- package/dist/assets/{iframe-Ci5Ay1y2.js → iframe-DUz4pKvd.js} +1 -1
- package/dist/assets/{index-CE07Exux.js → index--zSWr4mJ.js} +1 -1
- package/dist/assets/{index-DHLC0F8S.js → index-2oWhjD-V.js} +1 -1
- package/dist/assets/{index-CkuzlAat.js → index-9VirX3lP.js} +1 -1
- package/dist/assets/{index-DEDOywis.js → index-BRrSUEyB.js} +1 -1
- package/dist/assets/{index-DAg_a68C.js → index-BVknf90c.js} +1 -1
- package/dist/assets/{index-D8gGAVdB.js → index-BacwgICr.js} +1 -1
- package/dist/assets/{index-DoJKIwOt.js → index-BaofAoCa.js} +1 -1
- package/dist/assets/{index-B8KTykXs.js → index-BeEecuCm.js} +1 -1
- package/dist/assets/{index-DLDRrQJH.js → index-BeaB_cKh.js} +1 -1
- package/dist/assets/{index-D9r0lvN6.js → index-Bk_pomLR.js} +9 -9
- package/dist/assets/{index-CGHTnzaK.js → index-BlUiIWvp.js} +1 -1
- package/dist/assets/{index-BkSX50ri.js → index-C9-vpsBs.js} +1 -1
- package/dist/assets/{index-FrAYP-A_.js → index-CGzwVlpv.js} +8 -8
- package/dist/assets/{index-CiFQnBvO.js → index-CLLf5x5M.js} +1 -1
- package/dist/assets/{index-Bg6_NsC_.js → index-CSX4LtVd.js} +1 -1
- package/dist/assets/{index-CwdidKu0.js → index-CbB58MZZ.js} +1 -1
- package/dist/assets/{index-D_g21v0z.js → index-CdPVeM40.js} +19 -19
- package/dist/assets/{index-PcQgNtUn.js → index-Cvrw3K0w.js} +1 -1
- package/dist/assets/{index-BdKTdgAu.js → index-D1JnavLU.js} +1 -1
- package/dist/assets/index-D1UfZ73T.js +124 -0
- package/dist/assets/{index-CZiEDWpM.js → index-D7bQ7LFj.js} +1 -1
- package/dist/assets/{index-CoPcipTj.js → index-DE4S7LPJ.js} +1 -1
- package/dist/assets/{index-NhYP56dI.js → index-DFQY861i.js} +4 -4
- package/dist/assets/{index-IMquU8ZG.js → index-DL139d1R.js} +1 -1
- package/dist/assets/index-DnYdLG8x.js +1 -0
- package/dist/assets/{index-MJKS-RJU.js → index-Drthk0Vc.js} +1 -1
- package/dist/assets/{index-Bz6T9WJi.js → index-DwQuzZ6W.js} +1 -1
- package/dist/assets/{index-Cq-4YOTs.js → index-EQBtWV25.js} +1 -1
- package/dist/assets/{index-Bnhg3YZe.js → index-GX1AZaVf.js} +1 -1
- package/dist/assets/{index-cdAwhti6.js → index-GX7JwwIf.js} +1 -1
- package/dist/assets/{index-BFAR00t8.js → index-Vc0vthSd.js} +1 -1
- package/dist/assets/{index-Bga8wqEa.js → index-odXYgVVs.js} +1 -1
- package/dist/assets/{invitation-DRsYGsRz.js → invitation-CxN6bhPz.js} +1 -1
- package/dist/assets/invite-heDOi1Gk.js +1 -0
- package/dist/assets/{isURL-BKM8U6hZ.js → isURL-TswwHw1T.js} +1 -1
- package/dist/assets/issue-passport-Bw40L4Ic.js +1 -0
- package/dist/assets/{item-DMRC_0Pl.js → item-ouNpV3tA.js} +1 -1
- package/dist/assets/{ja-Ck2EVKeO.js → ja-BPCCKkW4.js} +1 -1
- package/dist/assets/{ko-Nk_6p6Jl.js → ko-Wbe93sio.js} +1 -1
- package/dist/assets/{landing-page-Dc4hRNuW.js → landing-page-DYuzaUFl.js} +1 -1
- package/dist/assets/{launch-result-message-C7170Bvt.js → launch-result-message-DDqxU5ge.js} +1 -1
- package/dist/assets/{layout-BGLUR5z_.js → layout-SbmsTmT-.js} +1 -1
- package/dist/assets/{list-X2F1RKzQ.js → list-9fyAFvMO.js} +1 -1
- package/dist/assets/{list-DgH58u4D.js → list-DtmR-6Z4.js} +2 -2
- package/dist/assets/{list-header-X0CL-_hO.js → list-header-BDPLDqO-.js} +1 -1
- package/dist/assets/localization-Bi90G6aS.js +1 -0
- package/dist/assets/{log-EgLjQcxJ.js → log-DvCqrgCp.js} +1 -1
- package/dist/assets/logger-DoOuw4D6.js +1 -0
- package/dist/assets/{login-BrQzzFXX.js → login-BVFzm3Co.js} +1 -1
- package/dist/assets/{login-oauth-callback-DaVwf7V2.js → login-oauth-callback-CMSYGfid.js} +1 -1
- package/dist/assets/{logo-uploader-DgSolZrp.js → logo-uploader-BshflYAa.js} +2 -2
- package/dist/assets/{lost-passport-DEW2BulR.js → lost-passport-CaPo9QEu.js} +1 -1
- package/dist/assets/{observability-DVi-zwiF.js → observability-C5Y6fafw.js} +1 -1
- package/dist/assets/{omit-8QDODHip.js → omit-DDVAqzZq.js} +1 -1
- package/dist/assets/{open-window-CcbW4k1o.js → open-window-BH5dHcbl.js} +1 -1
- package/dist/assets/{over-due-invoice-payment-Ba3rEZjM.js → over-due-invoice-payment-BA9fs62q.js} +1 -1
- package/dist/assets/{overview-CS6bfsq0.js → overview-CHn4eBUK.js} +1 -1
- package/dist/assets/{page-header-1pVKKoSa.js → page-header-B9Q5ZOnJ.js} +1 -1
- package/dist/assets/{passport-item-BniPqqnO.js → passport-item-CqfuHfH-.js} +1 -1
- package/dist/assets/{permission-w0BesrB_.js → permission-BVTxHNeQ.js} +1 -1
- package/dist/assets/{playground-CveQRqPB.js → playground-DUuQxqZF.js} +1 -1
- package/dist/assets/preferences--2YETF2t.js +1 -0
- package/dist/assets/profile-embed-BPQR6Tpe.js +1 -0
- package/dist/assets/{pt-C-JzkWqR.js → pt-C1fHGXQk.js} +1 -1
- package/dist/assets/publish-resource-qtIS1W3s.js +1 -0
- package/dist/assets/{react-beautiful-dnd.esm-CdYP6hjZ.js → react-beautiful-dnd.esm-DY5UIQEa.js} +1 -1
- package/dist/assets/{react-stripe.esm-3alxb6kT.js → react-stripe.esm-DlCFj5cL.js} +1 -1
- package/dist/assets/{required-qTx6pgJa.js → required-mwCee7dE.js} +1 -1
- package/dist/assets/{ru-DR6is0tr.js → ru-DJ3aNml8.js} +1 -1
- package/dist/assets/{runtime-CYnDo-HU.js → runtime-WLtCIkiy.js} +1 -1
- package/dist/assets/{sanitize-BSjwjSMl.js → sanitize-d0BswqQy.js} +1 -1
- package/dist/assets/sdk-CrmCUSu6.js +1 -0
- package/dist/assets/{section-DLNNkzJC.js → section-DkbgrVvQ.js} +1 -1
- package/dist/assets/{security-DLgKehuW.js → security-D5f09NAi.js} +3 -3
- package/dist/assets/{session-Ci_4G0CP.js → session-CJYcrokL.js} +1 -1
- package/dist/assets/setup-chjxGOpx.js +30 -0
- package/dist/assets/{shorten-label-C8Cay9FW.js → shorten-label-CzJmma8P.js} +1 -1
- package/dist/assets/{simple-select-DCCkM3zE.js → simple-select-WHx-v2hU.js} +1 -1
- package/dist/assets/{spaces-C1LV9UvU.js → spaces-B0VryU-h.js} +1 -1
- package/dist/assets/{start-CaaDhsmK.js → start-DdQSLbG1.js} +1 -1
- package/dist/assets/{starting-progress-4SearER_.js → starting-progress-BOAJA87-.js} +1 -1
- package/dist/assets/{status-BeqBWyAi.js → status-3ePg3iDr.js} +1 -1
- package/dist/assets/{step-actions-C8wc4rOR.js → step-actions-JxTPDo-C.js} +1 -1
- package/dist/assets/{studio-C-1N3D23.js → studio-BpropsaK.js} +1 -1
- package/dist/assets/{switch-control-Cd3JbWWV.js → switch-control-C3A7Bzd7.js} +1 -1
- package/dist/assets/{table-tips-3_n5uR-X.js → table-tips-BqAxYXjm.js} +1 -1
- package/dist/assets/{team-CD3vKVPJ.js → team-DL-1lYRh.js} +5 -5
- package/dist/assets/{th-Cn3755Vi.js → th-C22KCFdo.js} +1 -1
- package/dist/assets/{traffic-h7MLT42d.js → traffic-TO0gOocP.js} +1 -1
- package/dist/assets/{transfer-BgDlNRZV.js → transfer-y-ql-f3C.js} +1 -1
- package/dist/assets/{unsubscribe-DmHvwVjR.js → unsubscribe-ysldRIx6.js} +1 -1
- package/dist/assets/{use-mobile-B9FM-UBY.js → use-mobile-D0T_V7RQ.js} +1 -1
- package/dist/assets/{use-mobile-BC9t6zmM.js → use-mobile-IWOBvgsY.js} +1 -1
- package/dist/assets/{use-promise-window-open-ecxT8x1I.js → use-promise-window-open-C5suxy-U.js} +1 -1
- package/dist/assets/{use-server-logo-xLbI9v7G.js → use-server-logo-CUO3ZK3W.js} +1 -1
- package/dist/assets/{use-window-close-CleYtwbz.js → use-window-close-RhOoosk-.js} +1 -1
- package/dist/assets/{useAsync-BdgUavMa.js → useAsync-CQhKDImp.js} +1 -1
- package/dist/assets/{useAsync-DgPr_To1.js → useAsync-VHQLt8EO.js} +1 -1
- package/dist/assets/{useLocalStorage-Dgwq5dGM.js → useLocalStorage-DIjnXt7A.js} +1 -1
- package/dist/assets/user-center-B-cbZnEv.js +126 -0
- package/dist/assets/{user-sessions-D9ZCFiu3.js → user-sessions-0TRZeeJ5.js} +1 -1
- package/dist/assets/{util-CJadXi8V.js → util-CZwlQQjD.js} +1 -1
- package/dist/assets/{util-Bgqx2flh.js → util-h89lj_Gk.js} +1 -1
- package/dist/assets/{vendor-arcblock-BnbwP1kf.js → vendor-arcblock-CY7eM47O.js} +1 -1
- package/dist/assets/{vendor-hooks-DTeIFVkk.js → vendor-hooks-B2bT6Nqf.js} +1 -1
- package/dist/assets/{vendor-mui-core-CcrDM-5l.js → vendor-mui-core-Bw-IjQ9m.js} +1 -1
- package/dist/assets/{vendor-mui-x-BVRWKjdg.js → vendor-mui-x-tGuaJHw_.js} +14 -14
- package/dist/assets/{vendor-utils-BOkrEpKO.js → vendor-utils-B4mliPf7.js} +1 -1
- package/dist/assets/{vendor-ux-CUBj5GXM.js → vendor-ux-e4SIahY6.js} +2 -2
- package/dist/assets/{vi-7MIaoDt9.js → vi-D_AWh4Q3.js} +1 -1
- package/dist/assets/{wait-connect-Cht9WKDH.js → wait-connect-DrZC6ybw.js} +1 -1
- package/dist/assets/wrap-locale-vvkgV_w9.js +1 -0
- package/dist/assets/{zh-DswrR4Lx.js → zh-ZjW3xV_P.js} +1 -1
- package/dist/assets/{zh-DOMhcyY9.js → zh-mA44AG8z.js} +1 -1
- package/dist/assets/{zh-tw-De_IfliP.js → zh-tw-BuqwZI-0.js} +1 -1
- package/dist/index.html +6 -6
- package/dist/service-worker.js +1 -1
- package/package.json +33 -32
- package/dist/assets/aigne-CO_-YbPk.js +0 -10
- package/dist/assets/api-Rnh95Dt4.js +0 -1
- package/dist/assets/authorize-u1RPtGlb.js +0 -1
- package/dist/assets/button-CPgviFPs.js +0 -1
- package/dist/assets/config-Dh0hZZiY.js +0 -26
- package/dist/assets/dashboard-VE3KX6Hk.js +0 -106
- package/dist/assets/domains-BsCL1ViY.js +0 -1
- package/dist/assets/engine-Ch-5kOUZ.js +0 -1
- package/dist/assets/get-safe-url-oiWXWYvc.js +0 -1
- package/dist/assets/index-Bgm1cW2N.js +0 -124
- package/dist/assets/index-BwxOZ_PS.js +0 -1
- package/dist/assets/invite-NVVbFYlq.js +0 -1
- package/dist/assets/issue-passport-7Rfhc8hs.js +0 -1
- package/dist/assets/localization-sp8DBpxc.js +0 -1
- package/dist/assets/logger-MoQC3rmC.js +0 -1
- package/dist/assets/preferences-YUKuGDai.js +0 -1
- package/dist/assets/profile-embed-D8T7nOel.js +0 -1
- package/dist/assets/publish-resource-DAqbWOIX.js +0 -1
- package/dist/assets/sdk-DAF46Tln.js +0 -1
- package/dist/assets/setup-Cq1C8BeD.js +0 -30
- package/dist/assets/user-center-Cveaoeez.js +0 -126
- package/dist/assets/wrap-locale-B4B-XHcF.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{T as X,H as O,I as Y,a4 as Re,a5 as Ue,a6 as Ee,a7 as We,b as G,X as ge,a as ve,j as Ve,n as R,a8 as Me,J as _e,G as Ne,h as Te}from"./vendor-ux-CUBj5GXM.js";import{b as u,a as H,g as oe,c as $e}from"./vendor-hooks-DTeIFVkk.js";import{r as C}from"./vendor-react-Dvs43sk9.js";import{j as e,ak as r,b6 as A,am as le,y as B,z as F,Q as V,T as K,I as ae,a3 as se,W as U,b1 as W,ca as Ie,cg as qe,c9 as He,at as De,D as ke,ah as Fe,cD as Be,a6 as je,cE as Je,a$ as Ze}from"./vendor-mui-core-CcrDM-5l.js";import{U as N,a1 as M,b8 as ne,c as be,b2 as Ge,aN as Ke,R as Qe,T as Ye}from"./index-FrAYP-A_.js";import{A as Z,Q as Xe,b as ce,Z as et,n as Q,$ as tt,C as nt,a as st}from"./vendor-utils-BOkrEpKO.js";import{u as ee,C as k,a as Le}from"./index.esm-JPZAjt0x.js";import{S as ie}from"./switch-control-Cd3JbWWV.js";import{S as y}from"./section-DLNNkzJC.js";import{d as ot}from"./keyboard-arrow-down-rounded-8U0_i9QO.js";import{u as it}from"./index-CkuzlAat.js";import{v as rt}from"./index-DEDOywis.js";import{r as at}from"./base32-B9yl211y.js";import"./index-Cq-4YOTs.js";import{u as lt}from"./use-mobile-B9FM-UBY.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-BnbwP1kf.js";import"./required-qTx6pgJa.js";const ye={width:24,height:24,body:'<path fill="currentColor" d="M5 4v16V4v5v-5Zm3 10h2.675q.275-.575.638-1.075t.812-.925H8q-.425 0-.713.288T7 13q0 .425.288.713T8 14Zm0 4h2.075Q10 17.5 10 17t.075-1H8q-.425 0-.713.288T7 17q0 .425.288.713T8 18Zm-3 4q-.825 0-1.413-.588T3 20V4q0-.825.588-1.413T5 2h7.175q.4 0 .763.15t.637.425l4.85 4.85q.275.275.425.638t.15.762V10.3q-.475-.15-.975-.225T17 10V9h-4q-.425 0-.713-.288T12 8V4H5v16h5.675q.275.575.638 1.075t.812.925H5Zm12-10q2.075 0 3.538 1.463T22 17q0 2.075-1.463 3.538T17 22q-2.075 0-3.538-1.463T12 17q0-2.075 1.463-3.538T17 12Zm0 8q.275 0 .463-.188t.187-.462q0-.275-.187-.463T17 18.7q-.275 0-.463.188t-.187.462q0 .275.188.463T17 20Zm0-6q-.475 0-.875.238t-.65.637q-.1.15-.025.313t.25.237q.15.075.3 0t.275-.2q.125-.175.313-.275t.412-.1q.325 0 .563.213t.237.537q0 .275-.15.463t-.35.387q-.15.15-.313.3t-.287.35q-.075.15-.113.313t-.037.337q0 .225.125.413t.325.187q.2 0 .325-.15t.125-.35q0-.275.15-.488t.35-.412q.3-.275.525-.613t.225-.737q0-.675-.5-1.138T17 14Z"/>'},de={enabled:!1,domain:"",clientId:"",clientSecret:""};function ct(){const{api:b}=N(),{blocklet:c}=M(),{t,locale:n}=X(),o=c?.meta?.did,a=Object.assign({...de},c?.settings?.oauth?.auth0||{}),{handleSubmit:x,control:i,formState:p,watch:d,reset:f}=ee({defaultValues:Z(a,Object.keys(de))}),l=d("enabled"),j=u(async s=>{try{const{blocklet:I}=await b.configOAuth({input:{did:o,oauth:JSON.stringify({auth0:s})}}),L=Object.assign({...de},I?.settings?.oauth?.auth0||{});f(L),O.success(t("oauth.saveSuccess"))}catch(I){O.error(I.message||t("oauth.saveFailed"))}}),v=u(s=>s?.trim()?!0:t("oauth.auth0.domainDescription")),S=u(s=>s?.trim()?!0:t("oauth.auth0.clientIdDescription")),g=u(s=>s?.trim()?!0:t("oauth.auth0.clientSecretDescription")),w=u(()=>!0),h=H(()=>n==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-auth0":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-auth0",[n]);return e.jsx(r,{children:e.jsxs("form",{onSubmit:x(j),disabled:!0,children:[e.jsx(y,{title:e.jsxs(r,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx("span",{children:t("oauth.auth0.enable")}),e.jsx(le,{title:t("oauth.viewDocument"),children:e.jsx(r,{component:"a",sx:{display:"inline-block",color:"inherit",fontSize:0,lineHeight:1},href:h,target:"_blank",rel:"noreferrer",children:e.jsx(Y,{icon:ye,fontSize:20})})})]}),mb:2.5,children:e.jsx(k,{name:"enabled",control:i,render:({field:s})=>e.jsx(A,{control:e.jsx(ie,{sx:{ml:1},checked:s.value,...s})})})}),e.jsx(y,{title:t("oauth.auth0.domain"),children:e.jsx(k,{name:"domain",control:i,rules:{validate:l?v:w},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.auth0.domain"),error:!!p.errors[s.name],helperText:p.errors[s.name]?.message||" ",disabled:!l})})})}),e.jsx(y,{title:t("oauth.auth0.clientId"),children:e.jsx(k,{name:"clientId",control:i,rules:{validate:l?S:w},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.auth0.clientId"),error:!!p.errors[s.name],helperText:p.errors[s.name]?.message||" ",disabled:!l})})})}),e.jsx(y,{title:t("oauth.auth0.clientSecret"),children:e.jsx(k,{name:"clientSecret",control:i,rules:{validate:l?g:w},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",type:"password",label:t("oauth.auth0.clientSecret"),error:!!p.errors[s.name],helperText:p.errors[s.name]?.message||" ",disabled:!l})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:x(j),disabled:!p.isDirty,children:t("oauth.save")})]})})}const ue={enabled:!1,clientId:"",clientSecret:""};function dt(){const{api:b}=N(),{blocklet:c}=M(),{t,locale:n}=X(),o=c?.meta?.did,a=Object.assign({...ue},c?.settings?.oauth?.github||{}),{handleSubmit:x,control:i,formState:p,watch:d,reset:f}=ee({defaultValues:Z(a,Object.keys(ue))}),l=d("enabled"),j=u(async h=>{try{const{blocklet:s}=await b.configOAuth({input:{did:o,oauth:JSON.stringify({github:h})}}),I=Object.assign({...ue},s?.settings?.oauth?.github||{});f(I),O.success(t("oauth.saveSuccess"))}catch(s){O.error(s.message||t("oauth.saveFailed"))}}),v=u(h=>h?.trim()?!0:t("oauth.github.clientIdDescription")),S=u(h=>h?.trim()?!0:t("oauth.github.clientSecretDescription")),g=u(()=>!0),w=H(()=>n==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-github":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-github",[n]);return e.jsx(r,{children:e.jsxs("form",{onSubmit:x(j),disabled:!0,children:[e.jsx(y,{title:e.jsxs(r,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx("span",{children:t("oauth.github.enable")}),e.jsx(le,{title:t("oauth.viewDocument"),children:e.jsx(r,{component:"a",sx:{display:"inline-block",color:"inherit",fontSize:0,lineHeight:1},href:w,target:"_blank",rel:"noreferrer",children:e.jsx(Y,{icon:ye,fontSize:20})})})]}),mb:2.5,sx:{"& .section-content":{alignItems:"center"}},children:e.jsx(k,{name:"enabled",control:i,sx:{alignItems:"center"},render:({field:h})=>e.jsx(A,{control:e.jsx(ie,{sx:{ml:1},size:"small",checked:h.value,...h})})})}),e.jsx(y,{title:t("oauth.github.clientId"),children:e.jsx(k,{name:"clientId",control:i,rules:{validate:l?v:g},render:({field:h})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...h,size:"small",label:t("oauth.github.clientId"),error:!!p.errors[h.name],helperText:p.errors[h.name]?.message||" ",disabled:!l})})})}),e.jsx(y,{title:t("oauth.github.clientSecret"),children:e.jsx(k,{name:"clientSecret",control:i,rules:{validate:l?S:g},render:({field:h})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...h,size:"small",type:"password",label:t("oauth.github.clientSecret"),error:!!p.errors[h.name],helperText:p.errors[h.name]?.message||" ",disabled:!l})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:x(j),disabled:!p.isDirty,children:t("oauth.save")})]})})}const he={enabled:!1,clientId:"",clientSecret:""};function ut(){const{api:b}=N(),{blocklet:c}=M(),{t,locale:n}=X(),o=c?.meta?.did,a=Object.assign({...he},c?.settings?.oauth?.google||{}),{handleSubmit:x,control:i,formState:p,watch:d,reset:f}=ee({defaultValues:Z(a,Object.keys(he))}),l=d("enabled"),j=u(async h=>{try{const{blocklet:s}=await b.configOAuth({input:{did:o,oauth:JSON.stringify({google:h})}}),I=Object.assign({...he},s?.settings?.oauth?.google||{});f(I),O.success(t("oauth.saveSuccess"))}catch(s){O.error(s.message||t("oauth.saveFailed"))}}),v=u(h=>h?.trim()?!0:t("oauth.google.clientIdDescription")),S=u(h=>h?.trim()?!0:t("oauth.google.clientSecretDescription")),g=u(()=>!0),w=H(()=>n==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-google":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-google",[n]);return e.jsx(r,{children:e.jsxs("form",{onSubmit:x(j),disabled:!0,children:[e.jsx(y,{title:e.jsxs(r,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx("span",{children:t("oauth.google.enable")}),e.jsx(le,{title:t("oauth.viewDocument"),children:e.jsx(r,{component:"a",sx:{display:"inline-block",color:"inherit",fontSize:0,lineHeight:1},href:w,target:"_blank",rel:"noreferrer",children:e.jsx(Y,{icon:ye,fontSize:20})})})]}),mb:2.5,children:e.jsx(k,{name:"enabled",control:i,render:({field:h})=>e.jsx(A,{control:e.jsx(ie,{sx:{ml:1},checked:h.value,...h})})})}),e.jsx(y,{title:t("oauth.google.clientId"),children:e.jsx(k,{name:"clientId",control:i,rules:{validate:l?v:g},render:({field:h})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...h,size:"small",label:t("oauth.google.clientId"),error:!!p.errors[h.name],helperText:p.errors[h.name]?.message||" ",disabled:!l})})})}),e.jsx(y,{title:t("oauth.google.clientSecret"),children:e.jsx(k,{name:"clientSecret",control:i,rules:{validate:l?S:g},render:({field:h})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...h,size:"small",type:"password",label:t("oauth.google.clientSecret"),error:!!p.errors[h.name],helperText:p.errors[h.name]?.message||" ",disabled:!l})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:x(j),disabled:!p.isDirty,children:t("oauth.save")})]})})}const me={enabled:!1,teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function ht(){const{api:b}=N(),{blocklet:c}=M(),{t}=X(),n=c?.meta?.did,o=Object.assign({...me},c?.settings?.oauth?.apple||{}),{handleSubmit:a,control:x,formState:i,watch:p,reset:d}=ee({defaultValues:Z(o,Object.keys(me))}),f=p("enabled"),l=u(async s=>{try{const{blocklet:I}=await b.configOAuth({input:{did:n,oauth:JSON.stringify({apple:s})}}),L=Object.assign({...me},I?.settings?.oauth?.apple||{});d(L),O.success(t("oauth.saveSuccess"))}catch(I){O.error(I.message||t("oauth.saveFailed"))}}),j=u(s=>s?.trim()?!0:t("oauth.apple.teamIdDescription")),v=u(s=>s?.trim()?!0:t("oauth.apple.serviceIdDescription")),S=u(s=>s?.trim()?!0:t("oauth.apple.keyIdDescription")),g=u(s=>s?.trim()?!0:t("oauth.apple.authKeyDescription")),w=u(s=>s?.trim()?!0:t("oauth.apple.bundleIdDescription")),h=u(()=>!0);return e.jsx(r,{children:e.jsxs("form",{onSubmit:a(l),disabled:!0,children:[e.jsx(y,{title:t("oauth.apple.enable"),mb:2.5,children:e.jsx(k,{name:"enabled",control:x,render:({field:s})=>e.jsx(A,{control:e.jsx(ie,{sx:{ml:1},checked:s.value,...s})})})}),e.jsx(y,{title:t("oauth.apple.teamId"),children:e.jsx(k,{name:"teamId",control:x,rules:{validate:f?j:h},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.apple.teamId"),error:!!i.errors[s.name],helperText:i.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.apple.bundleId"),children:e.jsx(k,{name:"bundleId",control:x,rules:{validate:f?w:h},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.apple.bundleId"),error:!!i.errors[s.name],helperText:i.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.apple.serviceId"),children:e.jsx(k,{name:"serviceId",control:x,rules:{validate:f?v:h},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.apple.serviceId"),error:!!i.errors[s.name],helperText:i.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.apple.keyId"),children:e.jsx(k,{name:"keyId",control:x,rules:{validate:f?S:h},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.apple.keyId"),error:!!i.errors[s.name],helperText:i.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.apple.authKey"),children:e.jsx(k,{name:"authKey",control:x,rules:{validate:f?g:h},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",type:"password",label:t("oauth.apple.authKey"),multiline:!0,rows:4,error:!!i.errors[s.name],helperText:i.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:a(l),disabled:!i.isDirty,children:t("oauth.save")})]})})}const pe={enabled:!1,clientId:"",clientSecret:""};function mt(){const{api:b}=N(),{blocklet:c}=M(),{t}=X(),n=c?.meta?.did,o=Object.assign({...pe},c?.settings?.oauth?.twitter||{}),{handleSubmit:a,control:x,formState:i,watch:p,reset:d}=ee({defaultValues:Z(o,Object.keys(pe))}),f=p("enabled"),l=u(async g=>{try{const{blocklet:w}=await b.configOAuth({input:{did:n,oauth:JSON.stringify({twitter:g})}}),h=Object.assign({...pe},w?.settings?.oauth?.twitter||{});d(h),O.success(t("oauth.saveSuccess"))}catch(w){O.error(w.message||t("oauth.saveFailed"))}}),j=u(g=>g?.trim()?!0:t("oauth.twitter.clientIdDescription")),v=u(g=>g?.trim()?!0:t("oauth.twitter.clientSecretDescription")),S=u(()=>!0);return e.jsx(r,{children:e.jsxs("form",{onSubmit:a(l),disabled:!0,children:[e.jsx(y,{title:e.jsx(r,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsx("span",{children:t("oauth.twitter.enable")})}),mb:2.5,sx:{"& .section-content":{alignItems:"center"}},children:e.jsx(k,{name:"enabled",control:x,sx:{alignItems:"center"},render:({field:g})=>e.jsx(A,{control:e.jsx(ie,{sx:{ml:1},size:"small",checked:g.value,...g})})})}),e.jsx(y,{title:t("oauth.twitter.clientId"),children:e.jsx(k,{name:"clientId",control:x,rules:{validate:f?j:S},render:({field:g})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...g,size:"small",label:t("oauth.twitter.clientId"),error:!!i.errors[g.name],helperText:i.errors[g.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.twitter.clientSecret"),children:e.jsx(k,{name:"clientSecret",control:x,rules:{validate:f?v:S},render:({field:g})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...g,size:"small",type:"password",label:t("oauth.twitter.clientSecret"),error:!!i.errors[g.name],helperText:i.errors[g.name]?.message||" ",disabled:!f})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:a(l),disabled:!i.isDirty,children:t("oauth.save")})]})})}const pt={width:24,height:24,body:'<path fill="currentColor" d="M9 20q-.825 0-1.413-.588T7 18q0-.825.588-1.413T9 16q.825 0 1.413.588T11 18q0 .825-.588 1.413T9 20Zm6 0q-.825 0-1.413-.588T13 18q0-.825.588-1.413T15 16q.825 0 1.413.588T17 18q0 .825-.588 1.413T15 20Zm-6-6q-.825 0-1.413-.588T7 12q0-.825.588-1.413T9 10q.825 0 1.413.588T11 12q0 .825-.588 1.413T9 14Zm6 0q-.825 0-1.413-.588T13 12q0-.825.588-1.413T15 10q.825 0 1.413.588T17 12q0 .825-.588 1.413T15 14ZM9 8q-.825 0-1.413-.588T7 6q0-.825.588-1.413T9 4q.825 0 1.413.588T11 6q0 .825-.588 1.413T9 8Zm6 0q-.825 0-1.413-.588T13 6q0-.825.588-1.413T15 4q.825 0 1.413.588T17 6q0 .825-.588 1.413T15 8Z"/>'};function Oe({id:b,title:c,children:t,index:n,onMove:o,defaultExpand:a=!1,onEnd:x,icon:i=null}){const[p,d]=C.useState(a),f=C.useRef(null),l=C.useRef(null),[{handlerId:j},v]=Re({accept:"dragItem",collect(s){return{handlerId:s.getHandlerId()}},hover(s,I){if(!f.current)return;const L=s.index,m=n;if(L===m)return;const P=f.current?.getBoundingClientRect(),_=l.current?.getBoundingClientRect(),re=(_.bottom-_.top)/2,$=I.getClientOffset().y-P.top;L<m&&$<re||L>m&&$>re||(o(L,m),s.index=m)}}),[{isDragging:S},g]=Ue({item:{index:n,type:"dragItem"},collect:s=>({isDragging:s.isDragging()}),end:x});g(l),v(f);const w=S?.5:1,h=u(s=>{s.preventDefault(),s.stopPropagation(),d(!p)});return e.jsxs(r,{ref:f,children:[e.jsxs(r,{sx:{cursor:"pointer","&:hover":{backgroundColor:"grey.100"}},ref:l,"data-handler-id":j,children:[e.jsxs(r,{sx:{py:2,px:1,opacity:w,display:"flex",alignItems:"center",gap:.5},draggable:!1,onClick:h,children:[e.jsx(r,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:"text.hint","&:hover":{color:"text.secondary"}},children:e.jsx(Y,{fontSize:20,icon:pt})}),e.jsx(r,{sx:{display:"flex",alignItems:"center",flexShrink:0,mr:.5,transform:"translateY(-1px)"},children:i}),e.jsx(K,{sx:{flex:1},children:c}),e.jsx(ae,{size:"small",sx:{pointerEvents:"auto",transform:p?"":"rotate(180deg)",transition:"transform 0.3s ease"},children:e.jsx(Y,{icon:ot,style:{transform:"scale(1.5)"}})})]}),e.jsx(se,{})]}),e.jsx(r,{sx:{pl:4,py:2.5,display:p?"block":"none"},children:t})]})}Oe.propTypes={title:U.string.isRequired,id:U.string.isRequired,children:U.node.isRequired,index:U.number.isRequired,onMove:U.func.isRequired,onEnd:U.func.isRequired,defaultExpand:U.bool,icon:U.any};const xt=[{name:"github",title:"GitHub",icon:e.jsx(ne,{provider:"github",sx:{width:20,height:20}}),component:e.jsx(dt,{})},{name:"google",title:"Google",icon:e.jsx(ne,{provider:"google",sx:{width:20,height:20}}),component:e.jsx(ut,{})},{name:"apple",title:"Apple",icon:e.jsx(ne,{provider:"apple",sx:{width:20,height:20}}),component:e.jsx(ht,{})},{name:"twitter",title:"Twitter",icon:e.jsx(ne,{provider:"twitter",sx:{width:20,height:20}}),component:e.jsx(mt,{})},{name:"auth0",title:"Auth0",icon:e.jsx(ne,{provider:"auth0",sx:{width:20,height:20}}),component:e.jsx(ct,{})}],ft=["github","google","apple","twitter","auth0"];function gt(){const{api:b}=N(),{blocklet:c}=M(),t=c?.meta?.did,n=c?.settings?.oauth||{},o=Object.keys(n).sort((l,j)=>n[l]?.order!==void 0&&n[j]?.order!==void 0?n[l].order-n[j].order:n[l]?.order!==void 0?-1:1);for(const l of ft)o.includes(l)||o.push(l);const a=oe(o.reduce((l,j,v)=>Object.assign(l,{[j]:v}),{})),x=H(()=>{const l=[...xt];return l.sort((j,v)=>a[j.name]-a[v.name]),l.map(j=>({...j,enabled:n[j.name]?.enabled??!1}))},[a.auth0,a.github,a.google]),i={};typeof window<"u"&&(i.context=window);const p=u(async l=>{const j={};Object.keys(l).forEach(v=>{j[v]={order:l[v]}}),await b.configOAuth({input:{did:t,oauth:JSON.stringify(j)}})}),d=u((l,j)=>{const v=x[l],S=x[j];a[v.name]=j,a[S.name]=l}),f=u(async()=>{await p(a)});return e.jsx(r,{sx:{".section-left":{width:"180px"}},children:e.jsx(Ee,{backend:We,...i,children:x.map((l,j)=>e.jsx(Oe,{index:j,id:l.name,title:l.title,icon:l.icon,onMove:d,onEnd:f,defaultExpand:l.enabled,children:l.component},l.name))})})}const J={ttl:be.SESSION_TTL,cacheTtl:be.SESSION_CACHE_TTL,email:{enabled:!1,requireVerified:!1,requireUnique:!1,trustOauthProviders:!1,trustedIssuers:[],enableDomainBlackList:!1,domainBlackList:[],enableDomainWhiteList:!1,domainWhiteList:[]},phone:{enabled:!1,requireVerified:!1,requireUnique:!1,regionBlackList:[],trustedIssuers:[]},enableBlacklist:!1};function E(b){return e.jsx(it,{...b,sx:{transform:"scale(0.75)"}})}function xe(b,c=!1){const t=c?b.ttl*86400:b.ttl/86400;return{...b,ttl:t}}function jt(){const{api:b}=N(),{blocklet:c}=M(),t=c?.meta?.did,n=Xe({},J,c?.settings?.session||{});ce(n.ttl)&&(n.ttl=J.ttl),ce(n.cacheTtl)&&(n.cacheTtl=J.cacheTtl),n.phone||(n.phone=J.phone),n.email||(n.email=J.email),ce(n.enableBlacklist)&&(n.enableBlacklist=J.enableBlacklist);const{handleSubmit:o,control:a,formState:x,reset:i,watch:p}=ee({defaultValues:Z(xe(n),["ttl","cacheTtl","email","phone","enableBlacklist"])}),{t:d}=X(),f=p("email.enabled"),l=p("phone.enabled"),j=p("email.enableDomainBlackList"),v=p("email.enableDomainWhiteList"),{fields:S,append:g,remove:w}=Le({control:a,name:"email.domainBlackList"}),{fields:h,append:s,remove:I}=Le({control:a,name:"email.domainWhiteList"}),L=u(async m=>{try{const{blocklet:P}=await b.updateAppSessionConfig({input:{did:t,config:et(xe(m,!0),["phone"])}}),_=Object.assign({},J,Z(P?.settings?.session||{},["ttl","cacheTtl","email","phone","enableBlacklist"]));i(xe(_)),O.success(d("common.configSuccess"))}catch(P){O.error(P.message)}});return e.jsx(bt,{onSubmit:o(L),children:e.jsxs(W,{direction:"column",sx:{gap:6},children:[e.jsxs(r,{children:[e.jsxs(r,{children:[e.jsx(K,{variant:"h6",sx:{fontWeight:600},children:d("blocklet.config.session.profile")}),e.jsx(r,{component:se,sx:{my:3}})]}),e.jsxs(W,{sx:{gap:2},children:[e.jsx(y,{title:d("blocklet.config.session.fullNameEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(r,{sx:{alignSelf:"flex-start"},children:e.jsx(E,{disabled:!0,checked:!0})})}),e.jsx(y,{title:d("blocklet.config.session.avatarEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(r,{sx:{alignSelf:"flex-start"},children:e.jsx(E,{disabled:!0,checked:!0})})}),e.jsx(y,{title:d("blocklet.config.session.emailEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(r,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.enabled",control:a,render:({field:m})=>e.jsx(E,{...m,checked:m.value})})})}),f&&e.jsxs(W,{direction:"column",sx:{ml:2},children:[e.jsx(y,{title:d("blocklet.config.session.emailRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(r,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.requireVerified",control:a,render:({field:m})=>e.jsx(A,{sx:{mt:1},control:e.jsx(E,{...m,checked:m.value})})})})}),e.jsx(y,{title:d("blocklet.config.session.emailRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(r,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.requireUnique",control:a,render:({field:m})=>e.jsx(A,{sx:{mt:1},control:e.jsx(E,{...m,checked:m.value})})})})}),e.jsx(y,{title:d("blocklet.config.session.emailTrustOauthProviders"),sectionLeftSx:{width:"600px"},children:e.jsx(r,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.trustOauthProviders",control:a,render:({field:m})=>e.jsx(A,{sx:{mt:1},control:e.jsx(E,{...m,checked:m.value})})})})}),e.jsx(y,{title:d("blocklet.config.session.enableDomainBlackList"),sectionLeftSx:{width:"600px"},children:e.jsx(r,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.enableDomainBlackList",control:a,render:({field:m})=>e.jsx(A,{sx:{mt:1},control:e.jsx(E,{...m,checked:m.value})})})})}),j&&e.jsxs(r,{children:[S.map((m,P)=>e.jsxs(W,{direction:"row",sx:{alignItems:"center",my:1,maxWidth:"720px"},children:[e.jsx(k,{name:`email.domainBlackList.${P}`,control:a,render:_=>e.jsx(F,{..._.field,size:"small",fullWidth:!0})}),e.jsx(ae,{onClick:()=>w(P),children:e.jsx(Ie,{})})]},m.id)),e.jsx(V,{startIcon:e.jsx(qe,{}),onClick:()=>g(""),children:d("blocklet.config.session.addDomain")})]}),e.jsx(y,{title:d("blocklet.config.session.enableDomainWhiteList"),sectionLeftSx:{width:"600px"},children:e.jsx(r,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.enableDomainWhiteList",control:a,render:({field:m})=>e.jsx(A,{sx:{mt:1},control:e.jsx(E,{...m,checked:m.value})})})})}),v&&e.jsxs(r,{children:[h.map((m,P)=>e.jsxs(W,{direction:"row",sx:{alignItems:"center",my:1,maxWidth:"720px"},children:[e.jsx(k,{name:`email.domainWhiteList.${P}`,control:a,render:_=>e.jsx(F,{..._.field,size:"small",fullWidth:!0})}),e.jsx(ae,{onClick:()=>I(P),children:e.jsx(Ie,{})})]},m.id)),e.jsx(V,{startIcon:e.jsx(qe,{}),onClick:()=>s(""),children:d("blocklet.config.session.addDomain")})]})]}),e.jsxs(r,{sx:{display:"none"},children:[e.jsx(y,{title:d("blocklet.config.session.phoneEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(r,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"phone.enabled",control:a,disabled:!0,render:({field:m})=>e.jsx(A,{sx:{mt:1},control:e.jsx(E,{...m,checked:m.value})})})})}),l&&e.jsxs(W,{direction:"column",sx:{ml:2,mt:1},children:[e.jsx(y,{title:d("blocklet.config.session.phoneRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(r,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"phone.requireVerified",control:a,render:({field:m})=>e.jsx(A,{control:e.jsx(E,{...m,checked:m.value})})})})}),e.jsx(y,{title:d("blocklet.config.session.phoneRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(r,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"phone.requireUnique",control:a,render:({field:m})=>e.jsx(A,{control:e.jsx(E,{...m,checked:m.value})})})})})]})]})]})]}),e.jsxs(r,{children:[e.jsx(K,{variant:"h6",sx:{fontWeight:600},children:d("blocklet.config.session.period")}),e.jsx(r,{component:se,sx:{my:3}}),e.jsx(W,{direction:"column",spacing:2,children:e.jsx(k,{name:"ttl",control:a,rules:{min:1,max:30},render:({field:m})=>e.jsx(B,{fullWidth:!0,sx:{mb:2},children:e.jsx(y,{title:d("blocklet.config.session.ttl",{day:m.value}),sectionLeftSx:{width:"600px"},children:e.jsx(r,{sx:{width:"100%",maxWidth:500,px:1.5},children:e.jsx(He,{...m,defaultValue:7,step:1,marks:[{value:1,label:d("blocklet.config.session.day",{day:1})},{value:7,label:d("blocklet.config.session.days",{day:7})},{value:14,label:d("blocklet.config.session.days",{day:14})},{value:21,label:d("blocklet.config.session.days",{day:21})},{value:30,label:d("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto"})})})})})})]}),e.jsxs(r,{children:[e.jsx(K,{variant:"h6",sx:{fontWeight:600},children:d("blocklet.config.session.experimentalSettings")}),e.jsx(r,{component:se,sx:{my:3}}),e.jsx(W,{direction:"column",spacing:2,children:e.jsx(y,{title:d("blocklet.config.session.enableBlacklist"),sectionLeftSx:{width:"600px"},children:e.jsx(r,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"enableBlacklist",control:a,render:({field:m})=>e.jsx(A,{sx:{mt:1},control:e.jsx(E,{...m,checked:m.value})})})})})})]}),e.jsx(r,{children:e.jsx(V,{type:"submit",variant:"contained",disabled:!x.isDirty,children:d("oauth.save")})})]})})}const bt=De.form`
|
|
1
|
+
import{T as X,H as O,I as Y,a4 as Re,a5 as Ue,a6 as Ee,a7 as We,b as G,X as ge,a as ve,j as Ve,n as R,a8 as Me,J as _e,G as Ne,h as Te}from"./vendor-ux-e4SIahY6.js";import{b as u,a as H,g as oe,c as $e}from"./vendor-hooks-B2bT6Nqf.js";import{r as C}from"./vendor-react-Dvs43sk9.js";import{j as e,ak as r,b6 as A,am as le,y as B,z as F,Q as V,T as K,I as ae,a3 as se,W as U,b1 as W,ca as Ie,cg as qe,c9 as He,at as De,D as ke,ah as Fe,cD as Be,a6 as je,cE as Je,a$ as Ze}from"./vendor-mui-core-Bw-IjQ9m.js";import{U as N,a1 as M,b8 as ne,c as be,b2 as Ge,aN as Ke,R as Qe,T as Ye}from"./index-CGzwVlpv.js";import{A as Z,Q as Xe,b as ce,Z as et,n as Q,$ as tt,C as nt,a as st}from"./vendor-utils-B4mliPf7.js";import{u as ee,C as k,a as Le}from"./index.esm-JPZAjt0x.js";import{S as ie}from"./switch-control-C3A7Bzd7.js";import{S as y}from"./section-DkbgrVvQ.js";import{d as ot}from"./keyboard-arrow-down-rounded-8U0_i9QO.js";import{u as it}from"./index-9VirX3lP.js";import{v as rt}from"./index-BRrSUEyB.js";import{r as at}from"./base32-DdRv86ir.js";import"./index-EQBtWV25.js";import{u as lt}from"./use-mobile-IWOBvgsY.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-CY7eM47O.js";import"./required-mwCee7dE.js";const ye={width:24,height:24,body:'<path fill="currentColor" d="M5 4v16V4v5v-5Zm3 10h2.675q.275-.575.638-1.075t.812-.925H8q-.425 0-.713.288T7 13q0 .425.288.713T8 14Zm0 4h2.075Q10 17.5 10 17t.075-1H8q-.425 0-.713.288T7 17q0 .425.288.713T8 18Zm-3 4q-.825 0-1.413-.588T3 20V4q0-.825.588-1.413T5 2h7.175q.4 0 .763.15t.637.425l4.85 4.85q.275.275.425.638t.15.762V10.3q-.475-.15-.975-.225T17 10V9h-4q-.425 0-.713-.288T12 8V4H5v16h5.675q.275.575.638 1.075t.812.925H5Zm12-10q2.075 0 3.538 1.463T22 17q0 2.075-1.463 3.538T17 22q-2.075 0-3.538-1.463T12 17q0-2.075 1.463-3.538T17 12Zm0 8q.275 0 .463-.188t.187-.462q0-.275-.187-.463T17 18.7q-.275 0-.463.188t-.187.462q0 .275.188.463T17 20Zm0-6q-.475 0-.875.238t-.65.637q-.1.15-.025.313t.25.237q.15.075.3 0t.275-.2q.125-.175.313-.275t.412-.1q.325 0 .563.213t.237.537q0 .275-.15.463t-.35.387q-.15.15-.313.3t-.287.35q-.075.15-.113.313t-.037.337q0 .225.125.413t.325.187q.2 0 .325-.15t.125-.35q0-.275.15-.488t.35-.412q.3-.275.525-.613t.225-.737q0-.675-.5-1.138T17 14Z"/>'},de={enabled:!1,domain:"",clientId:"",clientSecret:""};function ct(){const{api:b}=N(),{blocklet:c}=M(),{t,locale:n}=X(),o=c?.meta?.did,a=Object.assign({...de},c?.settings?.oauth?.auth0||{}),{handleSubmit:x,control:i,formState:p,watch:d,reset:f}=ee({defaultValues:Z(a,Object.keys(de))}),l=d("enabled"),j=u(async s=>{try{const{blocklet:I}=await b.configOAuth({input:{did:o,oauth:JSON.stringify({auth0:s})}}),L=Object.assign({...de},I?.settings?.oauth?.auth0||{});f(L),O.success(t("oauth.saveSuccess"))}catch(I){O.error(I.message||t("oauth.saveFailed"))}}),v=u(s=>s?.trim()?!0:t("oauth.auth0.domainDescription")),S=u(s=>s?.trim()?!0:t("oauth.auth0.clientIdDescription")),g=u(s=>s?.trim()?!0:t("oauth.auth0.clientSecretDescription")),w=u(()=>!0),h=H(()=>n==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-auth0":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-auth0",[n]);return e.jsx(r,{children:e.jsxs("form",{onSubmit:x(j),disabled:!0,children:[e.jsx(y,{title:e.jsxs(r,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx("span",{children:t("oauth.auth0.enable")}),e.jsx(le,{title:t("oauth.viewDocument"),children:e.jsx(r,{component:"a",sx:{display:"inline-block",color:"inherit",fontSize:0,lineHeight:1},href:h,target:"_blank",rel:"noreferrer",children:e.jsx(Y,{icon:ye,fontSize:20})})})]}),mb:2.5,children:e.jsx(k,{name:"enabled",control:i,render:({field:s})=>e.jsx(A,{control:e.jsx(ie,{sx:{ml:1},checked:s.value,...s})})})}),e.jsx(y,{title:t("oauth.auth0.domain"),children:e.jsx(k,{name:"domain",control:i,rules:{validate:l?v:w},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.auth0.domain"),error:!!p.errors[s.name],helperText:p.errors[s.name]?.message||" ",disabled:!l})})})}),e.jsx(y,{title:t("oauth.auth0.clientId"),children:e.jsx(k,{name:"clientId",control:i,rules:{validate:l?S:w},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.auth0.clientId"),error:!!p.errors[s.name],helperText:p.errors[s.name]?.message||" ",disabled:!l})})})}),e.jsx(y,{title:t("oauth.auth0.clientSecret"),children:e.jsx(k,{name:"clientSecret",control:i,rules:{validate:l?g:w},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",type:"password",label:t("oauth.auth0.clientSecret"),error:!!p.errors[s.name],helperText:p.errors[s.name]?.message||" ",disabled:!l})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:x(j),disabled:!p.isDirty,children:t("oauth.save")})]})})}const ue={enabled:!1,clientId:"",clientSecret:""};function dt(){const{api:b}=N(),{blocklet:c}=M(),{t,locale:n}=X(),o=c?.meta?.did,a=Object.assign({...ue},c?.settings?.oauth?.github||{}),{handleSubmit:x,control:i,formState:p,watch:d,reset:f}=ee({defaultValues:Z(a,Object.keys(ue))}),l=d("enabled"),j=u(async h=>{try{const{blocklet:s}=await b.configOAuth({input:{did:o,oauth:JSON.stringify({github:h})}}),I=Object.assign({...ue},s?.settings?.oauth?.github||{});f(I),O.success(t("oauth.saveSuccess"))}catch(s){O.error(s.message||t("oauth.saveFailed"))}}),v=u(h=>h?.trim()?!0:t("oauth.github.clientIdDescription")),S=u(h=>h?.trim()?!0:t("oauth.github.clientSecretDescription")),g=u(()=>!0),w=H(()=>n==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-github":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-github",[n]);return e.jsx(r,{children:e.jsxs("form",{onSubmit:x(j),disabled:!0,children:[e.jsx(y,{title:e.jsxs(r,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx("span",{children:t("oauth.github.enable")}),e.jsx(le,{title:t("oauth.viewDocument"),children:e.jsx(r,{component:"a",sx:{display:"inline-block",color:"inherit",fontSize:0,lineHeight:1},href:w,target:"_blank",rel:"noreferrer",children:e.jsx(Y,{icon:ye,fontSize:20})})})]}),mb:2.5,sx:{"& .section-content":{alignItems:"center"}},children:e.jsx(k,{name:"enabled",control:i,sx:{alignItems:"center"},render:({field:h})=>e.jsx(A,{control:e.jsx(ie,{sx:{ml:1},size:"small",checked:h.value,...h})})})}),e.jsx(y,{title:t("oauth.github.clientId"),children:e.jsx(k,{name:"clientId",control:i,rules:{validate:l?v:g},render:({field:h})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...h,size:"small",label:t("oauth.github.clientId"),error:!!p.errors[h.name],helperText:p.errors[h.name]?.message||" ",disabled:!l})})})}),e.jsx(y,{title:t("oauth.github.clientSecret"),children:e.jsx(k,{name:"clientSecret",control:i,rules:{validate:l?S:g},render:({field:h})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...h,size:"small",type:"password",label:t("oauth.github.clientSecret"),error:!!p.errors[h.name],helperText:p.errors[h.name]?.message||" ",disabled:!l})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:x(j),disabled:!p.isDirty,children:t("oauth.save")})]})})}const he={enabled:!1,clientId:"",clientSecret:""};function ut(){const{api:b}=N(),{blocklet:c}=M(),{t,locale:n}=X(),o=c?.meta?.did,a=Object.assign({...he},c?.settings?.oauth?.google||{}),{handleSubmit:x,control:i,formState:p,watch:d,reset:f}=ee({defaultValues:Z(a,Object.keys(he))}),l=d("enabled"),j=u(async h=>{try{const{blocklet:s}=await b.configOAuth({input:{did:o,oauth:JSON.stringify({google:h})}}),I=Object.assign({...he},s?.settings?.oauth?.google||{});f(I),O.success(t("oauth.saveSuccess"))}catch(s){O.error(s.message||t("oauth.saveFailed"))}}),v=u(h=>h?.trim()?!0:t("oauth.google.clientIdDescription")),S=u(h=>h?.trim()?!0:t("oauth.google.clientSecretDescription")),g=u(()=>!0),w=H(()=>n==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-google":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-google",[n]);return e.jsx(r,{children:e.jsxs("form",{onSubmit:x(j),disabled:!0,children:[e.jsx(y,{title:e.jsxs(r,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx("span",{children:t("oauth.google.enable")}),e.jsx(le,{title:t("oauth.viewDocument"),children:e.jsx(r,{component:"a",sx:{display:"inline-block",color:"inherit",fontSize:0,lineHeight:1},href:w,target:"_blank",rel:"noreferrer",children:e.jsx(Y,{icon:ye,fontSize:20})})})]}),mb:2.5,children:e.jsx(k,{name:"enabled",control:i,render:({field:h})=>e.jsx(A,{control:e.jsx(ie,{sx:{ml:1},checked:h.value,...h})})})}),e.jsx(y,{title:t("oauth.google.clientId"),children:e.jsx(k,{name:"clientId",control:i,rules:{validate:l?v:g},render:({field:h})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...h,size:"small",label:t("oauth.google.clientId"),error:!!p.errors[h.name],helperText:p.errors[h.name]?.message||" ",disabled:!l})})})}),e.jsx(y,{title:t("oauth.google.clientSecret"),children:e.jsx(k,{name:"clientSecret",control:i,rules:{validate:l?S:g},render:({field:h})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...h,size:"small",type:"password",label:t("oauth.google.clientSecret"),error:!!p.errors[h.name],helperText:p.errors[h.name]?.message||" ",disabled:!l})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:x(j),disabled:!p.isDirty,children:t("oauth.save")})]})})}const me={enabled:!1,teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function ht(){const{api:b}=N(),{blocklet:c}=M(),{t}=X(),n=c?.meta?.did,o=Object.assign({...me},c?.settings?.oauth?.apple||{}),{handleSubmit:a,control:x,formState:i,watch:p,reset:d}=ee({defaultValues:Z(o,Object.keys(me))}),f=p("enabled"),l=u(async s=>{try{const{blocklet:I}=await b.configOAuth({input:{did:n,oauth:JSON.stringify({apple:s})}}),L=Object.assign({...me},I?.settings?.oauth?.apple||{});d(L),O.success(t("oauth.saveSuccess"))}catch(I){O.error(I.message||t("oauth.saveFailed"))}}),j=u(s=>s?.trim()?!0:t("oauth.apple.teamIdDescription")),v=u(s=>s?.trim()?!0:t("oauth.apple.serviceIdDescription")),S=u(s=>s?.trim()?!0:t("oauth.apple.keyIdDescription")),g=u(s=>s?.trim()?!0:t("oauth.apple.authKeyDescription")),w=u(s=>s?.trim()?!0:t("oauth.apple.bundleIdDescription")),h=u(()=>!0);return e.jsx(r,{children:e.jsxs("form",{onSubmit:a(l),disabled:!0,children:[e.jsx(y,{title:t("oauth.apple.enable"),mb:2.5,children:e.jsx(k,{name:"enabled",control:x,render:({field:s})=>e.jsx(A,{control:e.jsx(ie,{sx:{ml:1},checked:s.value,...s})})})}),e.jsx(y,{title:t("oauth.apple.teamId"),children:e.jsx(k,{name:"teamId",control:x,rules:{validate:f?j:h},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.apple.teamId"),error:!!i.errors[s.name],helperText:i.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.apple.bundleId"),children:e.jsx(k,{name:"bundleId",control:x,rules:{validate:f?w:h},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.apple.bundleId"),error:!!i.errors[s.name],helperText:i.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.apple.serviceId"),children:e.jsx(k,{name:"serviceId",control:x,rules:{validate:f?v:h},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.apple.serviceId"),error:!!i.errors[s.name],helperText:i.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.apple.keyId"),children:e.jsx(k,{name:"keyId",control:x,rules:{validate:f?S:h},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.apple.keyId"),error:!!i.errors[s.name],helperText:i.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.apple.authKey"),children:e.jsx(k,{name:"authKey",control:x,rules:{validate:f?g:h},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",type:"password",label:t("oauth.apple.authKey"),multiline:!0,rows:4,error:!!i.errors[s.name],helperText:i.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:a(l),disabled:!i.isDirty,children:t("oauth.save")})]})})}const pe={enabled:!1,clientId:"",clientSecret:""};function mt(){const{api:b}=N(),{blocklet:c}=M(),{t}=X(),n=c?.meta?.did,o=Object.assign({...pe},c?.settings?.oauth?.twitter||{}),{handleSubmit:a,control:x,formState:i,watch:p,reset:d}=ee({defaultValues:Z(o,Object.keys(pe))}),f=p("enabled"),l=u(async g=>{try{const{blocklet:w}=await b.configOAuth({input:{did:n,oauth:JSON.stringify({twitter:g})}}),h=Object.assign({...pe},w?.settings?.oauth?.twitter||{});d(h),O.success(t("oauth.saveSuccess"))}catch(w){O.error(w.message||t("oauth.saveFailed"))}}),j=u(g=>g?.trim()?!0:t("oauth.twitter.clientIdDescription")),v=u(g=>g?.trim()?!0:t("oauth.twitter.clientSecretDescription")),S=u(()=>!0);return e.jsx(r,{children:e.jsxs("form",{onSubmit:a(l),disabled:!0,children:[e.jsx(y,{title:e.jsx(r,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsx("span",{children:t("oauth.twitter.enable")})}),mb:2.5,sx:{"& .section-content":{alignItems:"center"}},children:e.jsx(k,{name:"enabled",control:x,sx:{alignItems:"center"},render:({field:g})=>e.jsx(A,{control:e.jsx(ie,{sx:{ml:1},size:"small",checked:g.value,...g})})})}),e.jsx(y,{title:t("oauth.twitter.clientId"),children:e.jsx(k,{name:"clientId",control:x,rules:{validate:f?j:S},render:({field:g})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...g,size:"small",label:t("oauth.twitter.clientId"),error:!!i.errors[g.name],helperText:i.errors[g.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.twitter.clientSecret"),children:e.jsx(k,{name:"clientSecret",control:x,rules:{validate:f?v:S},render:({field:g})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...g,size:"small",type:"password",label:t("oauth.twitter.clientSecret"),error:!!i.errors[g.name],helperText:i.errors[g.name]?.message||" ",disabled:!f})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:a(l),disabled:!i.isDirty,children:t("oauth.save")})]})})}const pt={width:24,height:24,body:'<path fill="currentColor" d="M9 20q-.825 0-1.413-.588T7 18q0-.825.588-1.413T9 16q.825 0 1.413.588T11 18q0 .825-.588 1.413T9 20Zm6 0q-.825 0-1.413-.588T13 18q0-.825.588-1.413T15 16q.825 0 1.413.588T17 18q0 .825-.588 1.413T15 20Zm-6-6q-.825 0-1.413-.588T7 12q0-.825.588-1.413T9 10q.825 0 1.413.588T11 12q0 .825-.588 1.413T9 14Zm6 0q-.825 0-1.413-.588T13 12q0-.825.588-1.413T15 10q.825 0 1.413.588T17 12q0 .825-.588 1.413T15 14ZM9 8q-.825 0-1.413-.588T7 6q0-.825.588-1.413T9 4q.825 0 1.413.588T11 6q0 .825-.588 1.413T9 8Zm6 0q-.825 0-1.413-.588T13 6q0-.825.588-1.413T15 4q.825 0 1.413.588T17 6q0 .825-.588 1.413T15 8Z"/>'};function Oe({id:b,title:c,children:t,index:n,onMove:o,defaultExpand:a=!1,onEnd:x,icon:i=null}){const[p,d]=C.useState(a),f=C.useRef(null),l=C.useRef(null),[{handlerId:j},v]=Re({accept:"dragItem",collect(s){return{handlerId:s.getHandlerId()}},hover(s,I){if(!f.current)return;const L=s.index,m=n;if(L===m)return;const P=f.current?.getBoundingClientRect(),_=l.current?.getBoundingClientRect(),re=(_.bottom-_.top)/2,$=I.getClientOffset().y-P.top;L<m&&$<re||L>m&&$>re||(o(L,m),s.index=m)}}),[{isDragging:S},g]=Ue({item:{index:n,type:"dragItem"},collect:s=>({isDragging:s.isDragging()}),end:x});g(l),v(f);const w=S?.5:1,h=u(s=>{s.preventDefault(),s.stopPropagation(),d(!p)});return e.jsxs(r,{ref:f,children:[e.jsxs(r,{sx:{cursor:"pointer","&:hover":{backgroundColor:"grey.100"}},ref:l,"data-handler-id":j,children:[e.jsxs(r,{sx:{py:2,px:1,opacity:w,display:"flex",alignItems:"center",gap:.5},draggable:!1,onClick:h,children:[e.jsx(r,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:"text.hint","&:hover":{color:"text.secondary"}},children:e.jsx(Y,{fontSize:20,icon:pt})}),e.jsx(r,{sx:{display:"flex",alignItems:"center",flexShrink:0,mr:.5,transform:"translateY(-1px)"},children:i}),e.jsx(K,{sx:{flex:1},children:c}),e.jsx(ae,{size:"small",sx:{pointerEvents:"auto",transform:p?"":"rotate(180deg)",transition:"transform 0.3s ease"},children:e.jsx(Y,{icon:ot,style:{transform:"scale(1.5)"}})})]}),e.jsx(se,{})]}),e.jsx(r,{sx:{pl:4,py:2.5,display:p?"block":"none"},children:t})]})}Oe.propTypes={title:U.string.isRequired,id:U.string.isRequired,children:U.node.isRequired,index:U.number.isRequired,onMove:U.func.isRequired,onEnd:U.func.isRequired,defaultExpand:U.bool,icon:U.any};const xt=[{name:"github",title:"GitHub",icon:e.jsx(ne,{provider:"github",sx:{width:20,height:20}}),component:e.jsx(dt,{})},{name:"google",title:"Google",icon:e.jsx(ne,{provider:"google",sx:{width:20,height:20}}),component:e.jsx(ut,{})},{name:"apple",title:"Apple",icon:e.jsx(ne,{provider:"apple",sx:{width:20,height:20}}),component:e.jsx(ht,{})},{name:"twitter",title:"Twitter",icon:e.jsx(ne,{provider:"twitter",sx:{width:20,height:20}}),component:e.jsx(mt,{})},{name:"auth0",title:"Auth0",icon:e.jsx(ne,{provider:"auth0",sx:{width:20,height:20}}),component:e.jsx(ct,{})}],ft=["github","google","apple","twitter","auth0"];function gt(){const{api:b}=N(),{blocklet:c}=M(),t=c?.meta?.did,n=c?.settings?.oauth||{},o=Object.keys(n).sort((l,j)=>n[l]?.order!==void 0&&n[j]?.order!==void 0?n[l].order-n[j].order:n[l]?.order!==void 0?-1:1);for(const l of ft)o.includes(l)||o.push(l);const a=oe(o.reduce((l,j,v)=>Object.assign(l,{[j]:v}),{})),x=H(()=>{const l=[...xt];return l.sort((j,v)=>a[j.name]-a[v.name]),l.map(j=>({...j,enabled:n[j.name]?.enabled??!1}))},[a.auth0,a.github,a.google]),i={};typeof window<"u"&&(i.context=window);const p=u(async l=>{const j={};Object.keys(l).forEach(v=>{j[v]={order:l[v]}}),await b.configOAuth({input:{did:t,oauth:JSON.stringify(j)}})}),d=u((l,j)=>{const v=x[l],S=x[j];a[v.name]=j,a[S.name]=l}),f=u(async()=>{await p(a)});return e.jsx(r,{sx:{".section-left":{width:"180px"}},children:e.jsx(Ee,{backend:We,...i,children:x.map((l,j)=>e.jsx(Oe,{index:j,id:l.name,title:l.title,icon:l.icon,onMove:d,onEnd:f,defaultExpand:l.enabled,children:l.component},l.name))})})}const J={ttl:be.SESSION_TTL,cacheTtl:be.SESSION_CACHE_TTL,email:{enabled:!1,requireVerified:!1,requireUnique:!1,trustOauthProviders:!1,trustedIssuers:[],enableDomainBlackList:!1,domainBlackList:[],enableDomainWhiteList:!1,domainWhiteList:[]},phone:{enabled:!1,requireVerified:!1,requireUnique:!1,regionBlackList:[],trustedIssuers:[]},enableBlacklist:!1};function E(b){return e.jsx(it,{...b,sx:{transform:"scale(0.75)"}})}function xe(b,c=!1){const t=c?b.ttl*86400:b.ttl/86400;return{...b,ttl:t}}function jt(){const{api:b}=N(),{blocklet:c}=M(),t=c?.meta?.did,n=Xe({},J,c?.settings?.session||{});ce(n.ttl)&&(n.ttl=J.ttl),ce(n.cacheTtl)&&(n.cacheTtl=J.cacheTtl),n.phone||(n.phone=J.phone),n.email||(n.email=J.email),ce(n.enableBlacklist)&&(n.enableBlacklist=J.enableBlacklist);const{handleSubmit:o,control:a,formState:x,reset:i,watch:p}=ee({defaultValues:Z(xe(n),["ttl","cacheTtl","email","phone","enableBlacklist"])}),{t:d}=X(),f=p("email.enabled"),l=p("phone.enabled"),j=p("email.enableDomainBlackList"),v=p("email.enableDomainWhiteList"),{fields:S,append:g,remove:w}=Le({control:a,name:"email.domainBlackList"}),{fields:h,append:s,remove:I}=Le({control:a,name:"email.domainWhiteList"}),L=u(async m=>{try{const{blocklet:P}=await b.updateAppSessionConfig({input:{did:t,config:et(xe(m,!0),["phone"])}}),_=Object.assign({},J,Z(P?.settings?.session||{},["ttl","cacheTtl","email","phone","enableBlacklist"]));i(xe(_)),O.success(d("common.configSuccess"))}catch(P){O.error(P.message)}});return e.jsx(bt,{onSubmit:o(L),children:e.jsxs(W,{direction:"column",sx:{gap:6},children:[e.jsxs(r,{children:[e.jsxs(r,{children:[e.jsx(K,{variant:"h6",sx:{fontWeight:600},children:d("blocklet.config.session.profile")}),e.jsx(r,{component:se,sx:{my:3}})]}),e.jsxs(W,{sx:{gap:2},children:[e.jsx(y,{title:d("blocklet.config.session.fullNameEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(r,{sx:{alignSelf:"flex-start"},children:e.jsx(E,{disabled:!0,checked:!0})})}),e.jsx(y,{title:d("blocklet.config.session.avatarEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(r,{sx:{alignSelf:"flex-start"},children:e.jsx(E,{disabled:!0,checked:!0})})}),e.jsx(y,{title:d("blocklet.config.session.emailEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(r,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.enabled",control:a,render:({field:m})=>e.jsx(E,{...m,checked:m.value})})})}),f&&e.jsxs(W,{direction:"column",sx:{ml:2},children:[e.jsx(y,{title:d("blocklet.config.session.emailRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(r,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.requireVerified",control:a,render:({field:m})=>e.jsx(A,{sx:{mt:1},control:e.jsx(E,{...m,checked:m.value})})})})}),e.jsx(y,{title:d("blocklet.config.session.emailRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(r,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.requireUnique",control:a,render:({field:m})=>e.jsx(A,{sx:{mt:1},control:e.jsx(E,{...m,checked:m.value})})})})}),e.jsx(y,{title:d("blocklet.config.session.emailTrustOauthProviders"),sectionLeftSx:{width:"600px"},children:e.jsx(r,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.trustOauthProviders",control:a,render:({field:m})=>e.jsx(A,{sx:{mt:1},control:e.jsx(E,{...m,checked:m.value})})})})}),e.jsx(y,{title:d("blocklet.config.session.enableDomainBlackList"),sectionLeftSx:{width:"600px"},children:e.jsx(r,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.enableDomainBlackList",control:a,render:({field:m})=>e.jsx(A,{sx:{mt:1},control:e.jsx(E,{...m,checked:m.value})})})})}),j&&e.jsxs(r,{children:[S.map((m,P)=>e.jsxs(W,{direction:"row",sx:{alignItems:"center",my:1,maxWidth:"720px"},children:[e.jsx(k,{name:`email.domainBlackList.${P}`,control:a,render:_=>e.jsx(F,{..._.field,size:"small",fullWidth:!0})}),e.jsx(ae,{onClick:()=>w(P),children:e.jsx(Ie,{})})]},m.id)),e.jsx(V,{startIcon:e.jsx(qe,{}),onClick:()=>g(""),children:d("blocklet.config.session.addDomain")})]}),e.jsx(y,{title:d("blocklet.config.session.enableDomainWhiteList"),sectionLeftSx:{width:"600px"},children:e.jsx(r,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.enableDomainWhiteList",control:a,render:({field:m})=>e.jsx(A,{sx:{mt:1},control:e.jsx(E,{...m,checked:m.value})})})})}),v&&e.jsxs(r,{children:[h.map((m,P)=>e.jsxs(W,{direction:"row",sx:{alignItems:"center",my:1,maxWidth:"720px"},children:[e.jsx(k,{name:`email.domainWhiteList.${P}`,control:a,render:_=>e.jsx(F,{..._.field,size:"small",fullWidth:!0})}),e.jsx(ae,{onClick:()=>I(P),children:e.jsx(Ie,{})})]},m.id)),e.jsx(V,{startIcon:e.jsx(qe,{}),onClick:()=>s(""),children:d("blocklet.config.session.addDomain")})]})]}),e.jsxs(r,{sx:{display:"none"},children:[e.jsx(y,{title:d("blocklet.config.session.phoneEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(r,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"phone.enabled",control:a,disabled:!0,render:({field:m})=>e.jsx(A,{sx:{mt:1},control:e.jsx(E,{...m,checked:m.value})})})})}),l&&e.jsxs(W,{direction:"column",sx:{ml:2,mt:1},children:[e.jsx(y,{title:d("blocklet.config.session.phoneRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(r,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"phone.requireVerified",control:a,render:({field:m})=>e.jsx(A,{control:e.jsx(E,{...m,checked:m.value})})})})}),e.jsx(y,{title:d("blocklet.config.session.phoneRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(r,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"phone.requireUnique",control:a,render:({field:m})=>e.jsx(A,{control:e.jsx(E,{...m,checked:m.value})})})})})]})]})]})]}),e.jsxs(r,{children:[e.jsx(K,{variant:"h6",sx:{fontWeight:600},children:d("blocklet.config.session.period")}),e.jsx(r,{component:se,sx:{my:3}}),e.jsx(W,{direction:"column",spacing:2,children:e.jsx(k,{name:"ttl",control:a,rules:{min:1,max:30},render:({field:m})=>e.jsx(B,{fullWidth:!0,sx:{mb:2},children:e.jsx(y,{title:d("blocklet.config.session.ttl",{day:m.value}),sectionLeftSx:{width:"600px"},children:e.jsx(r,{sx:{width:"100%",maxWidth:500,px:1.5},children:e.jsx(He,{...m,defaultValue:7,step:1,marks:[{value:1,label:d("blocklet.config.session.day",{day:1})},{value:7,label:d("blocklet.config.session.days",{day:7})},{value:14,label:d("blocklet.config.session.days",{day:14})},{value:21,label:d("blocklet.config.session.days",{day:21})},{value:30,label:d("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto"})})})})})})]}),e.jsxs(r,{children:[e.jsx(K,{variant:"h6",sx:{fontWeight:600},children:d("blocklet.config.session.experimentalSettings")}),e.jsx(r,{component:se,sx:{my:3}}),e.jsx(W,{direction:"column",spacing:2,children:e.jsx(y,{title:d("blocklet.config.session.enableBlacklist"),sectionLeftSx:{width:"600px"},children:e.jsx(r,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"enableBlacklist",control:a,render:({field:m})=>e.jsx(A,{sx:{mt:1},control:e.jsx(E,{...m,checked:m.value})})})})})})]}),e.jsx(r,{children:e.jsx(V,{type:"submit",variant:"contained",disabled:!x.isDirty,children:d("oauth.save")})})]})})}const bt=De.form`
|
|
2
2
|
max-width: 1536px;
|
|
3
3
|
|
|
4
4
|
.advanced-config {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{A as oT,B as $m,D as Xm,E as Zm}from"./vendor-hooks-
|
|
1
|
+
import{A as oT,B as $m,D as Xm,E as Zm}from"./vendor-hooks-B2bT6Nqf.js";import{B as qm}from"./vendor-utils-B4mliPf7.js";import{g as jL,a as JL,r as QL}from"./vendor-react-Dvs43sk9.js";/*! *****************************************************************************
|
|
2
2
|
Copyright (c) Microsoft Corporation.
|
|
3
3
|
|
|
4
4
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as C,g as
|
|
1
|
+
import{r as C,g as Me,a as ut}from"./vendor-react-Dvs43sk9.js";import{g as mt,k as re}from"./vendor-hooks-B2bT6Nqf.js";import{j as e,ak as g,at as q,b1 as ee,a6 as M,aX as _e,am as K,cw as ft,U as xt,T as E,a3 as ht,W as w,z as $,M as ae,I as W,cF as $e,cg as me,A as gt,x as Oe,c2 as We,c3 as X,bv as qe,F as He,bC as yt,b6 as jt,a5 as vt,J as Ct,Q as bt,bb as St,s as wt}from"./vendor-mui-core-Bw-IjQ9m.js";import{T as F,a as H,h as Tt,J as fe,B as le,H as R,n as L,G as xe,F as Ue,s as Ge,a0 as Dt,a9 as Ie,S as It,W as Pt}from"./vendor-ux-e4SIahY6.js";import{U as k,p as Rt,ad as Ve,c as U,ap as J,a1 as kt,aE as At,f as Ft,R as Nt,af as se,b6 as Lt,b9 as Ye}from"./index-CGzwVlpv.js";import{W as he}from"./did-address-DM13r0GC.js";import{u as _}from"./team-DL-1lYRh.js";import{a as ge,r as ye,b as je,c as Ke,d as ne,e as Bt,u as zt,f as Et}from"./passport-item-CqfuHfH-.js";import{p as Ze}from"./util-CZwlQQjD.js";import{u as Mt}from"./use-mobile-IWOBvgsY.js";import{v as Q}from"./index-BacwgICr.js";import{w as G,P as Je}from"./permission-BVTxHNeQ.js";import{C as _t}from"./Google-JeDCA1Ra.js";import{A as $t}from"./vendor-arcblock-CY7eM47O.js";import{G as Z,a0 as Ot,H as Wt}from"./vendor-utils-B4mliPf7.js";import{e as oe}from"./edit.svg-DycWG9v3.js";import{C as ve}from"./confirm-CRV2RKnN.js";import{L as Qe}from"./list-header-BDPLDqO-.js";import{f as te}from"./index-DBs9Ljax.js";import{u as qt}from"./useSetState-DFuQZPPV.js";import{C as Ht}from"./lock.svg-COUP8tyO.js";import"./lottie-web-4koyQiv_.js";import"./session-CJYcrokL.js";import"./isURL-TswwHw1T.js";import"./index-CSX4LtVd.js";import"./base32-DdRv86ir.js";import"./cloneDeep-Bp5oPxU3.js";const ie=u=>C.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...u},C.createElement("path",{d:"M8.4375 4.3125H8.25C8.35313 4.3125 8.4375 4.22812 8.4375 4.125V4.3125H15.5625V4.125C15.5625 4.22812 15.6469 4.3125 15.75 4.3125H15.5625V6H17.25V4.125C17.25 3.29766 16.5773 2.625 15.75 2.625H8.25C7.42266 2.625 6.75 3.29766 6.75 4.125V6H8.4375V4.3125ZM20.25 6H3.75C3.33516 6 3 6.33516 3 6.75V7.5C3 7.60313 3.08437 7.6875 3.1875 7.6875H4.60312L5.18203 19.9453C5.21953 20.7445 5.88047 21.375 6.67969 21.375H17.3203C18.1219 21.375 18.7805 20.7469 18.818 19.9453L19.3969 7.6875H20.8125C20.9156 7.6875 21 7.60313 21 7.5V6.75C21 6.33516 20.6648 6 20.25 6ZM17.1398 19.6875H6.86016L6.29297 7.6875H17.707L17.1398 19.6875Z"})),Pe="info";function Xe({createPassportSvg:u,passport:o,onCancel:i,onSwitchPassport:p=()=>{}}){const{t:m}=F(),l=mt({tab:Pe}),h={info:{label:m("common.basicInfo"),value:Pe,component:()=>e.jsx(et,{passport:o,createPassportSvg:u})},logs:{label:m("common.logs"),value:"logs",component:()=>e.jsx(rt,{passport:o})},related:{label:m("team.passport.related"),value:"related",component:()=>e.jsx(at,{passport:o,onSwitchPassport:p})}},a=Object.values(h).map(({label:r,value:t})=>({label:r,value:t})).filter(r=>r.value==="related"?o.parentDid:!0),f=h[l.tab]||h.info,s=r=>{l.tab=r};return e.jsx(H,{title:m("common.passport"),onClose:i,open:!0,PaperProps:{style:{maxWidth:800,minHeight:"80vh"}},fullWidth:!0,children:e.jsxs(Ut,{children:[e.jsx(g,{className:"tabs",children:e.jsx(Tt,{tabs:a,current:l.tab,onChange:s,scrollButtons:"auto"})}),e.jsx(g,{className:"body",children:e.jsx(f.component,{})})]})})}Xe.propTypes={createPassportSvg:w.func.isRequired,passport:w.object.isRequired,onCancel:w.func.isRequired,onSwitchPassport:w.func};const Ut=q(g)`
|
|
2
2
|
margin-top: -16px;
|
|
3
3
|
|
|
4
4
|
.tabs {
|
|
@@ -9,7 +9,7 @@ import{r as C,g as _e,a as ut}from"./vendor-react-Dvs43sk9.js";import{g as mt,k
|
|
|
9
9
|
.body {
|
|
10
10
|
margin-top: 24px;
|
|
11
11
|
}
|
|
12
|
-
`;function et({createPassportSvg:u,passport:o}){const{t:i,locale:p}=F(),{teamDid:m}=
|
|
12
|
+
`;function et({createPassportSvg:u,passport:o}){const{t:i,locale:p}=F(),{teamDid:m}=_(),{inService:l}=k(),h=Mt(),a=[{items:[{label:i("common.role"),content:ge(o.title)},{label:i("common.did"),content:e.jsx(he,{did:o.id})},{label:i("team.passport.status"),content:je(o.status)},{label:i("common.type"),content:e.jsx(g,{sx:{display:"flex",gap:1,flexWrap:"wrap"},children:(o.type||[]).map(s=>e.jsx(xt,{label:s,variant:"outlined",size:"small",sx:{borderRadius:1}},s))})}]}],f=[{title:i("team.passport.owner"),items:[{label:i("team.passport.owner"),content:e.jsx(g,{children:ye(o.user,l)})}]},{title:i("common.timeInfo"),items:[{label:i("team.passport.issuanceTime"),content:o.issuanceDate?e.jsx(le,{value:o.issuanceDate,type:"all",locale:p}):"-"},{label:i("team.member.lastLogin"),content:o.lastLoginAt?e.jsx(le,{value:o.lastLoginAt,type:"all",locale:p}):"-"},{label:i("common.expires"),content:o.expirationDate?e.jsx(le,{value:o.expirationDate,type:"all",locale:p}):"-"}]},{title:i("blocklet.overview.source"),items:[{label:i("blocklet.overview.source"),content:ne(o.source)}]}];return e.jsxs(Gt,{gap:3,children:[e.jsxs(g,{sx:{display:"flex",flexDirection:h?"column":"row",alignItems:h?"flex-start":"center",justifyContent:h?"center":"flex-start",width:"100%",overflow:"hidden",gap:h?2:4},children:[e.jsx(g,{sx:{display:"flex",width:"180px"},className:"passport-image",dangerouslySetInnerHTML:{__html:u({scope:o.scope,role:o.role,title:o.scope==="kyc"?o.name:o.title,issuer:o.issuer&&o.issuer.name,issuerDid:o.issuer&&o.issuer.id,ownerName:o.user?.fullName,ownerDid:o.user?.did,ownerAvatarUrl:o.user?.avatar?Ze(o.user?.avatar,m,l):"",revoked:o.revoked,extra:o?.expirationDate?{key:"Exp",value:Ve(o.expirationDate).format("YYYY-MM-DD HH:mm:ss")}:null})}}),e.jsx(g,{className:"info-area",children:a.map(s=>e.jsxs(g,{children:[s.title&&e.jsx(E,{variant:"h6",sx:{mb:2},children:s.title}),e.jsx(g,{className:"info-grid",sx:{gap:"12px !important"},children:s.items.map(r=>e.jsxs(g,{className:"info-item",children:[e.jsx(g,{className:"info-label",sx:{maxWidth:40},children:e.jsx(E,{variant:"subtitle2",color:"textSecondary",children:r.label})}),e.jsx(g,{sx:{display:"flex",flexWrap:"wrap",gap:.5,minWidth:0},children:r.content})]},r.label))})]},s.title))})]}),e.jsx(ht,{}),e.jsx(g,{className:"info-area",children:f.map(s=>e.jsxs(g,{children:[e.jsx(E,{variant:"h5",sx:{mb:1.5},children:s.title}),e.jsx(g,{className:"info-grid",children:s.items.map(r=>e.jsxs(g,{className:"info-item",children:[e.jsx(g,{className:"info-label",children:e.jsx(E,{variant:"subtitle2",color:"textSecondary",children:r.label})}),e.jsx(g,{sx:{minWidth:500},children:r.content})]},r.label))})]},s.title))})]})}et.propTypes={passport:w.object.isRequired,createPassportSvg:w.func.isRequired};const Gt=q(ee)`
|
|
13
13
|
.info-card {
|
|
14
14
|
margin-bottom: 24px;
|
|
15
15
|
overflow: hidden;
|
|
@@ -87,7 +87,7 @@ import{r as C,g as _e,a as ut}from"./vendor-react-Dvs43sk9.js";import{g as mt,k
|
|
|
87
87
|
margin: 0;
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
`,tt=10,st=1;function rt({passport:u}){const{api:o}=k(),{teamDid:i}=
|
|
90
|
+
`,tt=10,st=1;function rt({passport:u}){const{api:o}=k(),{teamDid:i}=_(),{t:p,locale:m}=F(),[l,h]=C.useState({pageSize:tt,page:st}),{data:a,loading:f}=re(async()=>{const y={teamDid:i,query:{passportId:u.id},paging:{page:l.page,pageSize:l.pageSize}},x=await o.getPassportLogs({input:y});return{logs:x.passportLogs||[],total:x.paging.total}},{refreshDeps:[l.page,l.pageSize],onError:y=>R.error(y.message)}),s=C.useMemo(()=>a?.logs||[],[a?.logs]),r=y=>y.action===U.PASSPORT_LOG_ACTION.APPROVE||y.action===U.PASSPORT_LOG_ACTION.REVOKE?y?.metadata?.operator?.fullName?`${p("common.operator")}: ${y?.metadata?.operator?.fullName}`:null:y.action===U.PASSPORT_LOG_ACTION.ISSUE&&y.metadata?.action===U.PASSPORT_ISSUE_ACTION.ISSUE_ON_INVITE?y?.metadata?.inviter?.fullName?`${p("common.inviter")}: ${y?.metadata?.inviter?.fullName}`:null:`passportId: ${y.passportId}`,t=C.useMemo(()=>[{label:p("common.action"),name:"action",options:{customBodyRender:(y,{rowIndex:x})=>{const d=s[x];return e.jsx(K,{title:r(d),children:`${y} ${d.metadata?.action?`(${d.metadata.action})`:""}`})}}},{label:"IP",name:"operatorIp",options:{customBodyRender:y=>e.jsx(g,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsx("span",{children:y||"-"})})}},{label:"UA",width:250,name:"operatorUa",options:{customBodyRender:(y,{rowIndex:x})=>{const d=s[x];return e.jsxs(g,{sx:{display:"flex",alignItems:"center",gap:1},children:[d.operatorUa&&e.jsx(g,{children:Bt(d.operatorUa)}),d.operatorUa&&e.jsx(K,{title:d.operatorUa,children:e.jsx(ft,{fontSize:"small",color:"action",sx:{fontSize:16,cursor:"pointer"}})})]})}}},{label:p("common.createdAt"),name:"createdAt",options:{customBodyRender:y=>Rt(y,m)}}],[p,m,s]),n=({page:y,rowsPerPage:x})=>{l.pageSize!==x?h(d=>({...d,pageSize:x,page:1})):l.page!==y+1&&h(d=>({...d,page:y+1}))},c={sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,search:!1,page:l.page-1,rowsPerPage:l.pageSize,count:a?.total||0};return f?e.jsx(g,{sx:{py:2},children:e.jsx(ee,{direction:"row",spacing:1,sx:{position:"relative",pb:2},children:e.jsx(M,{})})}):e.jsx(g,{children:e.jsx(fe,{className:"logs-table",verticalKeyWidth:100,locale:m,data:s,columns:t,options:c,loading:f,onChange:n})})}rt.propTypes={passport:w.object.isRequired};function at({passport:u,onSwitchPassport:o}){const{api:i}=k(),{teamDid:p}=_(),{t:m,locale:l}=F(),[h,a]=C.useState({pageSize:tt,page:st}),{data:f,loading:s}=re(async()=>{const x={teamDid:p,passportId:u.parentDid,paging:{page:h.page,pageSize:h.pageSize}},d=await i.getRelatedPassports({input:x});return{passports:d.passports||[],total:d.paging.total}},{refreshDeps:[h.page,h.pageSize],onError:x=>R.error(x.message)}),r=C.useMemo(()=>f?.passports||[],[f?.passports]),t=C.useMemo(()=>[{label:m("team.passport.role"),name:"role",options:{customBodyRender:ge}},{label:m("team.passport.owner"),name:"user",options:{customBodyRender:ye}},{label:m("team.passport.status"),name:"status",options:{customBodyRender:je}},{label:m("team.member.lastLogin"),name:"lastLoginAt",options:{customBodyRender:x=>Ke(x,l)}},{label:m("blocklet.overview.source"),name:"source",options:{customBodyRender:ne}}],[m,l]),n=({page:x,rowsPerPage:d})=>{h.pageSize!==d?a(j=>({...j,pageSize:d,page:1})):h.page!==x+1&&a(j=>({...j,page:x+1}))},c=C.useRef(null),y={sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,search:!1,page:h.page-1,rowsPerPage:h.pageSize,count:f?.total||0,onRowClick(x,{dataIndex:d},j){if(c.current?.contains(j.target)){const S=r[d];o(S)}}};return s?e.jsx(g,{sx:{py:2},children:e.jsx(ee,{direction:"row",spacing:1,sx:{position:"relative",pb:2},children:e.jsx(M,{})})}):e.jsxs(ee,{spacing:1,children:[e.jsx(_e,{severity:"warning",children:m("team.passport.relatedDescription")}),e.jsx(g,{ref:c,sx:{".MuiTableRow-root":{cursor:"pointer"}},children:e.jsx(fe,{className:"related-table",verticalKeyWidth:100,locale:l,data:r.filter(x=>x.id!==u.id),columns:t,options:y,loading:s,onChange:n})})]})}at.propTypes={passport:w.object.isRequired,onSwitchPassport:w.func.isRequired};function Ce({onCancel:u,onSuccess:o}){const{api:i}=k(),{blocklet:p}=kt(),{t:m}=F(),[l,h]=C.useState(!1),a=(p.environments.find(n=>n.key==="BLOCKLET_PASSPORT_COLOR")||{}).value||"auto",f=a==="auto"?$t(p.appDid):a,[s,r]=C.useState(f),t=async()=>{const n=[{key:Nt.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_PASSPORT_COLOR,value:s}];try{h(!0),await i.configBlocklet({input:{did:p.meta.did,configs:n}}),o()}catch(c){R.error(c.message)}finally{h(!1)}};return e.jsx(H,{title:m("team.passport.color"),onClose:u,open:!0,fullWidth:!0,actions:e.jsxs(e.Fragment,{children:[e.jsx(L,{onClick:u,color:"inherit",children:m("common.cancel")}),e.jsxs(L,{onClick:t,color:"primary",disabled:l,variant:"contained",autoFocus:!0,"data-cy":"color-btn-confirm",children:[l&&e.jsx(M,{size:16}),m("common.save")]})]}),children:e.jsxs(g,{className:"dialog-content",sx:{display:"flex",justifyContent:"center",alignItems:"center"},children:[e.jsx(_t,{disableAlpha:!0,color:s,onChange:n=>r(n.hex)}),e.jsx("div",{style:{width:220,marginLeft:24},dangerouslySetInnerHTML:{__html:At({scope:"passport",role:"owner",title:"Owner",issuer:Ft.getDisplayName(p),issuerDid:p.appDid,ownerName:"Your Name",ownerDid:p.appDid,preferredColor:s})}})]})})}const Vt=G(Ce,"mutate_team"),Yt=G(Ce,"",J);function Kt(u){const{inService:o}=k();return o?e.jsx(Yt,{...u}):e.jsx(Vt,{...u})}Ce.propTypes={onCancel:w.func.isRequired,onSuccess:w.func.isRequired};var nt=function(o){return e.jsx("svg",{...o,children:e.jsx("path",{d:"M64.707 8.707a1 1 0 0 0 0-1.414L58.343.929a1 1 0 1 0-1.414 1.414L62.586 8l-5.657 5.657a1 1 0 0 0 1.414 1.414l6.364-6.364ZM0 9h64V7H0v2Z",fill:"#666"})})};nt.defaultProps={width:"65",height:"16",fill:"none",xmlns:"http://www.w3.org/2000/svg"};const Zt=(u,o)=>u?!o.some(i=>!i.from.passport||!i.to.role):!1;function ot({onCancel:u,onSuccess:o,data:i={},trustedPassports:p=[]}){const{api:m}=k(),{roles:l,teamDid:h}=_(),{t:a}=F(),[f,s]=C.useState(!1),[r,t]=C.useState(i.issuerDid||""),[n,c]=C.useState(i.remark||""),[y,x]=C.useState(Z(i.mappings)||[]),d=p.findIndex(S=>S.issuerDid===i.issuerDid),j=async()=>{if(f)return;const S={issuerDid:r,remark:n,mappings:y.map(b=>({...b,to:{...b.to,ttl:b.to.ttl||0}}))},T=[...p];d===-1?T.unshift(S):T[d]=S;try{s(!0),await m.configTrustedPassports({input:{teamDid:h,trustedPassports:T}}),await se(800),s(!1),R.success(a("common.saveSuccess")),o()}catch(b){s(!1),R.error(te(b))}};return e.jsx(H,{title:a("team.passport.trustedIssuers"),open:!0,showCloseButton:!1,PaperProps:{style:{minHeight:"80vh"}},fullWidth:!0,prepend:e.jsx(W,{onClick:u,"data-cy":"trusted-issuer-close",size:"large",children:e.jsx($e,{})}),actions:e.jsxs(e.Fragment,{children:[e.jsx(L,{onClick:u,color:"inherit",children:a("common.cancel")}),e.jsxs(L,{onClick:()=>j(),color:"primary",disabled:!Zt(r,y)||!n||f,variant:"contained",autoFocus:!0,"data-cy":"save-mapping",children:[f&&e.jsx(M,{size:16}),a("common.save")]})]}),children:e.jsx(Jt,{children:e.jsxs("div",{className:"dialog-content",children:[e.jsx($,{fullWidth:!0,"data-cy":"input-issuer-did",placeholder:a("team.passport.issuerDid"),value:r,onChange:S=>{t(S.target.value)}}),e.jsx($,{style:{marginTop:16},fullWidth:!0,"data-cy":"input-issuer-remark",placeholder:a("common.remark"),value:n,onChange:S=>{c(S.target.value)}}),e.jsxs(g,{sx:{mt:"30px",display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsx(g,{className:"dialog-h1",children:a("team.passport.mappingRule")}),e.jsx(g,{children:e.jsx(L,{variant:"outlined",color:"primary","data-cy":"add-mapping",onClick:()=>{x(S=>{const T=[...S];return T.unshift({from:{passport:""},to:{role:U.ROLES.GUEST}}),T})},children:a("team.add")})})]}),e.jsxs(g,{className:"list",sx:{mt:-.5},children:[y.map((S,T)=>e.jsxs(g,{className:"mapping-item",sx:{display:"flex",alignItems:"center",justifyContent:"space-between",my:1},children:[e.jsxs(g,{sx:{display:"flex",alignItems:"center",flexGrow:1},children:[e.jsx(g,{sx:{flexGrow:1,flexBasis:1},children:e.jsx($,{fullWidth:!0,size:"small","data-cy":`input-${T}-from`,placeholder:"Issuer’s Passport Name/ID *",value:S.from.passport,onChange:b=>{const{value:P}=b.target;x(D=>{const B=[...D];return B[T].from.passport=P,B})},sx:{"& .MuiInputBase-input::placeholder":{fontSize:14},"& .Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"primary.main"}}})}),e.jsx(g,{sx:{flexShrink:0,mx:1,width:65,height:16},children:e.jsx(nt,{})}),e.jsx(g,{sx:{flexGrow:1,flexBasis:1},children:e.jsx($,{fullWidth:!0,size:"small",select:!0,value:S.to.role,onChange:b=>{x(P=>{const D=[...P];return D[T].to.role=b.target.value,D})},variant:"outlined",children:l.filter(b=>b.name!=="owner").map(b=>e.jsx(ae,{value:b.name,"data-cy":`passport-mapping-select-option-${b.name}`,children:e.jsx("span",{children:b.title||b.name})},b.name))})})]}),e.jsx(g,{sx:{flexShrink:0},children:e.jsx(W,{onClick:()=>{x(b=>{const P=[...b];return P.splice(T,1),P})},size:"large",children:e.jsx(ie,{})})})]},`mapping-${T}`)),!y.length&&e.jsx(g,{sx:{my:2,color:"text.secondary",fontSize:"16px"},children:e.jsx(xe,{children:a("common.empty")})})]})]})})})}ot.propTypes={onCancel:w.func.isRequired,onSuccess:w.func.isRequired,trustedPassports:w.array,data:w.object};const Jt=q.div`
|
|
91
91
|
.dialog-h1 {
|
|
92
92
|
font-size: 18px;
|
|
93
93
|
}
|
|
@@ -99,7 +99,7 @@ import{r as C,g as _e,a as ut}from"./vendor-react-Dvs43sk9.js";import{g as mt,k
|
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
-
`;function be({onCancel:u,hasPermission:o=!1}){const{api:i}=k(),{teamDid:p,trustedPassports:m}=
|
|
102
|
+
`;function be({onCancel:u,hasPermission:o=!1}){const{api:i}=k(),{teamDid:p,trustedPassports:m}=_(),{t:l}=F(),[h,a]=C.useState(null),[f,s]=C.useState(!1),[r,t]=C.useState(!1),[n,c]=C.useState(""),y=async d=>{if(f)return;const j=m.findIndex(T=>T.issuerDid===d);j===-1&&R.error("Cannot find passports");const S=[...m];S.splice(j,1);try{s(!0),await i.configTrustedPassports({input:{teamDid:p,trustedPassports:S}}),await se(800),s(!1),R.success(l("common.saveSuccess")),a(!1)}catch(T){s(!1),R.error(T.message)}},x=m.filter(d=>!n||d.issuerDid.toLowerCase().includes(n.toLowerCase()));return e.jsxs(H,{title:l("team.passport.trustedIssuers"),open:!0,onClose:u,fullWidth:!0,PaperProps:{style:{minHeight:"80vh"}},children:[e.jsx(ts,{children:e.jsxs("div",{className:"dialog-content",children:[e.jsx("div",{className:"dialog-h1",children:l("team.passport.trustedPassportIssuers")}),e.jsx(Qe,{sx:{mt:3},actions:e.jsxs(e.Fragment,{children:[e.jsx(Ue,{options:{searchPlaceholder:l("team.passport.searchIssuerDid"),searchDebounceTime:600},search:n,searchText:n,searchTextUpdate:c,searchClose:()=>c(""),onSearchOpen:()=>{}}),o&&e.jsxs(L,{variant:"contained",color:"primary","data-cy":"add-trusted-issuer",onClick:()=>t({mode:"add"}),children:[e.jsx(me,{style:{fontSize:16,marginRight:4}}),l("team.add")]})]})}),e.jsxs("div",{className:"list",children:[x.map(d=>e.jsxs(g,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mt:"20px"},children:[e.jsxs(g,{sx:{flexShrink:0},children:[e.jsx(he,{copyable:!1,size:16,did:Ge.toAddress(d.issuerDid),showDidLogo:!1}),!!d.remark&&e.jsx(g,{sx:{fontSize:12,maxWidth:"300px"},children:d.remark})]}),e.jsx(g,{sx:{color:"gray",ml:"28px",flexGrow:1},children:d.mappings&&d.mappings.length?`${d.mappings.length} ${l("team.passport.mappingRule")}`:l("team.passport.defaultRule")}),e.jsxs(g,{sx:{flexShrink:0,display:"flex",alignItems:"center"},children:[e.jsx(W,{onClick:()=>t({mode:"update",data:Z(d)}),"data-cy":"edit-mapping-rule",size:"large",children:e.jsx(oe,{})}),e.jsx(W,{"data-cy":"delete-mapping-rule",onClick:()=>a({title:l("common.delete"),description:l("common.delConfirmDescription",{data:d.issuerDid}),confirm:l("common.delConfirm"),cancel:l("common.cancel"),onConfirm:()=>y(d.issuerDid),onCancel:()=>{s(!1),a(null)}}),size:"large",children:e.jsx(ie,{})})]})]},d.issuerDid)),!m.length&&e.jsx(xe,{children:l("common.empty")})]})]})}),r&&e.jsx(ot,{mode:r.mode,data:r.data,trustedPassports:Z(m),onCancel:()=>t(null),onSuccess:()=>{t(null)}}),h&&e.jsx(ve,{title:h.title,description:h.description,confirm:h.confirm,cancel:h.cancel,params:h.params,onConfirm:h.onConfirm,onCancel:h.onCancel})]})}be.propTypes={onCancel:w.func.isRequired,hasPermission:w.bool};const Qt=G(be,"mutate_team"),Xt=G(be,"",J);function es(u){const{inService:o}=k();return o?e.jsx(Xt,{...u}):e.jsx(Qt,{...u})}const ts=q.div`
|
|
103
103
|
.list {
|
|
104
104
|
.MuiIconButton-root {
|
|
105
105
|
svg {
|
|
@@ -107,7 +107,7 @@ import{r as C,g as _e,a as ut}from"./vendor-react-Dvs43sk9.js";import{g as mt,k
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
`;var ss=Ot();const Re=
|
|
110
|
+
`;var ss=Ot();const Re=Me(ss);function it({onCancel:u,onSuccess:o,data:i={},trustedFactories:p=[]}){const{api:m}=k(),{roles:l,teamDid:h}=_(),{t:a}=F(),[f,s]=qt({loading:!1,fetching:!1,fetched:[],errored:[],factoryAddress:i.factoryAddress||"",remark:i.remark||"",role:i.passport?.role||"member",ttlPolicy:i.passport?.ttlPolicy||"never",ttl:Re(+i.passport?.ttl||365*24*60*60*1e3),error:""}),r=p.findIndex(x=>x.factoryAddress===i.factoryAddress),t=async()=>{if(f.loading)return;const{factoryAddress:x,remark:d,role:j,ttlPolicy:S,ttl:T}=f,b={factoryAddress:x,remark:d,passport:{role:j,ttlPolicy:S,ttl:S==="never"?0:Re(T)}},P=[...p];r===-1?P.unshift(b):P[r]=b;try{s({loading:!0}),await m.configTrustedFactories({input:{teamDid:h,trustedFactories:P}}),await se(800),R.success(a("common.saveSuccess")),o()}catch(D){console.error(D),R.error(te(D))}finally{s({loading:!1})}};C.useEffect(()=>{const x=f.fetched.find(j=>j.address===f.factoryAddress),d=f.errored.find(j=>j.address===f.factoryAddress);Ge.isValid(f.factoryAddress)&&!f.fetching&&!x&&!d&&(s({fetching:!0}),Lt(U.MAIN_CHAIN_ENDPOINT).getFactoryState({address:f.factoryAddress}).then(S=>{S.state?s({fetching:!1,fetched:[...f.fetched.filter(T=>T.address!==f.factoryAddress),S.state],remark:S.state.name}):s({fetching:!1,errored:[...f.errored.filter(T=>T.address!==f.factoryAddress),{address:f.factoryAddress}],error:a("team.passport.factory404",f)})}).catch(S=>{console.error(S),s({fetching:!1,error:te(S)})}))},[f.factoryAddress,f.fetching]);let n=f.error;const c=f.factoryAddress?f.errored.find(x=>x.address===f.factoryAddress):null;!n&&c&&(n=a("team.passport.factory404",f));const y=f.factoryAddress?f.fetched.find(x=>x.address===f.factoryAddress):null;return!n&&y&&(n=y.description),n||(n=a("team.passport.factoryAddressTip")),e.jsx(H,{title:a("team.passport.trustedFactories"),open:!0,showCloseButton:!1,PaperProps:{style:{minHeight:"80vh"}},fullWidth:!0,prepend:e.jsx(W,{onClick:u,"data-cy":"close-trusted-factory",size:"large",children:e.jsx($e,{})}),actions:e.jsxs(e.Fragment,{children:[e.jsx(L,{onClick:u,color:"inherit",children:a("common.cancel")}),e.jsxs(L,{onClick:()=>t(),color:"primary",disabled:!f.factoryAddress||!f.remark||!f.role||f.loading||f.error||c,variant:"contained",autoFocus:!0,"data-cy":"save-trusted-factory",children:[f.loading&&e.jsx(M,{size:16}),a("common.save")]})]}),children:e.jsx(rs,{children:e.jsxs("div",{className:"dialog-content",children:[e.jsx($,{fullWidth:!0,error:!!f.error||!!c,"data-cy":"input-factory-address",label:a("team.passport.factoryAddress"),helperText:n,value:f.factoryAddress,onChange:x=>{s({factoryAddress:x.target.value,error:""})},slotProps:{input:{endAdornment:f.fetching?e.jsx(gt,{position:"end",children:e.jsx(M,{size:16})}):null}}}),e.jsx($,{style:{marginTop:32},fullWidth:!0,"data-cy":"input-factory-remark",label:a("common.remark"),value:f.remark,onChange:x=>{s({remark:x.target.value})}}),e.jsx($,{style:{marginTop:32},fullWidth:!0,"data-cy":"input-passport-role",label:a("team.passport.role"),select:!0,value:f.role,onChange:x=>{s({role:x.target.value})},variant:"outlined",children:l.filter(x=>x.name!=="owner").map(x=>e.jsx(ae,{value:x.name,"data-cy":`passport-role-select-option-${x.name}`,children:e.jsx("span",{children:x.title||x.name})},x.name))}),e.jsxs("div",{style:{marginTop:32},children:[e.jsx(Oe,{children:a("team.passport.ttl")}),e.jsxs(We,{color:"primary",size:"small",value:f.ttlPolicy,exclusive:!0,style:{marginTop:16},onChange:(x,d)=>s({ttlPolicy:d}),"data-cy":"input-passport-ttl-since","aria-label":"Expire Policy",children:[e.jsx(X,{value:"never","data-cy":"input-passport-ttl-never",children:e.jsx(K,{title:a("team.passport.ttlNeverTip"),children:e.jsx(E,{children:a("team.passport.ttlNever")})})}),e.jsx(X,{value:"mint","data-cy":"input-passport-ttl-mint",children:e.jsx(K,{title:a("team.passport.ttlMintTip"),children:e.jsx(E,{children:a("team.passport.ttlMint")})})}),e.jsx(X,{value:"exchange","data-cy":"input-passport-ttl-exchange",children:e.jsx(K,{title:a("team.passport.ttlExchangeTip"),children:e.jsx(E,{children:a("team.passport.ttlExchange")})})})]}),f.ttlPolicy!=="never"&&e.jsxs(e.Fragment,{children:[e.jsx(qe,{fullWidth:!0,type:"text",style:{marginTop:16},"data-cy":"input-passport-ttl",value:f.ttl,onChange:x=>{s({ttl:x.target.value})}}),e.jsx(He,{children:a("team.passport.ttlTip")})]})]})]})})})}it.propTypes={onCancel:w.func.isRequired,onSuccess:w.func.isRequired,trustedFactories:w.array,data:w.object};const rs=q.div`
|
|
111
111
|
.dialog-h1 {
|
|
112
112
|
font-size: 18px;
|
|
113
113
|
}
|
|
@@ -119,7 +119,7 @@ import{r as C,g as _e,a as ut}from"./vendor-react-Dvs43sk9.js";import{g as mt,k
|
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
|
-
`;function Se({onCancel:u,hasPermission:o=!1}){const{api:i}=k(),{teamDid:p,trustedFactories:m}=
|
|
122
|
+
`;function Se({onCancel:u,hasPermission:o=!1}){const{api:i}=k(),{teamDid:p,trustedFactories:m}=_(),{t:l}=F(),[h,a]=C.useState(null),[f,s]=C.useState(!1),[r,t]=C.useState(null),[n,c]=C.useState(""),y=async d=>{if(!f)try{s(!0),await i.configTrustedFactories({input:{teamDid:p,trustedFactories:m.filter(j=>j.factoryAddress!==d)}}),await se(800),s(!1),R.success(l("common.saveSuccess")),a(null)}catch(j){s(!1),R.error(j.message)}},x=m.filter(d=>!n||d.factoryAddress.toLowerCase().includes(n.toLowerCase()));return e.jsxs(H,{title:l("team.passport.trustedFactories"),open:!0,onClose:u,fullWidth:!0,PaperProps:{style:{minHeight:"80vh"}},children:[e.jsx(is,{children:e.jsxs("div",{className:"dialog-content",children:[e.jsx("div",{className:"dialog-h1",children:l("team.passport.trustedFactoriesTip")}),e.jsx(Qe,{sx:{mt:3},actions:e.jsxs(e.Fragment,{children:[e.jsx(Ue,{options:{searchPlaceholder:l("team.passport.searchFactoryAddress"),searchDebounceTime:600},search:n,searchText:n,searchTextUpdate:c,searchClose:()=>c(""),onSearchOpen:()=>{}}),o&&e.jsxs(L,{variant:"contained",color:"primary",size:"small","data-cy":"add-trusted-factory",onClick:()=>t({mode:"add"}),children:[e.jsx(me,{style:{fontSize:16,marginRight:4}}),l("team.add")]})]})}),e.jsxs("div",{className:"list",children:[x.map(d=>e.jsxs(g,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",mt:"20px"},children:[e.jsxs(g,{sx:{flexGrow:1},children:[e.jsx(he,{copyable:!1,did:d.factoryAddress,size:16,showDidLogo:!1}),!!d.remark&&e.jsx(g,{sx:{fontSize:12,maxWidth:"300px"},children:d.remark})]}),e.jsx(g,{sx:{color:"gray",mr:"24px"},children:e.jsx(Dt,{type:"success",children:d.passport.role})}),e.jsxs(g,{sx:{flexShrink:0,display:"flex",alignItems:"center"},children:[e.jsx(W,{onClick:()=>t({mode:"update",data:Z(d)}),"data-cy":"edit-trusted-factory",size:"large",children:e.jsx(oe,{})}),e.jsx(W,{"data-cy":"delete-trusted-factory",onClick:()=>a({title:l("common.delete"),description:l("common.delConfirmDescription",{data:d.factoryAddress}),confirm:l("common.delConfirm"),cancel:l("common.cancel"),onConfirm:()=>y(d.factoryAddress),onCancel:()=>{s(!1),a(null)}}),size:"large",children:e.jsx(ie,{})})]})]},d.factoryAddress)),!m.length&&e.jsx(xe,{children:l("common.empty")})]})]})}),r&&e.jsx(it,{data:r.data,trustedFactories:Z(m),onCancel:()=>t(null),onSuccess:()=>{t(null)}}),h&&e.jsx(ve,{title:h.title,description:h.description,confirm:h.confirm,cancel:h.cancel,params:h.params,onConfirm:h.onConfirm,onCancel:h.onCancel})]})}Se.propTypes={onCancel:w.func.isRequired,hasPermission:w.bool};const as=G(Se,"mutate_team"),ns=G(Se,"",J);function os(u){const{inService:o}=k();return o?e.jsx(ns,{...u}):e.jsx(as,{...u})}const is=q.div`
|
|
123
123
|
.list {
|
|
124
124
|
.MuiIconButton-root {
|
|
125
125
|
svg {
|
|
@@ -132,7 +132,7 @@ import{r as C,g as _e,a as ut}from"./vendor-react-Dvs43sk9.js";import{g as mt,k
|
|
|
132
132
|
*
|
|
133
133
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
134
134
|
* @license MIT
|
|
135
|
-
*/var ue,Ne;function cs(){if(Ne)return ue;Ne=1,ue=function(i){return i!=null&&(u(i)||o(i)||!!i._isBuffer)};function u(i){return!!i.constructor&&typeof i.constructor.isBuffer=="function"&&i.constructor.isBuffer(i)}function o(i){return typeof i.readFloatLE=="function"&&typeof i.slice=="function"&&u(i.slice(0,0))}return ue}var Le;function ds(){return Le||(Le=1,function(){var u=ls(),o=Fe().utf8,i=cs(),p=Fe().bin,m=function(l,h){l.constructor==String?h&&h.encoding==="binary"?l=p.stringToBytes(l):l=o.stringToBytes(l):i(l)?l=Array.prototype.slice.call(l,0):!Array.isArray(l)&&l.constructor!==Uint8Array&&(l=l.toString());for(var a=u.bytesToWords(l),f=l.length*8,s=1732584193,r=-271733879,t=-1732584194,n=271733878,c=0;c<a.length;c++)a[c]=(a[c]<<8|a[c]>>>24)&16711935|(a[c]<<24|a[c]>>>8)&4278255360;a[f>>>5]|=128<<f%32,a[(f+64>>>9<<4)+14]=f;for(var y=m._ff,x=m._gg,d=m._hh,j=m._ii,c=0;c<a.length;c+=16){var S=s,w=r,b=t,P=n;s=y(s,r,t,n,a[c+0],7,-680876936),n=y(n,s,r,t,a[c+1],12,-389564586),t=y(t,n,s,r,a[c+2],17,606105819),r=y(r,t,n,s,a[c+3],22,-1044525330),s=y(s,r,t,n,a[c+4],7,-176418897),n=y(n,s,r,t,a[c+5],12,1200080426),t=y(t,n,s,r,a[c+6],17,-1473231341),r=y(r,t,n,s,a[c+7],22,-45705983),s=y(s,r,t,n,a[c+8],7,1770035416),n=y(n,s,r,t,a[c+9],12,-1958414417),t=y(t,n,s,r,a[c+10],17,-42063),r=y(r,t,n,s,a[c+11],22,-1990404162),s=y(s,r,t,n,a[c+12],7,1804603682),n=y(n,s,r,t,a[c+13],12,-40341101),t=y(t,n,s,r,a[c+14],17,-1502002290),r=y(r,t,n,s,a[c+15],22,1236535329),s=x(s,r,t,n,a[c+1],5,-165796510),n=x(n,s,r,t,a[c+6],9,-1069501632),t=x(t,n,s,r,a[c+11],14,643717713),r=x(r,t,n,s,a[c+0],20,-373897302),s=x(s,r,t,n,a[c+5],5,-701558691),n=x(n,s,r,t,a[c+10],9,38016083),t=x(t,n,s,r,a[c+15],14,-660478335),r=x(r,t,n,s,a[c+4],20,-405537848),s=x(s,r,t,n,a[c+9],5,568446438),n=x(n,s,r,t,a[c+14],9,-1019803690),t=x(t,n,s,r,a[c+3],14,-187363961),r=x(r,t,n,s,a[c+8],20,1163531501),s=x(s,r,t,n,a[c+13],5,-1444681467),n=x(n,s,r,t,a[c+2],9,-51403784),t=x(t,n,s,r,a[c+7],14,1735328473),r=x(r,t,n,s,a[c+12],20,-1926607734),s=d(s,r,t,n,a[c+5],4,-378558),n=d(n,s,r,t,a[c+8],11,-2022574463),t=d(t,n,s,r,a[c+11],16,1839030562),r=d(r,t,n,s,a[c+14],23,-35309556),s=d(s,r,t,n,a[c+1],4,-1530992060),n=d(n,s,r,t,a[c+4],11,1272893353),t=d(t,n,s,r,a[c+7],16,-155497632),r=d(r,t,n,s,a[c+10],23,-1094730640),s=d(s,r,t,n,a[c+13],4,681279174),n=d(n,s,r,t,a[c+0],11,-358537222),t=d(t,n,s,r,a[c+3],16,-722521979),r=d(r,t,n,s,a[c+6],23,76029189),s=d(s,r,t,n,a[c+9],4,-640364487),n=d(n,s,r,t,a[c+12],11,-421815835),t=d(t,n,s,r,a[c+15],16,530742520),r=d(r,t,n,s,a[c+2],23,-995338651),s=j(s,r,t,n,a[c+0],6,-198630844),n=j(n,s,r,t,a[c+7],10,1126891415),t=j(t,n,s,r,a[c+14],15,-1416354905),r=j(r,t,n,s,a[c+5],21,-57434055),s=j(s,r,t,n,a[c+12],6,1700485571),n=j(n,s,r,t,a[c+3],10,-1894986606),t=j(t,n,s,r,a[c+10],15,-1051523),r=j(r,t,n,s,a[c+1],21,-2054922799),s=j(s,r,t,n,a[c+8],6,1873313359),n=j(n,s,r,t,a[c+15],10,-30611744),t=j(t,n,s,r,a[c+6],15,-1560198380),r=j(r,t,n,s,a[c+13],21,1309151649),s=j(s,r,t,n,a[c+4],6,-145523070),n=j(n,s,r,t,a[c+11],10,-1120210379),t=j(t,n,s,r,a[c+2],15,718787259),r=j(r,t,n,s,a[c+9],21,-343485551),s=s+S>>>0,r=r+w>>>0,t=t+b>>>0,n=n+P>>>0}return u.endian([s,r,t,n])};m._ff=function(l,h,a,f,s,r,t){var n=l+(h&a|~h&f)+(s>>>0)+t;return(n<<r|n>>>32-r)+h},m._gg=function(l,h,a,f,s,r,t){var n=l+(h&f|a&~f)+(s>>>0)+t;return(n<<r|n>>>32-r)+h},m._hh=function(l,h,a,f,s,r,t){var n=l+(h^a^f)+(s>>>0)+t;return(n<<r|n>>>32-r)+h},m._ii=function(l,h,a,f,s,r,t){var n=l+(a^(h|~f))+(s>>>0)+t;return(n<<r|n>>>32-r)+h},m._blocksize=16,m._digestsize=16,ce.exports=function(l,h){if(l==null)throw new Error("Illegal argument "+l);var a=u.wordsToBytes(m(l,h));return h&&h.asBytes?a:h&&h.asString?p.bytesToString(a):u.bytesToHex(a)}}()),ce.exports}var ps=ds();const us=_e(ps);function Te({teamDid:u,onCancel:o,onSuccess:i,onError:p=()=>{},mode:m="create",item:l={}}){const{api:h}=k(),[a,f]=C.useState(!1),[s,r]=C.useState(""),{t}=F(),[n,c]=C.useState(l.title||""),[y,x]=C.useState(l.description||""),[d,j]=C.useState(l?.extra?.display||"builtin"),[S,w]=C.useState(l?.extra?.types?l.extra.types.join(","):""),b=async()=>{const D=n.trim();if(!D){r(t("team.passport.error.titleEmpty"));return}if(D.length>64){r(t("team.passport.error.titleTooLong",{length:64}));return}const B=y.replace(/\n/g," ");if(!B){r(t("team.passport.error.descriptionEmpty"));return}const V=m==="create"?us(D):l.name;r(null),f(!0);try{if(m==="create"){const z={teamDid:u,name:V,title:D,description:B};d==="custom"&&(z.extra=JSON.stringify({display:"custom",types:S.split(",")})),await h.createRole({input:z})}else{const z={teamDid:u,role:{name:V,title:D,description:B}};await h.updateRole({input:z})}i()}catch(z){const Y=te(z);r(Y),p(z)}finally{f(!1)}},P=e.jsxs("div",{children:[m==="update"&&e.jsx(E,{component:"div",style:{paddingTop:16},children:e.jsx($,{label:"ID",autoComplete:"off",variant:"outlined",name:"url","data-cy":"mutate-role-input-name",fullWidth:!0,autoFocus:!0,value:l.name,disabled:!0})}),e.jsx(E,{component:"div",style:{marginTop:16},children:e.jsx($,{label:t("common.title"),autoComplete:"off",variant:"outlined",name:"title","data-cy":"mutate-role-input-title",fullWidth:!0,autoFocus:!0,value:n,onChange:D=>{r(null),c(D.target.value)},disabled:m==="update"||a,helperText:t("team.passport.create.titleTip")})}),e.jsx(E,{component:"div",style:{marginTop:16,marginBottom:16},children:e.jsx($,{label:t("common.description"),autoComplete:"off",variant:"outlined",name:"description","data-cy":"mutate-role-input-description",fullWidth:!0,autoFocus:!0,value:y,onChange:D=>{r(null),x(D.target.value)},disabled:a,multiline:!0,rows:3})}),m==="create"&&e.jsxs("div",{style:{marginBottom:16},children:[e.jsx(Oe,{children:t("common.display")}),e.jsxs(We,{color:"primary",size:"small",value:d,exclusive:!0,style:{marginTop:16},disabled:a,onChange:(D,B)=>j(B),"data-cy":"input-role-display",children:[e.jsx(X,{value:"builtin","data-cy":"input-role-display-builtin",children:e.jsx(E,{children:t("team.passport.displayBuiltin")})}),e.jsx(X,{value:"custom","data-cy":"input-role-display-custom",children:e.jsx(E,{children:t("team.passport.displayCustom")})})]}),d==="custom"&&e.jsxs(e.Fragment,{children:[e.jsx(qe,{fullWidth:!0,type:"text",style:{marginTop:16},"data-cy":"input-role-types",value:S,disabled:a,onChange:D=>{w(D.target.value)}}),e.jsx(He,{children:t("team.passport.typesTip")})]})]})]});return e.jsxs(H,{title:m==="create"?t("team.passport.create.title"):"",fullWidth:!0,open:!0,onClose:o,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[e.jsx(L,{onClick:o,color:"inherit",children:t("common.cancel")}),e.jsxs(L,{"data-cy":"mutate-role-confirm",onClick:b,color:"primary",disabled:a,variant:"contained",autoFocus:!0,children:[a&&e.jsx(_,{size:16}),t(m==="create"?"common.create":"common.update")]})]}),children:[e.jsx(yt,{component:"div",children:P}),!!s&&e.jsx(Me,{severity:"error",variant:"icon",style:{width:"100%",margin:0},children:s})]})}Te.propTypes={teamDid:T.string.isRequired,onCancel:T.func.isRequired,onSuccess:T.func.isRequired,onError:T.func,mode:T.oneOf(["create","update"]),item:T.object};function we({onCancel:u,onSuccess:o,onDelete:i,roleName:p,hasPermission:m=!1}){const{api:l}=k(),{roles:h,permissions:a,teamDid:f,refresh:s,isNodeTeam:r}=M(),{t}=F(),[n,c]=C.useState([]),[y,x]=C.useState(!1),[d,j]=C.useState(null),[S,w]=C.useState(!1),b=Z(h.find(A=>A.name===p)),P=Ye(p),D=async A=>{if(!S)try{w(!0),await l.deleteRole({input:{teamDid:f,name:A}}),i()}catch(v){R.error(v.message)}finally{w(!1),j(null)}},B=async(A,v)=>{const N=(await l.getPermissionsByRole({input:{teamDid:A,role:{name:v}}})).permissions||[],O=a.map(De=>({...De,bind:N.some(pt=>pt.name===De.name)}));c(O)},V=async()=>{w(!0);const A=n.filter(v=>v.bind).map(v=>v.name);try{await l.updatePermissionsForRole({input:{teamDid:f,roleName:b.name,grantNames:A}}),R.success(t("common.saveSuccess")),o()}catch(v){R.error(te(v))}finally{w(!1)}};C.useEffect(()=>{f&&p&&B(f,p)},[f,p]);const z=r||!m;let Y=null;return r&&(Y=e.jsxs("div",{className:"bind",children:[e.jsx("div",{className:"title",children:t("common.permission")}),e.jsx("div",{className:"list",children:n.filter(A=>z?A.bind:!0).map(A=>e.jsx("div",{className:"item",children:e.jsx(jt,{control:e.jsx(vt,{disabled:z,checked:A.bind,onChange:()=>{c(v=>v.map(I=>(I.name===A.name&&(I.bind=!I.bind),I)))},name:A.name}),label:A.description})}))})]})),e.jsxs(H,{title:t("common.passport"),onClose:u,open:!0,fullWidth:!0,toolbar:m&&!P&&e.jsxs(e.Fragment,{children:[e.jsx(W,{onClick:()=>x(b),"data-cy":`edit-passport-${b.name}`,size:"large",children:e.jsx(oe,{fill:"#bfbfbf"})}),e.jsx(W,{onClick:()=>j({title:t("team.passport.delete.title"),description:t("team.passport.delete.description",{name:b.title}),confirm:t("common.delConfirm"),cancel:t("common.cancel"),onConfirm:()=>{D(b.name)},onCancel:()=>{w(!1),j(null)}}),"data-cy":`delete-passport-${b.name}`,size:"large",children:e.jsx(ie,{"data-cy":"close-passport-dialog",fill:"#bfbfbf"})})]}),actions:r&&!z&&e.jsxs(e.Fragment,{children:[e.jsx(L,{onClick:u,color:"inherit",children:t("common.cancel")}),e.jsxs(L,{onClick:V,color:"primary",disabled:S||!b,variant:"contained",autoFocus:!0,"data-cy":"bind-permission-btn-confirm",children:[S&&e.jsx(_,{size:16}),t("common.save")]})]}),children:[e.jsxs(hs,{children:[!b&&e.jsx(gs,{children:e.jsx(_,{})}),b&&e.jsxs("div",{className:"dialog-content",children:[e.jsxs("div",{className:"header",children:[e.jsx("div",{className:"title",children:b.title}),e.jsx("div",{className:"description",style:{marginTop:r?16:48},children:b.description})]}),Y]})]}),y&&e.jsx(Te,{teamDid:f,onCancel:()=>x(null),onSuccess:()=>{x(null),s()},mode:"update",roleName:y.name,item:y}),d&&e.jsx(ve,{title:d.title,description:d.description,confirm:d.confirm,cancel:d.cancel,params:d.params,onConfirm:d.onConfirm,onCancel:d.onCancel})]})}const ms=G(we,"mutate_team"),fs=G(we,"",J);function xs(u){const{inService:o}=k();return o?e.jsx(fs,{...u}):e.jsx(ms,{...u})}we.propTypes={roleName:T.string.isRequired,onCancel:T.func.isRequired,onSuccess:T.func.isRequired,onDelete:T.func.isRequired,hasPermission:T.bool};const hs=q.div`
|
|
135
|
+
*/var ue,Ne;function cs(){if(Ne)return ue;Ne=1,ue=function(i){return i!=null&&(u(i)||o(i)||!!i._isBuffer)};function u(i){return!!i.constructor&&typeof i.constructor.isBuffer=="function"&&i.constructor.isBuffer(i)}function o(i){return typeof i.readFloatLE=="function"&&typeof i.slice=="function"&&u(i.slice(0,0))}return ue}var Le;function ds(){return Le||(Le=1,function(){var u=ls(),o=Fe().utf8,i=cs(),p=Fe().bin,m=function(l,h){l.constructor==String?h&&h.encoding==="binary"?l=p.stringToBytes(l):l=o.stringToBytes(l):i(l)?l=Array.prototype.slice.call(l,0):!Array.isArray(l)&&l.constructor!==Uint8Array&&(l=l.toString());for(var a=u.bytesToWords(l),f=l.length*8,s=1732584193,r=-271733879,t=-1732584194,n=271733878,c=0;c<a.length;c++)a[c]=(a[c]<<8|a[c]>>>24)&16711935|(a[c]<<24|a[c]>>>8)&4278255360;a[f>>>5]|=128<<f%32,a[(f+64>>>9<<4)+14]=f;for(var y=m._ff,x=m._gg,d=m._hh,j=m._ii,c=0;c<a.length;c+=16){var S=s,T=r,b=t,P=n;s=y(s,r,t,n,a[c+0],7,-680876936),n=y(n,s,r,t,a[c+1],12,-389564586),t=y(t,n,s,r,a[c+2],17,606105819),r=y(r,t,n,s,a[c+3],22,-1044525330),s=y(s,r,t,n,a[c+4],7,-176418897),n=y(n,s,r,t,a[c+5],12,1200080426),t=y(t,n,s,r,a[c+6],17,-1473231341),r=y(r,t,n,s,a[c+7],22,-45705983),s=y(s,r,t,n,a[c+8],7,1770035416),n=y(n,s,r,t,a[c+9],12,-1958414417),t=y(t,n,s,r,a[c+10],17,-42063),r=y(r,t,n,s,a[c+11],22,-1990404162),s=y(s,r,t,n,a[c+12],7,1804603682),n=y(n,s,r,t,a[c+13],12,-40341101),t=y(t,n,s,r,a[c+14],17,-1502002290),r=y(r,t,n,s,a[c+15],22,1236535329),s=x(s,r,t,n,a[c+1],5,-165796510),n=x(n,s,r,t,a[c+6],9,-1069501632),t=x(t,n,s,r,a[c+11],14,643717713),r=x(r,t,n,s,a[c+0],20,-373897302),s=x(s,r,t,n,a[c+5],5,-701558691),n=x(n,s,r,t,a[c+10],9,38016083),t=x(t,n,s,r,a[c+15],14,-660478335),r=x(r,t,n,s,a[c+4],20,-405537848),s=x(s,r,t,n,a[c+9],5,568446438),n=x(n,s,r,t,a[c+14],9,-1019803690),t=x(t,n,s,r,a[c+3],14,-187363961),r=x(r,t,n,s,a[c+8],20,1163531501),s=x(s,r,t,n,a[c+13],5,-1444681467),n=x(n,s,r,t,a[c+2],9,-51403784),t=x(t,n,s,r,a[c+7],14,1735328473),r=x(r,t,n,s,a[c+12],20,-1926607734),s=d(s,r,t,n,a[c+5],4,-378558),n=d(n,s,r,t,a[c+8],11,-2022574463),t=d(t,n,s,r,a[c+11],16,1839030562),r=d(r,t,n,s,a[c+14],23,-35309556),s=d(s,r,t,n,a[c+1],4,-1530992060),n=d(n,s,r,t,a[c+4],11,1272893353),t=d(t,n,s,r,a[c+7],16,-155497632),r=d(r,t,n,s,a[c+10],23,-1094730640),s=d(s,r,t,n,a[c+13],4,681279174),n=d(n,s,r,t,a[c+0],11,-358537222),t=d(t,n,s,r,a[c+3],16,-722521979),r=d(r,t,n,s,a[c+6],23,76029189),s=d(s,r,t,n,a[c+9],4,-640364487),n=d(n,s,r,t,a[c+12],11,-421815835),t=d(t,n,s,r,a[c+15],16,530742520),r=d(r,t,n,s,a[c+2],23,-995338651),s=j(s,r,t,n,a[c+0],6,-198630844),n=j(n,s,r,t,a[c+7],10,1126891415),t=j(t,n,s,r,a[c+14],15,-1416354905),r=j(r,t,n,s,a[c+5],21,-57434055),s=j(s,r,t,n,a[c+12],6,1700485571),n=j(n,s,r,t,a[c+3],10,-1894986606),t=j(t,n,s,r,a[c+10],15,-1051523),r=j(r,t,n,s,a[c+1],21,-2054922799),s=j(s,r,t,n,a[c+8],6,1873313359),n=j(n,s,r,t,a[c+15],10,-30611744),t=j(t,n,s,r,a[c+6],15,-1560198380),r=j(r,t,n,s,a[c+13],21,1309151649),s=j(s,r,t,n,a[c+4],6,-145523070),n=j(n,s,r,t,a[c+11],10,-1120210379),t=j(t,n,s,r,a[c+2],15,718787259),r=j(r,t,n,s,a[c+9],21,-343485551),s=s+S>>>0,r=r+T>>>0,t=t+b>>>0,n=n+P>>>0}return u.endian([s,r,t,n])};m._ff=function(l,h,a,f,s,r,t){var n=l+(h&a|~h&f)+(s>>>0)+t;return(n<<r|n>>>32-r)+h},m._gg=function(l,h,a,f,s,r,t){var n=l+(h&f|a&~f)+(s>>>0)+t;return(n<<r|n>>>32-r)+h},m._hh=function(l,h,a,f,s,r,t){var n=l+(h^a^f)+(s>>>0)+t;return(n<<r|n>>>32-r)+h},m._ii=function(l,h,a,f,s,r,t){var n=l+(a^(h|~f))+(s>>>0)+t;return(n<<r|n>>>32-r)+h},m._blocksize=16,m._digestsize=16,ce.exports=function(l,h){if(l==null)throw new Error("Illegal argument "+l);var a=u.wordsToBytes(m(l,h));return h&&h.asBytes?a:h&&h.asString?p.bytesToString(a):u.bytesToHex(a)}}()),ce.exports}var ps=ds();const us=Me(ps);function we({teamDid:u,onCancel:o,onSuccess:i,onError:p=()=>{},mode:m="create",item:l={}}){const{api:h}=k(),[a,f]=C.useState(!1),[s,r]=C.useState(""),{t}=F(),[n,c]=C.useState(l.title||""),[y,x]=C.useState(l.description||""),[d,j]=C.useState(l?.extra?.display||"builtin"),[S,T]=C.useState(l?.extra?.types?l.extra.types.join(","):""),b=async()=>{const D=n.trim();if(!D){r(t("team.passport.error.titleEmpty"));return}if(D.length>64){r(t("team.passport.error.titleTooLong",{length:64}));return}const B=y.replace(/\n/g," ");if(!B){r(t("team.passport.error.descriptionEmpty"));return}const V=m==="create"?us(D):l.name;r(null),f(!0);try{if(m==="create"){const z={teamDid:u,name:V,title:D,description:B};d==="custom"&&(z.extra=JSON.stringify({display:"custom",types:S.split(",")})),await h.createRole({input:z})}else{const z={teamDid:u,role:{name:V,title:D,description:B}};await h.updateRole({input:z})}i()}catch(z){const Y=te(z);r(Y),p(z)}finally{f(!1)}},P=e.jsxs("div",{children:[m==="update"&&e.jsx(E,{component:"div",style:{paddingTop:16},children:e.jsx($,{label:"ID",autoComplete:"off",variant:"outlined",name:"url","data-cy":"mutate-role-input-name",fullWidth:!0,autoFocus:!0,value:l.name,disabled:!0})}),e.jsx(E,{component:"div",style:{marginTop:16},children:e.jsx($,{label:t("common.title"),autoComplete:"off",variant:"outlined",name:"title","data-cy":"mutate-role-input-title",fullWidth:!0,autoFocus:!0,value:n,onChange:D=>{r(null),c(D.target.value)},disabled:m==="update"||a,helperText:t("team.passport.create.titleTip")})}),e.jsx(E,{component:"div",style:{marginTop:16,marginBottom:16},children:e.jsx($,{label:t("common.description"),autoComplete:"off",variant:"outlined",name:"description","data-cy":"mutate-role-input-description",fullWidth:!0,autoFocus:!0,value:y,onChange:D=>{r(null),x(D.target.value)},disabled:a,multiline:!0,rows:3})}),m==="create"&&e.jsxs("div",{style:{marginBottom:16},children:[e.jsx(Oe,{children:t("common.display")}),e.jsxs(We,{color:"primary",size:"small",value:d,exclusive:!0,style:{marginTop:16},disabled:a,onChange:(D,B)=>j(B),"data-cy":"input-role-display",children:[e.jsx(X,{value:"builtin","data-cy":"input-role-display-builtin",children:e.jsx(E,{children:t("team.passport.displayBuiltin")})}),e.jsx(X,{value:"custom","data-cy":"input-role-display-custom",children:e.jsx(E,{children:t("team.passport.displayCustom")})})]}),d==="custom"&&e.jsxs(e.Fragment,{children:[e.jsx(qe,{fullWidth:!0,type:"text",style:{marginTop:16},"data-cy":"input-role-types",value:S,disabled:a,onChange:D=>{T(D.target.value)}}),e.jsx(He,{children:t("team.passport.typesTip")})]})]})]});return e.jsxs(H,{title:m==="create"?t("team.passport.create.title"):"",fullWidth:!0,open:!0,onClose:o,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[e.jsx(L,{onClick:o,color:"inherit",children:t("common.cancel")}),e.jsxs(L,{"data-cy":"mutate-role-confirm",onClick:b,color:"primary",disabled:a,variant:"contained",autoFocus:!0,children:[a&&e.jsx(M,{size:16}),t(m==="create"?"common.create":"common.update")]})]}),children:[e.jsx(yt,{component:"div",children:P}),!!s&&e.jsx(_e,{severity:"error",variant:"icon",style:{width:"100%",margin:0},children:s})]})}we.propTypes={teamDid:w.string.isRequired,onCancel:w.func.isRequired,onSuccess:w.func.isRequired,onError:w.func,mode:w.oneOf(["create","update"]),item:w.object};function Te({onCancel:u,onSuccess:o,onDelete:i,roleName:p,hasPermission:m=!1}){const{api:l}=k(),{roles:h,permissions:a,teamDid:f,refresh:s,isNodeTeam:r}=_(),{t}=F(),[n,c]=C.useState([]),[y,x]=C.useState(!1),[d,j]=C.useState(null),[S,T]=C.useState(!1),b=Z(h.find(A=>A.name===p)),P=Ye(p),D=async A=>{if(!S)try{T(!0),await l.deleteRole({input:{teamDid:f,name:A}}),i()}catch(v){R.error(v.message)}finally{T(!1),j(null)}},B=async(A,v)=>{const N=(await l.getPermissionsByRole({input:{teamDid:A,role:{name:v}}})).permissions||[],O=a.map(De=>({...De,bind:N.some(pt=>pt.name===De.name)}));c(O)},V=async()=>{T(!0);const A=n.filter(v=>v.bind).map(v=>v.name);try{await l.updatePermissionsForRole({input:{teamDid:f,roleName:b.name,grantNames:A}}),R.success(t("common.saveSuccess")),o()}catch(v){R.error(te(v))}finally{T(!1)}};C.useEffect(()=>{f&&p&&B(f,p)},[f,p]);const z=r||!m;let Y=null;return r&&(Y=e.jsxs("div",{className:"bind",children:[e.jsx("div",{className:"title",children:t("common.permission")}),e.jsx("div",{className:"list",children:n.filter(A=>z?A.bind:!0).map(A=>e.jsx("div",{className:"item",children:e.jsx(jt,{control:e.jsx(vt,{disabled:z,checked:A.bind,onChange:()=>{c(v=>v.map(I=>(I.name===A.name&&(I.bind=!I.bind),I)))},name:A.name}),label:A.description})}))})]})),e.jsxs(H,{title:t("common.passport"),onClose:u,open:!0,fullWidth:!0,toolbar:m&&!P&&e.jsxs(e.Fragment,{children:[e.jsx(W,{onClick:()=>x(b),"data-cy":`edit-passport-${b.name}`,size:"large",children:e.jsx(oe,{fill:"#bfbfbf"})}),e.jsx(W,{onClick:()=>j({title:t("team.passport.delete.title"),description:t("team.passport.delete.description",{name:b.title}),confirm:t("common.delConfirm"),cancel:t("common.cancel"),onConfirm:()=>{D(b.name)},onCancel:()=>{T(!1),j(null)}}),"data-cy":`delete-passport-${b.name}`,size:"large",children:e.jsx(ie,{"data-cy":"close-passport-dialog",fill:"#bfbfbf"})})]}),actions:r&&!z&&e.jsxs(e.Fragment,{children:[e.jsx(L,{onClick:u,color:"inherit",children:t("common.cancel")}),e.jsxs(L,{onClick:V,color:"primary",disabled:S||!b,variant:"contained",autoFocus:!0,"data-cy":"bind-permission-btn-confirm",children:[S&&e.jsx(M,{size:16}),t("common.save")]})]}),children:[e.jsxs(hs,{children:[!b&&e.jsx(gs,{children:e.jsx(M,{})}),b&&e.jsxs("div",{className:"dialog-content",children:[e.jsxs("div",{className:"header",children:[e.jsx("div",{className:"title",children:b.title}),e.jsx("div",{className:"description",style:{marginTop:r?16:48},children:b.description})]}),Y]})]}),y&&e.jsx(we,{teamDid:f,onCancel:()=>x(null),onSuccess:()=>{x(null),s()},mode:"update",roleName:y.name,item:y}),d&&e.jsx(ve,{title:d.title,description:d.description,confirm:d.confirm,cancel:d.cancel,params:d.params,onConfirm:d.onConfirm,onCancel:d.onCancel})]})}const ms=G(Te,"mutate_team"),fs=G(Te,"",J);function xs(u){const{inService:o}=k();return o?e.jsx(fs,{...u}):e.jsx(ms,{...u})}Te.propTypes={roleName:w.string.isRequired,onCancel:w.func.isRequired,onSuccess:w.func.isRequired,onDelete:w.func.isRequired,hasPermission:w.bool};const hs=q.div`
|
|
136
136
|
.header {
|
|
137
137
|
.title {
|
|
138
138
|
font-weight: 400;
|
|
@@ -181,7 +181,7 @@ import{r as C,g as _e,a as ut}from"./vendor-react-Dvs43sk9.js";import{g as mt,k
|
|
|
181
181
|
justify-content: center;
|
|
182
182
|
align-items: center;
|
|
183
183
|
height: 200px;
|
|
184
|
-
`,Be=C.memo(({field:u,value:o,copyable:i})=>{const{local:p}=F();return o?e.jsxs(g,{onClick:m=>m.stopPropagation(),sx:{display:"flex",alignItems:"center",gap:1},children:[u?e.jsxs(Ie,{variant:"subtitle1",color:"textSecondary",sx:{width:50,textAlign:"right"},children:[u,":"]}):null,e.jsx(Ie,{variant:"body1",children:e.jsxs(g,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(K,{title:o,children:e.jsx("span",{className:"value-ellipsis",children:o})}),i?e.jsx(It,{content:Wt(o),locale:p,style:{marginLeft:"4px",color:"#999",fontSize:"0.8em",verticalAlign:"bottom"}}):null]})})]}):null});function lt({createPassportSvg:u}){const{inService:o}=k(),{roles:i,teamIssuerDid:p,teamName:m,refresh:l,passportColor:h,teamDid:a,isNodeTeam:f}=
|
|
184
|
+
`,Be=C.memo(({field:u,value:o,copyable:i})=>{const{local:p}=F();return o?e.jsxs(g,{onClick:m=>m.stopPropagation(),sx:{display:"flex",alignItems:"center",gap:1},children:[u?e.jsxs(Ie,{variant:"subtitle1",color:"textSecondary",sx:{width:50,textAlign:"right"},children:[u,":"]}):null,e.jsx(Ie,{variant:"body1",children:e.jsxs(g,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(K,{title:o,children:e.jsx("span",{className:"value-ellipsis",children:o})}),i?e.jsx(It,{content:Wt(o),locale:p,style:{marginLeft:"4px",color:"#999",fontSize:"0.8em",verticalAlign:"bottom"}}):null]})})]}):null});function lt({createPassportSvg:u}){const{inService:o}=k(),{roles:i,teamIssuerDid:p,teamName:m,refresh:l,passportColor:h,teamDid:a,isNodeTeam:f}=_(),{t:s}=F(),[r,t]=C.useState(!1),[n,c]=C.useState(!1),y=Ct(d=>d.breakpoints.down("md")),x=C.useCallback(d=>d&&!U.ROLES[d.toUpperCase()],[]);return e.jsxs(ys,{sx:{mt:0},children:[e.jsx(g,{sx:{display:"flex",justifyContent:"flex-end"},children:!f&&e.jsxs(bt,{variant:"contained",edge:"end",color:"primary","data-cy":"create-role",onClick:()=>t(!0),children:[e.jsx(me,{style:{fontSize:16,marginRight:4}}),s("team.passport.create.title")]})}),e.jsx(g,{className:"list",children:i.map(d=>e.jsxs(g,{"data-cy":`passport-${d.name}`,className:"item",onClick:()=>c(d),sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs(g,{sx:{display:"flex",alignItems:"center"},children:[e.jsx("div",{style:{width:150},dangerouslySetInnerHTML:{__html:u({title:d.title,issuer:m,issuerDid:p,ownerName:"Your Name",ownerDid:p,preferredColor:h,width:"150px"})}}),e.jsxs(g,{className:"title",sx:{ml:3},children:[e.jsx(Be,{value:d.title}),x(d.name)?e.jsx(Be,{value:d.name,copyable:!0}):null]})]}),!y&&e.jsx(g,{className:"description",children:d.description}),e.jsx(Je,{permission:o?"":"mutate_team",role:o?J:[],children:e.jsx("div",{className:"action",children:Ye(d.name)?e.jsx(Ht,{}):e.jsx(oe,{})})})]},d.name))}),n&&e.jsx(xs,{onCancel:()=>c(!1),onSuccess:()=>{c(!1),l()},onDelete:()=>{c(!1),l()},mode:"update",roleName:n.name,item:n}),r&&e.jsx(we,{teamDid:a,onCancel:()=>t(!1),onSuccess:()=>{t(!1),l()}})]})}const ys=q(g)`
|
|
185
185
|
.list {
|
|
186
186
|
.item {
|
|
187
187
|
padding: 12px;
|
|
@@ -219,7 +219,7 @@ import{r as C,g as _e,a as ut}from"./vendor-react-Dvs43sk9.js";import{g as mt,k
|
|
|
219
219
|
fill: ${({theme:u})=>u.palette.text.secondary};
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
|
-
`;lt.propTypes={createPassportSvg:
|
|
222
|
+
`;lt.propTypes={createPassportSvg:w.func.isRequired};function ct({createPassportSvg:u}){const{t:o}=F(),{api:i,inService:p}=k(),{teamDid:m,refresh:l,enablePassportIssuance:h,isNodeTeam:a}=_(),[f,s]=C.useState(!1),[r,t]=C.useState(!1),[n,c]=C.useState(!1),[y,x]=C.useState(!1),[d,j]=C.useState(!1),S=async T=>{if(T.stopPropagation(),!y){x(!0);try{await i.configPassportIssuance({input:{teamDid:m,enable:!h}}),l(),await se(800),R.success(o("common.configSuccess"))}catch(b){R.error(b.message)}finally{x(!1)}}};return e.jsxs(g,{sx:{display:"flex",alignItems:"center",gap:1,ml:1},children:[e.jsx(Je,{permission:p?"":"mutate_team",role:p?J:[],children:e.jsx(Q,{variant:"outlined",menuButtonProps:{"data-cy":"trusted-issuers-more"},menu:e.jsxs(e.Fragment,{children:[e.jsx(Q.Item,{onClick:()=>t(!0),"data-cy":"config-trusted-issuers",children:e.jsxs(g,{children:[o("team.passport.trustedPassportIssuers"),e.jsx(g,{sx:{fontSize:12,color:"#888"},children:o("team.passport.trustedPassportIssuersTip")})]})}),e.jsx(Q.Item,{onClick:()=>c(!0),"data-cy":"config-show-trusted-factories",children:e.jsxs(g,{children:[o("team.passport.configFactories"),e.jsx(g,{sx:{fontSize:12,color:"#888"},children:o("team.passport.configFactoriesTip")})]})}),e.jsx(Q.Item,{"data-cy":"config-show-issue-passport",onClick:S,children:e.jsxs(g,{sx:{display:"flex",alignItems:"center"},children:[y&&e.jsx(M,{size:16,style:{marginRight:8}}),e.jsxs(g,{children:[o(h?"team.passport.disableIssuance":"team.passport.enableIssuance"),e.jsx(g,{sx:{fontSize:12,color:"#888"},children:o(h?"team.passport.disableIssuanceTip":"team.passport.enableIssuanceTip")})]})]})}),!a&&e.jsx(Q.Item,{onClick:()=>s(!0),"data-cy":"config-passport-color",children:e.jsxs(g,{children:[o("team.passport.configColor"),e.jsx(g,{sx:{fontSize:12,color:"#888"},children:o("team.passport.configColorTip")})]})})]}),children:()=>e.jsx(L,{variant:"outlined",onClick:()=>{j(!0)},children:o("team.passport.view")})})}),r&&e.jsx(es,{onCancel:()=>t(!1)}),n&&e.jsx(os,{onCancel:()=>c(!1)}),f&&e.jsx(Kt,{onCancel:()=>s(!1),onSuccess:()=>s(!1)}),d&&e.jsx(H,{open:!0,maxWidth:"lg",onClose:()=>j(!1),onBackdropClick:()=>j(!1),onEscapeKeyDown:()=>j(!1),title:o("team.passport.view"),children:e.jsx(lt,{createPassportSvg:u,onCancel:()=>j(!1)})})]})}ct.propTypes={createPassportSvg:w.func.isRequired};const ze="$all",Ee="",dt=ut.memo(({createPassportSvg:u,passport:o,teamDid:i,inService:p})=>e.jsx(g,{sx:{display:"flex"},dangerouslySetInnerHTML:{__html:u({scope:o.scope,role:o.role,title:o.scope==="kyc"?o.name:o.title,issuer:o.issuer&&o.issuer.name,issuerDid:o.issuer&&o.issuer.id,ownerName:o.user?.fullName,ownerDid:o.user?.did,ownerAvatarUrl:o.user?.avatar?Ze(o.user?.avatar,i,p):"",revoked:o.revoked,width:"36px",extra:o?.expirationDate?{key:"Exp",value:Ve(o.expirationDate).format("YYYY-MM-DD HH:mm:ss")}:null})}}));dt.propTypes={passport:w.object.isRequired,createPassportSvg:w.func.isRequired,teamDid:w.string.isRequired,inService:w.bool.isRequired};function js({createPassportSvg:u}){const{api:o}=k(),{teamDid:i}=_(),{t:p,locale:m}=F(),{SYSTEM_ROLES:l}=zt(),{inService:h}=k(),[a,f]=C.useState(!1),s=`passports-${i}`,r=Pt(s),[t,n]=C.useState({role:ze,status:Ee,searchText:r.searchText||"",pageSize:r.rowsPerPage||10,page:r.page?r.page+1:1}),{data:c,loading:y}=re(async()=>(await o.getPassportRoleCounts({input:{teamDid:i}})).counts||[],{refreshDeps:[i]}),{data:x,loading:d}=re(async()=>{const v={};t.role!==ze&&(v.role=t.role),t.status&&(v.status=t.status);const I=await o.getPassportsByRole({input:{teamDid:i,query:v,paging:{page:t.page,pageSize:t.pageSize}}});return{passports:I.passports||[],total:I.paging.total}},{refreshDeps:[t.role,t.status,t.page,t.pageSize],onError:v=>R.error(v.message)}),j=v=>c?.find(N=>N.key===v)?.value||0,S=C.useMemo(()=>Object.keys(l).map(v=>({name:v,title:l[v],num:j(v)})),[c,j]),T=C.useMemo(()=>[{label:p("team.passport.role"),name:"role",options:{customBodyRender:(v,{rowIndex:I})=>{const N=x?.passports[I];return e.jsxs(g,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(dt,{createPassportSvg:u,passport:N,teamDid:i}),e.jsx(g,{children:ge(N.title)})]})}}},{label:p("team.passport.owner"),name:"user",options:{customBodyRender:v=>ye(v,h)}},{label:p("team.passport.status"),name:"status",options:{customBodyRender:je}},{label:p("team.member.lastLogin"),name:"lastLoginAt",options:{customBodyRender:v=>Ke(v,m)}},{label:p("common.address"),name:"id",options:{customBodyRender:Et}},{label:p("blocklet.overview.source"),name:"source",options:{customBodyRender:(v,{rowIndex:I})=>{const N=x?.passports[I];return N.parentDid?ne("recover"):ne(N.source)}}}],[p,m,x?.passports,i,u,h]),b=v=>{n(I=>({...I,role:v,page:1}))},P=({page:v,rowsPerPage:I,searchText:N})=>{t.pageSize!==I?n(O=>({...O,searchText:"",pageSize:I,page:1})):t.page!==v+1?n(O=>({...O,searchText:"",page:v+1})):t.searchText!==N&&n(O=>({...O,searchText:N,page:1}))},D=C.useRef(null),B=x?.passports||[],V=t.searchText?B.filter(v=>v.id.includes(t.searchText)||(v?.user?.fullName||"").includes(t.searchText)):B,z={sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,onRowClick(v,{dataIndex:I},N){if(D.current?.contains(N.target)){const O=x?.passports[I];f(O)}},page:t.page-1,rowsPerPage:t.pageSize,count:x?.total||0,searchDebounceTime:600},Y=v=>{n(I=>({...I,status:v.target.value,page:1}))},A=e.jsxs(g,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsxs(g,{sx:{fontSize:16,fontWeight:400},children:[p("team.passport.status"),":"]}),e.jsxs(St,{size:"small",value:t.status,onChange:Y,displayEmpty:!0,sx:{minWidth:120,height:36,".MuiSelect-select":{py:.5,px:1.5}},children:[e.jsx(ae,{value:Ee,children:p("common.all")}),Object.values(U.PASSPORT_STATUS).map(v=>e.jsx(ae,{value:v,sx:{py:1},children:p(`team.passport.statusMap.${v}`)},v))]})]});return y?e.jsx(g,{sx:{py:2},children:e.jsx(ee,{direction:"row",spacing:1,sx:{justifyContent:"center",alignItems:"center",position:"relative",pb:2},children:e.jsx(M,{})})}):e.jsxs(vs,{children:[e.jsxs(g,{className:"main",sx:{display:"flex",mt:0,gap:3},children:[e.jsx(g,{className:"left",children:e.jsx(g,{className:"tabs",children:S.map(v=>e.jsxs(g,{className:`tab ${t.role===v.name?"active":""}`,onClick:()=>b(v.name),children:[e.jsx("span",{className:"text",children:v.title}),e.jsx(g,{sx:{color:"text.secondary"},children:v.num})]},v.name))})}),e.jsx(g,{ref:D,className:"right",children:e.jsx(fe,{className:"main-table",verticalKeyWidth:100,locale:m,durable:s,durableKeys:["page","rowsPerPage"],data:V,columns:T,options:z,loading:d,onChange:P,customButtons:[e.jsx(ct,{createPassportSvg:u})],title:A})})]}),a&&e.jsx(Xe,{createPassportSvg:u,onCancel:()=>f(null),passport:a,onSwitchPassport:f})]})}js.propTypes={createPassportSvg:w.func.isRequired};const vs=wt(g)`
|
|
223
223
|
.main {
|
|
224
224
|
.left {
|
|
225
225
|
width: 256px;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/lottie-react.esm-M5fKy3fg.js","assets/vendor-react-Dvs43sk9.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{j as e,ak as s,c1 as h,T as k,z as V,bp as G,b6 as q,bq as U,c9 as O,Q as R,at as I,ar as B,ca as X,cb as J,cc as W,I as H,cd as K,D as Y,aj as Q}from"./vendor-mui-core-
|
|
2
|
+
import{j as e,ak as s,c1 as h,T as k,z as V,bp as G,b6 as q,bq as U,c9 as O,Q as R,at as I,ar as B,ca as X,cb as J,cc as W,I as H,cd as K,D as Y,aj as Q}from"./vendor-mui-core-Bw-IjQ9m.js";import{r as j}from"./vendor-react-Dvs43sk9.js";import{q as Z,g as N,u as ee,j as te,e as oe}from"./vendor-hooks-B2bT6Nqf.js";import{C as re,R as ie,_ as C}from"./vendor-ux-e4SIahY6.js";import{X as se}from"./vendor-utils-B4mliPf7.js";import{getAIKitComponent as ne}from"./index-CdPVeM40.js";import"./lottie-web-4koyQiv_.js";import"./index-CGzwVlpv.js";import"./vendor-arcblock-CY7eM47O.js";import"./index-BPy8_fa2.js";import"./index-DRYJ0xIl.js";const T=j.createContext({}),D=()=>j.useContext(T);function ae({children:o,restrictions:f,i18n:d,theme:r}){const[n,b]=Z({loading:!1}),c=i=>b(g=>({...g,loading:i})),p=j.useMemo(()=>({...n,onLoading:c,restrictions:f,i18n:d}),[n]);return e.jsx(re,{theme:r,children:e.jsx(T.Provider,{value:p,children:o})})}const le=["1024x1024","1024x1792","1792x1024"],de=["256x256","512x512","1024x1024"],ce=[{label:"DALL·E 3",value:"dall-e-3"},{label:"DALL·E 2",value:"dall-e-2"}];function xe({onSubmit:o}){const{loading:f,i18n:d}=D(),r=N({model:"dall-e-3",prompt:"",size:"1024x1024",number:1}),n=()=>{const i=JSON.parse(JSON.stringify(r));Object.values(r).every(y=>!!y)&&o(i)},{run:b}=ee(n,{wait:500}),c={width:"100%",pl:1,pr:1},p=r.model==="dall-e-2"?de:le;return e.jsxs(pe,{onSubmit:i=>i.preventDefault(),children:[e.jsx(s,{sx:{flex:1,overflowY:"auto",overflowX:"hidden",m:2,mb:0},children:e.jsxs(h,{container:!0,sx:{gap:2.5},children:[e.jsxs(h,{size:12,children:[e.jsx(k,{gutterBottom:!0,className:"title label",sx:{color:"text.primary"},children:d("aiImagePrompt")}),e.jsx(V,{sx:{width:1,mt:1},size:"small",type:"text",required:!0,placeholder:d("aiImagePromptTip"),multiline:!0,minRows:5,maxRows:6,value:r.prompt??"",onChange:i=>{i.stopPropagation(),r.prompt=i.target.value},slotProps:{htmlInput:{maxLength:1e3}}})]}),e.jsxs(h,{size:12,children:[e.jsx(k,{gutterBottom:!0,className:"title label",sx:{color:"text.primary"},children:`${d("aiImageModel")}`}),e.jsx(G,{row:!0,sx:{".MuiFormControlLabel-label":{fontSize:"12px",color:"text.primary"}},value:r.model,onChange:i=>{r.number=1,r.size="1024x1024",r.model=i.target.value},children:ce.map(i=>e.jsx(q,{value:i.value,control:e.jsx(U,{size:"small"}),label:i.label},i.label))})]}),e.jsxs(h,{size:12,children:[e.jsx(k,{gutterBottom:!0,className:"title label",sx:{color:"text.primary"},children:`${d("aiImageSize")}: ${r.size}`}),e.jsx(h,{container:!0,sx:{gap:2.5,pt:1},children:e.jsx(s,{sx:{flex:1},children:e.jsx(s,{...c,children:e.jsx(O,{size:"small",min:0,max:p.length-1,step:1,value:p.findIndex(i=>i==r.size),onChange:(i,g)=>{r.size=p[g]}})})})})]}),r.model==="dall-e-2"&&e.jsxs(h,{size:12,children:[e.jsx(k,{gutterBottom:!0,className:"title label",sx:{color:"text.primary"},children:`${d("aiImageNumber")}: ${r.number}`}),e.jsx(s,{...c,children:e.jsx(O,{size:"small",defaultValue:1,valueLabelDisplay:"auto",step:1,min:1,max:10,value:r.number,onChange:(i,g)=>{i.stopPropagation(),r.number=Number(g)}})})]})]})}),e.jsx(R,{sx:{m:2,transition:"all 0.3s"},className:"submit-ai",variant:"contained",onClick:b,disabled:f,children:d(f?"aiImageGenerating":"aiImageGenerate")},f?"loading-submit":"submit")]})}const pe=I(s)`
|
|
3
3
|
display: flex;
|
|
4
4
|
flex-direction: column;
|
|
5
5
|
height: 100%;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{T as M,H as q,I as N,j as J,G as ve,J as Ce,W as Se}from"./vendor-ux-CUBj5GXM.js";import{s as Te,k as le,t as Ie}from"./vendor-hooks-DTeIFVkk.js";import{r as E,a as ae}from"./vendor-react-Dvs43sk9.js";import{j as e,Y as Re,bB as We,$ as ze,ak as p,z as se,T as C,a6 as F,aX as te,R as De,Q as H,b6 as ne,am as P,bd as _,a5 as Y,V as X,S as Z,b4 as Oe,U as L,I as B,cm as Ae,bf as Pe,a7 as $e,F as qe,W as t,b1 as R,a3 as ce,c1 as ee,cn as Le,aO as Me,aP as Be,co as Fe,cp as He,cq as Ne,s as oe,aU as Ue,aj as _e,J as Ke,cr as Ve,aZ as Je,ch as Ye,ca as Qe,cg as Ge}from"./vendor-mui-core-CcrDM-5l.js";import{B as de,a as pe,l as ue}from"./index-Bg6_NsC_.js";import{U as K,c as xe,ad as Xe,a1 as Ze,b1 as Q}from"./index-FrAYP-A_.js";import{u as V}from"./team-CD3vKVPJ.js";import{u as et}from"./use-mobile-B9FM-UBY.js";import{u as tt,C as G}from"./index.esm-JPZAjt0x.js";import{C as he,a as me,J as ot}from"./vendor-utils-BOkrEpKO.js";import{C as st}from"./confirm-CXK9v894.js";import{A as nt}from"./actions-DvIZNF27.js";import{T as ie}from"./table-tips-3_n5uR-X.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-BnbwP1kf.js";import"./session-Ci_4G0CP.js";import"./isURL-BKM8U6hZ.js";import"./index-DBs9Ljax.js";const it=i=>{const[u,c]=E.useState(null),[b,r]=E.useState(!0),[w,x]=E.useState(null),j=window.blocklet?.appUrl,l=E.useMemo(()=>{const g={};return u&&(u.sources.forEach(y=>{g[y.did]={source:y,events:[],count:0}}),u.events.forEach(y=>{g[y.source]&&(g[y.source].events.push(y),g[y.source].count+=1)})),g},[u]),f=async()=>{try{if(r(!0),!j)return;const y=await(await fetch(he(j,xe.WELLKNOWN_SERVICE_PATH_PREFIX,"/openevent.json"))).json();c(y),x(null)}catch(g){x(g instanceof Error?g:new Error(String(g)))}finally{r(!1)}};return E.useEffect(()=>{f()},[j]),{openEvent:u,setOpenEvent:c,eventsBySource:l,loading:b,error:w,loadData:f}};function ge({eventsBySource:i,selectedEvents:u,setSelectedEvents:c,error:b=null}){const{t:r}=M(),[w,x]=E.useState({}),j=E.useMemo(()=>{const n={};return Object.entries(i).forEach(([a,{events:m}])=>{const v=m.filter(S=>u[`${S.type}-${S.source}`]).length;n[a]=v}),n},[i,u]),l=E.useMemo(()=>Object.values(j).reduce((n,a)=>n+a,0),[j]),f=E.useMemo(()=>Object.values(i).reduce((n,{events:a})=>n+a.length,0),[i]),g=(n,a)=>{a.stopPropagation(),x({...w,[n]:!w[n]})},y=n=>{const a=`${n.type}-${n.source}`;c(m=>({...m,[a]:!m[a]}))},z=(n,a)=>{const m={};n.forEach(v=>{const S=`${v.type}-${v.source}`;m[S]=!a}),c(v=>({...v,...m}))},T=n=>{const a={};Object.values(i).forEach(({events:m})=>{m.forEach(v=>{const S=`${v.type}-${v.source}`;a[S]=n.target.checked})}),c(a)};return e.jsxs(p,{sx:{width:"100%"},children:[e.jsxs(p,{sx:{display:"flex",alignItems:"center",mb:1,mt:1},children:[e.jsx(ne,{control:e.jsx(Y,{onChange:T,checked:l>0&&l===f}),label:e.jsxs(p,{sx:{display:"flex",alignItems:"center",cursor:"pointer"},children:[r("webhookEndpoint.selectAllEvents"),e.jsx(p,{sx:{display:"flex",alignItems:"center"},children:e.jsx(P,{title:r("webhookEndpoint.selectAllEventsTooltip"),placement:"right",children:e.jsx(_,{fontSize:"small",sx:{ml:.5,cursor:"help"}})})})]}),sx:{m:0}}),l>0&&e.jsx(C,{variant:"body2",color:"primary",sx:{ml:"auto"},children:r("webhookEndpoint.selectedEventsCount",{count:l})})]}),e.jsx(p,{sx:{maxHeight:"50vh",overflow:"auto"},children:e.jsx(X,{disablePadding:!0,sx:{border:"1px solid",borderColor:"divider",borderRadius:"4px"},children:Object.entries(i).map(([n,{source:a,events:m,count:v}],S)=>{const D=j[n]>0,I=j[n]===m.length&&m.length>0,O=w[n];return e.jsxs(ae.Fragment,{children:[e.jsx(Z,{sx:{borderBottom:({palette:o})=>S<Object.keys(i).length-1?`1px solid ${o.divider}`:"none",px:2,py:1.5,"&:hover":{bgcolor:"rgba(0, 0, 0, 0.02)"}},children:e.jsxs(p,{sx:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center"},onClick:o=>{o.target.closest(".MuiFormControlLabel-root")||g(n,o)},children:[e.jsx(p,{sx:{display:"flex",alignItems:"center"},children:m.length>0&&e.jsx(ne,{control:e.jsx(Y,{checked:I,indeterminate:D&&!I,onChange:o=>{o.stopPropagation(),z(m,I)}}),label:e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[a.logo&&e.jsx(Oe,{src:a.logo,sx:{width:24,height:24}}),e.jsx(p,{children:a.title||n}),D&&e.jsx(L,{label:r("webhookEndpoint.selectedCount",{count:j[n]}),size:"small",sx:{mt:"2px",height:"20px",fontSize:"12px",bgcolor:o=>`${o.palette.primary.main}20`,color:"primary.main",fontWeight:500}})]}),sx:{m:0,"& .MuiFormControlLabel-label":{flex:1}}})}),e.jsxs(p,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(C,{variant:"body2",sx:{color:"text.secondary",mr:1},children:r("webhookEndpoint.eventsCount",{count:v})}),m.length>0&&e.jsx(B,{size:"small",edge:"end",children:O?e.jsx(Ae,{}):e.jsx(Pe,{})})]})]})}),m.length>0&&e.jsx($e,{in:O,timeout:"auto",unmountOnExit:!0,children:e.jsx(X,{disablePadding:!0,sx:{pl:2,pr:2,py:1,bgcolor:"rgba(0, 0, 0, 0.01)"},children:m.map(o=>{const d=`${o.type}-${o.source}`,s=!!u[d];return e.jsx(Z,{dense:!0,sx:{py:.75},onClick:()=>y(o),children:e.jsxs(p,{sx:{display:"flex",alignItems:"flex-start",width:"100%"},children:[e.jsx(Y,{checked:s,sx:{mr:1}}),e.jsxs(p,{children:[e.jsx(C,{variant:"body1",sx:{cursor:"pointer",color:"text.primary"},children:o.type}),e.jsx(C,{variant:"caption",sx:{color:"text.secondary",display:"block",cursor:"pointer"},children:o.description})]})]})},d)})})})]},n)})})}),b&&e.jsx(qe,{error:!0,sx:{mt:1},children:b})]})}ge.propTypes={eventsBySource:t.objectOf(t.shape({source:t.shape({did:t.string.isRequired,title:t.string,description:t.string,version:t.string,logo:t.string}).isRequired,events:t.arrayOf(t.shape({type:t.string.isRequired,description:t.string.isRequired,source:t.string.isRequired})).isRequired,count:t.number.isRequired})).isRequired,selectedEvents:t.objectOf(t.bool).isRequired,setSelectedEvents:t.func.isRequired,error:t.string};function fe({id:i=null,url:u="",description:c="",enabledEvents:b=[],onSubmit:r,onClose:w=()=>{}}){const{t:x}=M(),[j,l]=E.useState({}),{teamDid:f}=V(),{api:g}=K(),{loading:y,error:z,eventsBySource:T}=it(),{control:n,handleSubmit:a,formState:{errors:m},reset:v,setValue:S,trigger:D}=tt({defaultValues:{url:"",description:""}});E.useEffect(()=>{const o=Object.values(j).some(d=>d);S("selectedEvents",o?"valid":""),D("selectedEvents")},[j,S,D]);const I=()=>{l({}),v(),w()},O=async o=>{const d=Object.keys(j).filter(h=>j[h]),s={url:o.url,description:o.description,enabledEvents:d.map(h=>{const[k,W]=h.split("-");return!k||!W?null:{type:k,source:W}}).filter(Boolean)};try{if(i){const h=await g.updateWebhookEndpoint({input:{teamDid:f,id:i,data:s}});q.success(`${x("webhookEndpoint.updateWebhook")} ${x("webhookEndpoint.success")}`),r(h)}else{const h=await g.createWebhookEndpoint({input:{teamDid:f,input:s}});q.success(`${x("webhookEndpoint.createWebhook")} ${x("webhookEndpoint.success")}`),r(h)}}catch(h){q.error(h?.message)}I()};return E.useEffect(()=>{v({url:u,description:c}),l(b.reduce((o,d)=>(o[`${d.type}-${d.source}`]=!0,o),{}))},[v,l,u,c,b]),e.jsx(Re,{open:!0,onClose:I,maxWidth:"lg",fullWidth:!0,sx:{"& .MuiDialog-paper":{minHeight:600}},children:e.jsxs("form",{onSubmit:a(O),children:[e.jsx(We,{children:x(i?"webhookEndpoint.editWebhookTitle":"webhookEndpoint.createWebhookTitle")}),e.jsx(ze,{children:e.jsxs(p,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[e.jsx(G,{name:"url",control:n,rules:{required:x("webhookEndpoint.validation.urlRequired"),pattern:{value:/^(http|https):\/\/[^ "]+$/,message:x("webhookEndpoint.validation.urlInvalid")}},render:({field:o})=>e.jsx(se,{...o,label:x("webhookEndpoint.url.label"),fullWidth:!0,error:!!m.url,helperText:m.url?.message})}),e.jsx(G,{name:"description",control:n,rules:{required:x("webhookEndpoint.validation.descriptionRequired")},render:({field:o})=>e.jsx(se,{...o,label:x("webhookEndpoint.description.label"),fullWidth:!0,multiline:!0,minRows:2,maxRows:4,error:!!m.description,helperText:m.description?.message})}),e.jsx(G,{name:"selectedEvents",control:n,rules:{required:x("webhookEndpoint.validation.eventRequired")},render:({field:o})=>e.jsx("input",{type:"hidden",...o})}),!y&&T&&Object.keys(T).length>0&&e.jsx(ge,{eventsBySource:T,selectedEvents:j,setSelectedEvents:l,error:m.selectedEvents?.message}),!y&&(!T||Object.keys(T).length===0)&&e.jsx(C,{sx:{color:"text.secondary"},children:x("webhookEndpoint.noAvailableEvents")}),y&&e.jsx(p,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"500px",width:"100%"},children:e.jsx(F,{size:20})}),z&&e.jsx(te,{severity:"error",children:x("webhookEndpoint.loadingError",{message:z?.message})})]})}),e.jsxs(De,{sx:{p:"8px 24px 24px"},children:[e.jsx(H,{onClick:I,children:x("common.cancel")}),e.jsx(H,{type:"submit",variant:"contained",color:"primary",children:x(i?"webhookEndpoint.updateWebhook":"webhookEndpoint.saveWebhook")})]})]})})}fe.propTypes={onSubmit:t.func.isRequired,id:t.string,url:t.string,description:t.string,enabledEvents:t.arrayOf(t.shape({type:t.string.isRequired,source:t.string.isRequired})),onClose:t.func};function be(i){switch(i){case"enabled":return"success";case"disabled":default:return"default"}}const rt=(i="en")=>i==="tw"?"zh":i;function U(i,u="YYYY-MM-DD HH:mm:ss",c="en"){return i?Xe(i).locale(rt(c)).format(u):"-"}function lt(i){return typeof i=="number"?!1:me(i)}function at(i){return i>=200&&i<300}function A({value:i,label:u,tip:c="",divider:b=!1}){const r=lt(i);return e.jsxs(e.Fragment,{children:[e.jsxs(R,{direction:"column",alignItems:"flex-start",children:[e.jsxs(C,{component:"div",variant:"body1",mb:1,color:"text.primary",sx:{fontWeight:500},children:[u,!!c&&e.jsx(P,{title:c,children:e.jsx(_,{fontSize:"small"})})]}),e.jsx(C,{component:"div",variant:"body1",color:r?"text.disabled":"text.secondary",sx:{width:"100%",minHeight:"24px"},children:r?"-":i})]}),b&&e.jsx(ce,{orientation:"vertical",flexItem:!0})]})}A.propTypes={label:t.oneOfType([t.string,t.node]).isRequired,value:t.oneOfType([t.string,t.node]).isRequired,tip:t.oneOfType([t.string,t.node]),divider:t.bool};function je({title:i,children:u=null,mb:c=1.5,mt:b=1.5}){return e.jsxs(R,{className:"section-header",direction:"row",sx:{justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:1,mb:c,mt:b,pb:1},children:[e.jsx(C,{variant:"h3",sx:{fontSize:{xs:"18px",md:"1.09375rem"}},component:"div",children:i}),u]})}je.propTypes={title:t.oneOfType([t.string,t.node]).isRequired,children:t.node,mb:t.number,mt:t.number};const ct={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 11A8.1 8.1 0 0 0 4.5 9M4 5v4h4m-4 4a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"/>'},dt=i=>{const u={};return i.forEach(c=>{const b=new Date(c.createdAt).toLocaleDateString();u[b]||(u[b]=[]),u[b]?.push(c)}),u};function ye({eventId:i="",webhookEndpointId:u="",event:c=null}){const{api:b,ws:{useSubscription:r}}=K(),{t:w}=M(),{teamDid:x}=V(),{blocklet:j}=Ze(),{data:l,loadMore:f,loadingMore:g,loading:y,mutate:z}=Te(s=>{const k=s?Math.ceil(s.list.length/15)+1:1;return b.getWebhookAttempts({input:{teamDid:x,input:{eventId:i,webhookId:u},paging:{page:k,pageSize:15}}})},{reloadDeps:[i,u]}),T=l?.list||[],[n,a]=E.useState(null),[m,v]=E.useState(!1),S=dt(T);if(E.useEffect(()=>{!n&&l?.list.length&&a(l.list[0])},[l?.list.length,n]),r(xe.EVENTS.WEBHOOK_ATTEMPT,s=>{z(h=>{if(h.list.find(W=>W.id===s.id)){const W=h.list.map($=>$.id===s.id?{...$,...s}:$);return{...h,list:W}}return s.endpoint=h.list[0]?.endpoint,s.event=h.list[0]?.event,{...h,list:[s,...h.list]}})},[]),y)return e.jsx(F,{});const D=l&&l.list.length<l.paging.total,I=async()=>{n&&(v(!0),await b.retryWebhookAttempt({input:{teamDid:x,eventId:n.event.id,webhookId:u,attemptId:n.id}}).finally(()=>{setTimeout(()=>{v(!1)},1e3)}))},O=s=>{if(s.responseBody&&s.responseBody?.sessionId&&s.responseBody?.projectId&&s.responseBody?.agentId){const h=j?.site?.domainAliases[0]?.value,k=(j.children||[]).find($=>$?.meta?.name==="ai-studio"),W=ot(he(`https://${h}`,k?.mountPoint||"","projects",s.responseBody.projectId,"logs/main"),{sessionId:s.responseBody.sessionId,agentId:s.responseBody.agentId});return e.jsx(B,{sx:{fontSize:20},onClick:()=>window.open(W,"_blank"),children:e.jsx(p,{component:N,icon:Q})})}return null},o=s=>s.status==="pending"?e.jsx(Fe,{color:"warning"}):at(s.responseStatus)?e.jsx(He,{color:"success"}):e.jsx(Ne,{color:"error"}),d=n?.triggeredFrom&&(l?.list||[]).find(s=>s.id===n.triggeredFrom);return e.jsxs(pt,{container:!0,spacing:{xs:0,md:1},sx:{height:1},children:[e.jsx(ee,{size:{xs:12,md:4},sx:{height:1},children:me(Object.keys(S))?e.jsx(C,{sx:{color:"text.secondary"},children:w("webhookEndpoint.waitingForEvents")}):e.jsxs(e.Fragment,{children:[e.jsx(X,{sx:{maxHeight:"calc(100% - 40px)",py:0,overflowY:"auto"},children:Object.entries(S).map(([s,h])=>e.jsxs(ae.Fragment,{children:[e.jsx(Le,{sx:{p:0},children:s}),h.map(k=>e.jsxs(Z,{sx:{cursor:"pointer",px:1},onClick:()=>a(k),selected:n&&n?.id===k?.id,secondaryAction:e.jsx(C,{sx:{color:"text.secondary"},children:U(k.createdAt,"HH:mm:ss")}),children:[e.jsx(Me,{sx:{minWidth:0,mr:1.5},children:o(k)}),e.jsx(Be,{primary:e.jsx(C,{sx:{color:"text.primary"},children:k.event.type})})]},k.id))]},s))}),D&&e.jsx(p,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:1},children:e.jsx(H,{variant:"text",type:"button",color:"inherit",onClick:f,disabled:g,sx:{color:s=>s.palette.text.disabled},children:w(g?"webhookEndpoint.loadingMore":"webhookEndpoint.loadMore")})})]})}),e.jsxs(ee,{size:{xs:12,md:8},sx:{height:1},children:[n&&e.jsxs(R,{direction:"column",spacing:2,sx:{height:1,overflow:"auto",pl:{xs:0,md:1},mt:{xs:2,md:0},borderLeft:{xs:"none"}},children:[e.jsxs(p,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(C,{variant:"h4",children:w(`common.${n.status}`)}),e.jsx(p,{children:O(n)})]}),e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[d&&e.jsx(P,{placement:"left",title:e.jsxs(R,{onClick:()=>a(d),sx:{gap:1,cursor:"pointer",".did-address-text":{color:"common.white"}},children:[e.jsx(de,{showDid:!0,did:n.triggeredBy,cardType:ue.Detailed,infoType:pe.Minimal,sx:{border:0,padding:0,minWidth:0,".MuiTypography-root":{color:"common.white",fontWeight:400}}}),e.jsx(ce,{}),e.jsxs(p,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(C,{variant:"body2",sx:{color:"primary.main"},children:w("webhookEndpoint.triggeredFrom")}),e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(C,{variant:"body2",children:n.id}),e.jsx(B,{onClick:()=>a(d),children:e.jsx(p,{component:N,icon:Q,sx:{fontSize:16,color:"common.white"}})})]})]})]}),slotProps:{tooltip:{sx:{maxWidth:400}}},children:e.jsx(B,{onClick:()=>a(d),children:e.jsx(p,{component:N,icon:Q,sx:{fontSize:16}})})}),e.jsxs(H,{variant:"outlined",color:"primary",size:"small",onClick:I,disabled:m,children:[e.jsx(p,{component:N,icon:ct,sx:{fontSize:16,animation:m?"spin 1s linear infinite":"none",mr:.5}}),w("notification.resend")]})]})]}),e.jsxs(p,{children:[e.jsxs(C,{variant:"h6",children:[w("webhookEndpoint.response")," (",n.responseStatus,")"]}),e.jsx(J,{language:"json",children:JSON.stringify(n.responseBody,null,2)})]}),e.jsxs(p,{children:[e.jsx(R,{direction:"row",spacing:1,sx:{alignItems:"center"},children:e.jsx(C,{variant:"h6",children:w("webhookEndpoint.request")})}),e.jsx(J,{language:"json",sx:{margin:0},children:JSON.stringify(n.event,null,2)})]})]}),l?.list.length===0&&c&&e.jsxs(p,{children:[e.jsx(R,{direction:"row",spacing:1,sx:{alignItems:"center"},children:e.jsx(C,{variant:"h6",children:w("webhookEndpoint.eventData")})}),e.jsx(J,{language:"json",sx:{margin:0},children:JSON.stringify(c.data,null,2)})]})]})]})}ye.propTypes={eventId:t.string,webhookEndpointId:t.string,event:t.shape({type:t.string,data:t.object,request:t.object,requestInfo:t.object})};const pt=oe(ee)`
|
|
1
|
+
import{T as M,H as q,I as N,j as J,G as ve,J as Ce,W as Se}from"./vendor-ux-e4SIahY6.js";import{s as Te,k as le,t as Ie}from"./vendor-hooks-B2bT6Nqf.js";import{r as E,a as ae}from"./vendor-react-Dvs43sk9.js";import{j as e,Y as Re,bB as We,$ as ze,ak as p,z as se,T as C,a6 as F,aX as te,R as De,Q as H,b6 as ne,am as P,bd as _,a5 as Y,V as X,S as Z,b4 as Oe,U as L,I as B,cm as Ae,bf as Pe,a7 as $e,F as qe,W as t,b1 as R,a3 as ce,c1 as ee,cn as Le,aO as Me,aP as Be,co as Fe,cp as He,cq as Ne,s as oe,aU as Ue,aj as _e,J as Ke,cr as Ve,aZ as Je,ch as Ye,ca as Qe,cg as Ge}from"./vendor-mui-core-Bw-IjQ9m.js";import{B as de,a as pe,l as ue}from"./index-CSX4LtVd.js";import{U as K,c as xe,ad as Xe,a1 as Ze,b1 as Q}from"./index-CGzwVlpv.js";import{u as V}from"./team-DL-1lYRh.js";import{u as et}from"./use-mobile-IWOBvgsY.js";import{u as tt,C as G}from"./index.esm-JPZAjt0x.js";import{C as he,a as me,J as ot}from"./vendor-utils-B4mliPf7.js";import{C as st}from"./confirm-CRV2RKnN.js";import{A as nt}from"./actions-CJMVMPKl.js";import{T as ie}from"./table-tips-BqAxYXjm.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-CY7eM47O.js";import"./session-CJYcrokL.js";import"./isURL-TswwHw1T.js";import"./index-DBs9Ljax.js";const it=i=>{const[u,c]=E.useState(null),[b,r]=E.useState(!0),[w,x]=E.useState(null),j=window.blocklet?.appUrl,l=E.useMemo(()=>{const g={};return u&&(u.sources.forEach(y=>{g[y.did]={source:y,events:[],count:0}}),u.events.forEach(y=>{g[y.source]&&(g[y.source].events.push(y),g[y.source].count+=1)})),g},[u]),f=async()=>{try{if(r(!0),!j)return;const y=await(await fetch(he(j,xe.WELLKNOWN_SERVICE_PATH_PREFIX,"/openevent.json"))).json();c(y),x(null)}catch(g){x(g instanceof Error?g:new Error(String(g)))}finally{r(!1)}};return E.useEffect(()=>{f()},[j]),{openEvent:u,setOpenEvent:c,eventsBySource:l,loading:b,error:w,loadData:f}};function ge({eventsBySource:i,selectedEvents:u,setSelectedEvents:c,error:b=null}){const{t:r}=M(),[w,x]=E.useState({}),j=E.useMemo(()=>{const n={};return Object.entries(i).forEach(([a,{events:m}])=>{const v=m.filter(S=>u[`${S.type}-${S.source}`]).length;n[a]=v}),n},[i,u]),l=E.useMemo(()=>Object.values(j).reduce((n,a)=>n+a,0),[j]),f=E.useMemo(()=>Object.values(i).reduce((n,{events:a})=>n+a.length,0),[i]),g=(n,a)=>{a.stopPropagation(),x({...w,[n]:!w[n]})},y=n=>{const a=`${n.type}-${n.source}`;c(m=>({...m,[a]:!m[a]}))},z=(n,a)=>{const m={};n.forEach(v=>{const S=`${v.type}-${v.source}`;m[S]=!a}),c(v=>({...v,...m}))},T=n=>{const a={};Object.values(i).forEach(({events:m})=>{m.forEach(v=>{const S=`${v.type}-${v.source}`;a[S]=n.target.checked})}),c(a)};return e.jsxs(p,{sx:{width:"100%"},children:[e.jsxs(p,{sx:{display:"flex",alignItems:"center",mb:1,mt:1},children:[e.jsx(ne,{control:e.jsx(Y,{onChange:T,checked:l>0&&l===f}),label:e.jsxs(p,{sx:{display:"flex",alignItems:"center",cursor:"pointer"},children:[r("webhookEndpoint.selectAllEvents"),e.jsx(p,{sx:{display:"flex",alignItems:"center"},children:e.jsx(P,{title:r("webhookEndpoint.selectAllEventsTooltip"),placement:"right",children:e.jsx(_,{fontSize:"small",sx:{ml:.5,cursor:"help"}})})})]}),sx:{m:0}}),l>0&&e.jsx(C,{variant:"body2",color:"primary",sx:{ml:"auto"},children:r("webhookEndpoint.selectedEventsCount",{count:l})})]}),e.jsx(p,{sx:{maxHeight:"50vh",overflow:"auto"},children:e.jsx(X,{disablePadding:!0,sx:{border:"1px solid",borderColor:"divider",borderRadius:"4px"},children:Object.entries(i).map(([n,{source:a,events:m,count:v}],S)=>{const D=j[n]>0,I=j[n]===m.length&&m.length>0,O=w[n];return e.jsxs(ae.Fragment,{children:[e.jsx(Z,{sx:{borderBottom:({palette:o})=>S<Object.keys(i).length-1?`1px solid ${o.divider}`:"none",px:2,py:1.5,"&:hover":{bgcolor:"rgba(0, 0, 0, 0.02)"}},children:e.jsxs(p,{sx:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center"},onClick:o=>{o.target.closest(".MuiFormControlLabel-root")||g(n,o)},children:[e.jsx(p,{sx:{display:"flex",alignItems:"center"},children:m.length>0&&e.jsx(ne,{control:e.jsx(Y,{checked:I,indeterminate:D&&!I,onChange:o=>{o.stopPropagation(),z(m,I)}}),label:e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[a.logo&&e.jsx(Oe,{src:a.logo,sx:{width:24,height:24}}),e.jsx(p,{children:a.title||n}),D&&e.jsx(L,{label:r("webhookEndpoint.selectedCount",{count:j[n]}),size:"small",sx:{mt:"2px",height:"20px",fontSize:"12px",bgcolor:o=>`${o.palette.primary.main}20`,color:"primary.main",fontWeight:500}})]}),sx:{m:0,"& .MuiFormControlLabel-label":{flex:1}}})}),e.jsxs(p,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(C,{variant:"body2",sx:{color:"text.secondary",mr:1},children:r("webhookEndpoint.eventsCount",{count:v})}),m.length>0&&e.jsx(B,{size:"small",edge:"end",children:O?e.jsx(Ae,{}):e.jsx(Pe,{})})]})]})}),m.length>0&&e.jsx($e,{in:O,timeout:"auto",unmountOnExit:!0,children:e.jsx(X,{disablePadding:!0,sx:{pl:2,pr:2,py:1,bgcolor:"rgba(0, 0, 0, 0.01)"},children:m.map(o=>{const d=`${o.type}-${o.source}`,s=!!u[d];return e.jsx(Z,{dense:!0,sx:{py:.75},onClick:()=>y(o),children:e.jsxs(p,{sx:{display:"flex",alignItems:"flex-start",width:"100%"},children:[e.jsx(Y,{checked:s,sx:{mr:1}}),e.jsxs(p,{children:[e.jsx(C,{variant:"body1",sx:{cursor:"pointer",color:"text.primary"},children:o.type}),e.jsx(C,{variant:"caption",sx:{color:"text.secondary",display:"block",cursor:"pointer"},children:o.description})]})]})},d)})})})]},n)})})}),b&&e.jsx(qe,{error:!0,sx:{mt:1},children:b})]})}ge.propTypes={eventsBySource:t.objectOf(t.shape({source:t.shape({did:t.string.isRequired,title:t.string,description:t.string,version:t.string,logo:t.string}).isRequired,events:t.arrayOf(t.shape({type:t.string.isRequired,description:t.string.isRequired,source:t.string.isRequired})).isRequired,count:t.number.isRequired})).isRequired,selectedEvents:t.objectOf(t.bool).isRequired,setSelectedEvents:t.func.isRequired,error:t.string};function fe({id:i=null,url:u="",description:c="",enabledEvents:b=[],onSubmit:r,onClose:w=()=>{}}){const{t:x}=M(),[j,l]=E.useState({}),{teamDid:f}=V(),{api:g}=K(),{loading:y,error:z,eventsBySource:T}=it(),{control:n,handleSubmit:a,formState:{errors:m},reset:v,setValue:S,trigger:D}=tt({defaultValues:{url:"",description:""}});E.useEffect(()=>{const o=Object.values(j).some(d=>d);S("selectedEvents",o?"valid":""),D("selectedEvents")},[j,S,D]);const I=()=>{l({}),v(),w()},O=async o=>{const d=Object.keys(j).filter(h=>j[h]),s={url:o.url,description:o.description,enabledEvents:d.map(h=>{const[k,W]=h.split("-");return!k||!W?null:{type:k,source:W}}).filter(Boolean)};try{if(i){const h=await g.updateWebhookEndpoint({input:{teamDid:f,id:i,data:s}});q.success(`${x("webhookEndpoint.updateWebhook")} ${x("webhookEndpoint.success")}`),r(h)}else{const h=await g.createWebhookEndpoint({input:{teamDid:f,input:s}});q.success(`${x("webhookEndpoint.createWebhook")} ${x("webhookEndpoint.success")}`),r(h)}}catch(h){q.error(h?.message)}I()};return E.useEffect(()=>{v({url:u,description:c}),l(b.reduce((o,d)=>(o[`${d.type}-${d.source}`]=!0,o),{}))},[v,l,u,c,b]),e.jsx(Re,{open:!0,onClose:I,maxWidth:"lg",fullWidth:!0,sx:{"& .MuiDialog-paper":{minHeight:600}},children:e.jsxs("form",{onSubmit:a(O),children:[e.jsx(We,{children:x(i?"webhookEndpoint.editWebhookTitle":"webhookEndpoint.createWebhookTitle")}),e.jsx(ze,{children:e.jsxs(p,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[e.jsx(G,{name:"url",control:n,rules:{required:x("webhookEndpoint.validation.urlRequired"),pattern:{value:/^(http|https):\/\/[^ "]+$/,message:x("webhookEndpoint.validation.urlInvalid")}},render:({field:o})=>e.jsx(se,{...o,label:x("webhookEndpoint.url.label"),fullWidth:!0,error:!!m.url,helperText:m.url?.message})}),e.jsx(G,{name:"description",control:n,rules:{required:x("webhookEndpoint.validation.descriptionRequired")},render:({field:o})=>e.jsx(se,{...o,label:x("webhookEndpoint.description.label"),fullWidth:!0,multiline:!0,minRows:2,maxRows:4,error:!!m.description,helperText:m.description?.message})}),e.jsx(G,{name:"selectedEvents",control:n,rules:{required:x("webhookEndpoint.validation.eventRequired")},render:({field:o})=>e.jsx("input",{type:"hidden",...o})}),!y&&T&&Object.keys(T).length>0&&e.jsx(ge,{eventsBySource:T,selectedEvents:j,setSelectedEvents:l,error:m.selectedEvents?.message}),!y&&(!T||Object.keys(T).length===0)&&e.jsx(C,{sx:{color:"text.secondary"},children:x("webhookEndpoint.noAvailableEvents")}),y&&e.jsx(p,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"500px",width:"100%"},children:e.jsx(F,{size:20})}),z&&e.jsx(te,{severity:"error",children:x("webhookEndpoint.loadingError",{message:z?.message})})]})}),e.jsxs(De,{sx:{p:"8px 24px 24px"},children:[e.jsx(H,{onClick:I,children:x("common.cancel")}),e.jsx(H,{type:"submit",variant:"contained",color:"primary",children:x(i?"webhookEndpoint.updateWebhook":"webhookEndpoint.saveWebhook")})]})]})})}fe.propTypes={onSubmit:t.func.isRequired,id:t.string,url:t.string,description:t.string,enabledEvents:t.arrayOf(t.shape({type:t.string.isRequired,source:t.string.isRequired})),onClose:t.func};function be(i){switch(i){case"enabled":return"success";case"disabled":default:return"default"}}const rt=(i="en")=>i==="tw"?"zh":i;function U(i,u="YYYY-MM-DD HH:mm:ss",c="en"){return i?Xe(i).locale(rt(c)).format(u):"-"}function lt(i){return typeof i=="number"?!1:me(i)}function at(i){return i>=200&&i<300}function A({value:i,label:u,tip:c="",divider:b=!1}){const r=lt(i);return e.jsxs(e.Fragment,{children:[e.jsxs(R,{direction:"column",alignItems:"flex-start",children:[e.jsxs(C,{component:"div",variant:"body1",mb:1,color:"text.primary",sx:{fontWeight:500},children:[u,!!c&&e.jsx(P,{title:c,children:e.jsx(_,{fontSize:"small"})})]}),e.jsx(C,{component:"div",variant:"body1",color:r?"text.disabled":"text.secondary",sx:{width:"100%",minHeight:"24px"},children:r?"-":i})]}),b&&e.jsx(ce,{orientation:"vertical",flexItem:!0})]})}A.propTypes={label:t.oneOfType([t.string,t.node]).isRequired,value:t.oneOfType([t.string,t.node]).isRequired,tip:t.oneOfType([t.string,t.node]),divider:t.bool};function je({title:i,children:u=null,mb:c=1.5,mt:b=1.5}){return e.jsxs(R,{className:"section-header",direction:"row",sx:{justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:1,mb:c,mt:b,pb:1},children:[e.jsx(C,{variant:"h3",sx:{fontSize:{xs:"18px",md:"1.09375rem"}},component:"div",children:i}),u]})}je.propTypes={title:t.oneOfType([t.string,t.node]).isRequired,children:t.node,mb:t.number,mt:t.number};const ct={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 11A8.1 8.1 0 0 0 4.5 9M4 5v4h4m-4 4a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"/>'},dt=i=>{const u={};return i.forEach(c=>{const b=new Date(c.createdAt).toLocaleDateString();u[b]||(u[b]=[]),u[b]?.push(c)}),u};function ye({eventId:i="",webhookEndpointId:u="",event:c=null}){const{api:b,ws:{useSubscription:r}}=K(),{t:w}=M(),{teamDid:x}=V(),{blocklet:j}=Ze(),{data:l,loadMore:f,loadingMore:g,loading:y,mutate:z}=Te(s=>{const k=s?Math.ceil(s.list.length/15)+1:1;return b.getWebhookAttempts({input:{teamDid:x,input:{eventId:i,webhookId:u},paging:{page:k,pageSize:15}}})},{reloadDeps:[i,u]}),T=l?.list||[],[n,a]=E.useState(null),[m,v]=E.useState(!1),S=dt(T);if(E.useEffect(()=>{!n&&l?.list.length&&a(l.list[0])},[l?.list.length,n]),r(xe.EVENTS.WEBHOOK_ATTEMPT,s=>{z(h=>{if(h.list.find(W=>W.id===s.id)){const W=h.list.map($=>$.id===s.id?{...$,...s}:$);return{...h,list:W}}return s.endpoint=h.list[0]?.endpoint,s.event=h.list[0]?.event,{...h,list:[s,...h.list]}})},[]),y)return e.jsx(F,{});const D=l&&l.list.length<l.paging.total,I=async()=>{n&&(v(!0),await b.retryWebhookAttempt({input:{teamDid:x,eventId:n.event.id,webhookId:u,attemptId:n.id}}).finally(()=>{setTimeout(()=>{v(!1)},1e3)}))},O=s=>{if(s.responseBody&&s.responseBody?.sessionId&&s.responseBody?.projectId&&s.responseBody?.agentId){const h=j?.site?.domainAliases[0]?.value,k=(j.children||[]).find($=>$?.meta?.name==="ai-studio"),W=ot(he(`https://${h}`,k?.mountPoint||"","projects",s.responseBody.projectId,"logs/main"),{sessionId:s.responseBody.sessionId,agentId:s.responseBody.agentId});return e.jsx(B,{sx:{fontSize:20},onClick:()=>window.open(W,"_blank"),children:e.jsx(p,{component:N,icon:Q})})}return null},o=s=>s.status==="pending"?e.jsx(Fe,{color:"warning"}):at(s.responseStatus)?e.jsx(He,{color:"success"}):e.jsx(Ne,{color:"error"}),d=n?.triggeredFrom&&(l?.list||[]).find(s=>s.id===n.triggeredFrom);return e.jsxs(pt,{container:!0,spacing:{xs:0,md:1},sx:{height:1},children:[e.jsx(ee,{size:{xs:12,md:4},sx:{height:1},children:me(Object.keys(S))?e.jsx(C,{sx:{color:"text.secondary"},children:w("webhookEndpoint.waitingForEvents")}):e.jsxs(e.Fragment,{children:[e.jsx(X,{sx:{maxHeight:"calc(100% - 40px)",py:0,overflowY:"auto"},children:Object.entries(S).map(([s,h])=>e.jsxs(ae.Fragment,{children:[e.jsx(Le,{sx:{p:0},children:s}),h.map(k=>e.jsxs(Z,{sx:{cursor:"pointer",px:1},onClick:()=>a(k),selected:n&&n?.id===k?.id,secondaryAction:e.jsx(C,{sx:{color:"text.secondary"},children:U(k.createdAt,"HH:mm:ss")}),children:[e.jsx(Me,{sx:{minWidth:0,mr:1.5},children:o(k)}),e.jsx(Be,{primary:e.jsx(C,{sx:{color:"text.primary"},children:k.event.type})})]},k.id))]},s))}),D&&e.jsx(p,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:1},children:e.jsx(H,{variant:"text",type:"button",color:"inherit",onClick:f,disabled:g,sx:{color:s=>s.palette.text.disabled},children:w(g?"webhookEndpoint.loadingMore":"webhookEndpoint.loadMore")})})]})}),e.jsxs(ee,{size:{xs:12,md:8},sx:{height:1},children:[n&&e.jsxs(R,{direction:"column",spacing:2,sx:{height:1,overflow:"auto",pl:{xs:0,md:1},mt:{xs:2,md:0},borderLeft:{xs:"none"}},children:[e.jsxs(p,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(C,{variant:"h4",children:w(`common.${n.status}`)}),e.jsx(p,{children:O(n)})]}),e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[d&&e.jsx(P,{placement:"left",title:e.jsxs(R,{onClick:()=>a(d),sx:{gap:1,cursor:"pointer",".did-address-text":{color:"common.white"}},children:[e.jsx(de,{showDid:!0,did:n.triggeredBy,cardType:ue.Detailed,infoType:pe.Minimal,sx:{border:0,padding:0,minWidth:0,".MuiTypography-root":{color:"common.white",fontWeight:400}}}),e.jsx(ce,{}),e.jsxs(p,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(C,{variant:"body2",sx:{color:"primary.main"},children:w("webhookEndpoint.triggeredFrom")}),e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(C,{variant:"body2",children:n.id}),e.jsx(B,{onClick:()=>a(d),children:e.jsx(p,{component:N,icon:Q,sx:{fontSize:16,color:"common.white"}})})]})]})]}),slotProps:{tooltip:{sx:{maxWidth:400}}},children:e.jsx(B,{onClick:()=>a(d),children:e.jsx(p,{component:N,icon:Q,sx:{fontSize:16}})})}),e.jsxs(H,{variant:"outlined",color:"primary",size:"small",onClick:I,disabled:m,children:[e.jsx(p,{component:N,icon:ct,sx:{fontSize:16,animation:m?"spin 1s linear infinite":"none",mr:.5}}),w("notification.resend")]})]})]}),e.jsxs(p,{children:[e.jsxs(C,{variant:"h6",children:[w("webhookEndpoint.response")," (",n.responseStatus,")"]}),e.jsx(J,{language:"json",children:JSON.stringify(n.responseBody,null,2)})]}),e.jsxs(p,{children:[e.jsx(R,{direction:"row",spacing:1,sx:{alignItems:"center"},children:e.jsx(C,{variant:"h6",children:w("webhookEndpoint.request")})}),e.jsx(J,{language:"json",sx:{margin:0},children:JSON.stringify(n.event,null,2)})]})]}),l?.list.length===0&&c&&e.jsxs(p,{children:[e.jsx(R,{direction:"row",spacing:1,sx:{alignItems:"center"},children:e.jsx(C,{variant:"h6",children:w("webhookEndpoint.eventData")})}),e.jsx(J,{language:"json",sx:{margin:0},children:JSON.stringify(c.data,null,2)})]})]})]})}ye.propTypes={eventId:t.string,webhookEndpointId:t.string,event:t.shape({type:t.string,data:t.object,request:t.object,requestInfo:t.object})};const pt=oe(ee)`
|
|
2
2
|
@keyframes spin {
|
|
3
3
|
to {
|
|
4
4
|
transform: rotate(360deg);
|