@abtnode/blocklet-services 1.16.43-beta-20250420-132156-d732158a → 1.16.43-beta-20250422-042711-c40bec75
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/services/auth/connect/gen-access-key.js +9 -2
- package/api/services/auth/session.js +7 -4
- package/dist/assets/{AdapterDayjs-Bq_2AanQ.js → AdapterDayjs-DcprbhsV.js} +1 -1
- package/dist/assets/{ArrowDropDown-CnO3M65x.js → ArrowDropDown-BHNhtNqo.js} +1 -1
- package/dist/assets/{CheckCircle-vHBx3yBd.js → CheckCircle-C7lAzkFm.js} +1 -1
- package/dist/assets/{ChevronLeft-J2DjxamT.js → ChevronLeft-fcaEvvT2.js} +1 -1
- package/dist/assets/{ChevronRight-CbbryV_W.js → ChevronRight-BWcj-otI.js} +1 -1
- package/dist/assets/{Community-eISlOOkV.js → Community-BXFIKoZW.js} +1 -1
- package/dist/assets/{DeleteOutline-D3rMfe5l.js → DeleteOutline-CMgoFNHT.js} +1 -1
- package/dist/assets/{Done-BKjm-wNl.js → Done-CkkNExgL.js} +1 -1
- package/dist/assets/{Download-dWBmoIIz.js → Download-B1KcU2Zd.js} +1 -1
- package/dist/assets/{Edit-BsIdXKZ9.js → Edit-C-ChSGAK.js} +1 -1
- package/dist/assets/{EditIcon-CQgpOLLT.js → EditIcon-BRKobKzh.js} +1 -1
- package/dist/assets/{Email-BWTg6iJI.js → Email-7cDhevM1.js} +1 -1
- package/dist/assets/{Error-BhDI-TWw.js → Error-Du9QXuYs.js} +1 -1
- package/dist/assets/{ExpandLess-ap4H2881.js → ExpandLess-Cdn0T-U2.js} +1 -1
- package/dist/assets/{Google-yY5m8tgo.js → Google-3Ox3gIL3.js} +1 -1
- package/dist/assets/{Holiday-C3bRTVlx.js → Holiday-BtexoPxk.js} +1 -1
- package/dist/assets/{InfoOutlined-xdatqyfu.js → InfoOutlined-ZIQMeu0p.js} +1 -1
- package/dist/assets/{Launch-C6_9RwNa.js → Launch-qJWNGQwX.js} +1 -1
- package/dist/assets/{LaunchOutlined-CG63jbPx.js → LaunchOutlined-BVUDVgft.js} +1 -1
- package/dist/assets/LoadingButton-D_tuQuaP.js +1 -0
- package/dist/assets/{Location-C_mUMqZP.js → Location-BF9BwrVf.js} +1 -1
- package/dist/assets/{LockIcon-G8zLxYzV.js → LockIcon-L5QI4AoC.js} +1 -1
- package/dist/assets/{Meeting-vvmUKHs1.js → Meeting-gc3Ts6jN.js} +1 -1
- package/dist/assets/{MoreHoriz-ylsvAqcI.js → MoreHoriz-ByNTWUxY.js} +1 -1
- package/dist/assets/{OffSick-BTxtVws3.js → OffSick-_EZgqU01.js} +1 -1
- package/dist/assets/{Phone-Cz_yY8ed.js → Phone-oJLFEdfI.js} +1 -1
- package/dist/assets/{PlayArrow-B-b0Dvp8.js → PlayArrow-rSzT1Thf.js} +1 -1
- package/dist/assets/{QuestionMarkCircle-DeAbZuzW.js → QuestionMarkCircle-Cw7EtCDd.js} +1 -1
- package/dist/assets/{ServerLogo-UZVUmHWK.js → ServerLogo-zdbLsMaw.js} +1 -1
- package/dist/assets/{Timezone-5RxC7sK-.js → Timezone-BtCtoEo9.js} +1 -1
- package/dist/assets/{TuneOutlined-DJ2Nw9gU.js → TuneOutlined-BnxAi8kP.js} +1 -1
- package/dist/assets/{ViewList-DYqpQSjn.js → ViewList-DbzNMeex.js} +1 -1
- package/dist/assets/{WorkingRemotely-_QD8QN72.js → WorkingRemotely-YBya8rZT.js} +1 -1
- package/dist/assets/{access-control-DcIGjdcM.js → access-control-q2DA79L8.js} +1 -1
- package/dist/assets/actions-J8MFA_6y.js +1 -0
- package/dist/assets/{add-component-core-BpT5fbHq.js → add-component-core-IYRc9eac.js} +24 -24
- package/dist/assets/{add-resource-BVgzn5lM.js → add-resource-8w2aCwfA.js} +1 -1
- package/dist/assets/{addon-DXuj5GtV.js → addon-BQEpbqTR.js} +1 -1
- package/dist/assets/{advanced-CIJNFJAE.js → advanced-CX8tZItX.js} +1 -1
- package/dist/assets/api-BrU7j0QA.js +1 -0
- package/dist/assets/{appearance-CCLVRyLq.js → appearance-C5895lZP.js} +1 -1
- package/dist/assets/{audit-logs-brXiMrw_.js → audit-logs-DukS3LSM.js} +3 -3
- package/dist/assets/authorize-CEHLfOxJ.js +1 -0
- package/dist/assets/{base32-Dd6rPCV6.js → base32--dljmFCF.js} +1 -1
- package/dist/assets/{branding-31ZnkyoG.js → branding-Abk6CVlX.js} +1 -1
- package/dist/assets/branding-Cczews7F.js +40 -0
- package/dist/assets/bundle-avatar-DFwyxj9P.js +1 -0
- package/dist/assets/button-CJk6Iiza.js +1 -0
- package/dist/assets/click-to-copy-CbKZyfyr.js +1 -0
- package/dist/assets/cloneDeep-SfcdeqEN.js +1 -0
- package/dist/assets/{complete-Cpcoq6Ge.js → complete-ejUOC1cY.js} +2 -2
- package/dist/assets/{component-Djsamap6.js → component-BOLQzzEI.js} +2 -2
- package/dist/assets/{config-BK2qWQnO.js → config-Bv0DcfgY.js} +2 -2
- package/dist/assets/{config-BQ9p6EgE.js → config-efFznM9P.js} +1 -1
- package/dist/assets/{config-navigation-D2PpiTzz.js → config-navigation-1cuUaRsL.js} +6 -6
- package/dist/assets/{config-space-BFcXXNuJ.js → config-space-DEku2tJv.js} +1 -1
- package/dist/assets/confirm-miQS3Z1c.js +7 -0
- package/dist/assets/connect-0B3z_kZV.js +5 -0
- package/dist/assets/{connect-rWOVXBvz.js → connect-OYujfpaQ.js} +1 -1
- package/dist/assets/connect-to-C-vFK0ym.js +1 -0
- package/dist/assets/{content-layout-Cg5RRv1R.js → content-layout-JixQ7owc.js} +1 -1
- package/dist/assets/dashboard-C9tAGBV0.js +280 -0
- package/dist/assets/{delete-confirm-B2Ye1_SC.js → delete-confirm-kKb8VxbQ.js} +1 -1
- package/dist/assets/{did-address-gmPYOGuy.js → did-address-DNf_-NM-.js} +1 -1
- package/dist/assets/domain-RAN90v9n.js +9 -0
- package/dist/assets/domain-action-card-BNybk5kq.js +25 -0
- package/dist/assets/domains-B51g2OQM.js +1 -0
- package/dist/assets/dot-xwsgXXMo.js +7 -0
- package/dist/assets/{email-BAajjNQV.js → email-CBFKGDtB.js} +3 -3
- package/dist/assets/{empty-spinner-yzHJfTIe.js → empty-spinner-Rr_2DR73.js} +1 -1
- package/dist/assets/{exchange-passport-EldPKAEU.js → exchange-passport-2U7cUaM-.js} +1 -1
- package/dist/assets/{format-error-LAoTjvJe.js → format-error-BrmqJs5a.js} +1 -1
- package/dist/assets/{fuel-g6aTZdFA.js → fuel-Ctl6kh4M.js} +1 -1
- package/dist/assets/{gen-access-key-CXCl8SEM.js → gen-access-key-CIrRotRy.js} +2 -2
- package/dist/assets/{get-safe-url-BpQyWsMx.js → get-safe-url-BXaepgsm.js} +1 -1
- package/dist/assets/{get-safe-url-DGJYpGp-.js → get-safe-url-MZ-ksvtD.js} +1 -1
- package/dist/assets/{home-DBeMBDeM.js → home-C2Bgs4zS.js} +1 -1
- package/dist/assets/{iframe-DTWkOiY8.js → iframe-oHkt22fl.js} +1 -1
- package/dist/assets/{index-Bh63LaOx.js → index-51ncOoae.js} +2 -2
- package/dist/assets/{index-BY0gjHeR.js → index-B1-S-x6B.js} +32 -32
- package/dist/assets/{index-D7Oq5q89.js → index-B1EwWGHW.js} +4 -4
- package/dist/assets/index-B1ljmpu4.css +1 -0
- package/dist/assets/{index-C9TPKuLt.js → index-BRXM9-_y.js} +1 -1
- package/dist/assets/{index-C8lvmI4i.js → index-BT3gX_Gs.js} +1 -1
- package/dist/assets/{index-Cg_v1vT_.js → index-BWx6ivvZ.js} +650 -55
- package/dist/assets/{index-lk2RMFv-.js → index-BaU0U5xc.js} +10 -10
- package/dist/assets/index-BiIKWZTs.js +113 -0
- package/dist/assets/{index-B0Z8409R.js → index-C3XAI9I7.js} +1 -1
- package/dist/assets/{index-C6wFIF6L.js → index-C7UL-KG1.js} +2 -2
- package/dist/assets/{index-BGnWzg98.js → index-CILVFQJH.js} +4 -4
- package/dist/assets/{index-B1r8E4TH.js → index-CNpN35y4.js} +1 -1
- package/dist/assets/{index-pV_0wOyY.js → index-CPE8Apzb.js} +1 -1
- package/dist/assets/{index-haYY8BAk.js → index-CYeIiQ6Q.js} +1 -1
- package/dist/assets/index-CzzLOOSx.js +55 -0
- package/dist/assets/{index-BkHi7e8i.js → index-DGPhY8xp.js} +2 -2
- package/dist/assets/{index-DhAVA9HZ.js → index-DHdYd4nT.js} +3 -3
- package/dist/assets/index-DHjPgdgK.js +1 -0
- package/dist/assets/{index-CEMXycV7.js → index-DQc29-JM.js} +1 -1
- package/dist/assets/{index-tUQxVYYQ.js → index-DVQCgvFb.js} +1 -1
- package/dist/assets/{index-CgtY16Wm.js → index-DhGZEbPZ.js} +1 -1
- package/dist/assets/index-Ds7z-vG7.js +10 -0
- package/dist/assets/{index-BfbxxLBr.js → index-GJgyTjK2.js} +9 -9
- package/dist/assets/{index-Xi3jaVFs.js → index-Hl4sXXdc.js} +1 -1
- package/dist/assets/{index-BjmnM2sd.js → index-ILkKQT7G.js} +1 -1
- package/dist/assets/{index-kqlC8JFQ.js → index-YbJjfDTR.js} +1 -1
- package/dist/assets/{index-KWGv7rf_.js → index-qcSTfn8X.js} +2 -2
- package/dist/assets/{invitation-DnZ_Ex8p.js → invitation-CPSru_8S.js} +5 -5
- package/dist/assets/invite-DquuAqEb.js +1 -0
- package/dist/assets/issue-passport-DW27M9Fi.js +1 -0
- package/dist/assets/{item-VCJ7-Z3r.js → item-CdEFLc19.js} +1 -1
- package/dist/assets/{landing-page-QhzHIr--.js → landing-page-DPD1zNWJ.js} +1 -1
- package/dist/assets/{launch-result-message-Ckk5lRW7.js → launch-result-message-yorrVgpQ.js} +1 -1
- package/dist/assets/{layout-0YBKzIlI.js → layout-DBsOgAhr.js} +1 -1
- package/dist/assets/{list-Dw9DDKoC.js → list-BNd4p4TF.js} +9 -8
- package/dist/assets/{list-header-BYlc5SI1.js → list-header-BTUducS9.js} +1 -1
- package/dist/assets/localization-CS7BsCef.js +1 -0
- package/dist/assets/{log-BLTzXOlE.js → log-R8TIkchf.js} +1 -1
- package/dist/assets/logger-d2Lh_KCF.js +1 -0
- package/dist/assets/{login-tmff27IK.js → login-Dgvm6HMJ.js} +1 -1
- package/dist/assets/{login-oauth-callback-DnYvzeVx.js → login-oauth-callback-rmUYgE44.js} +1 -1
- package/dist/assets/logo-uploader-Bv2ZSxJV.js +133 -0
- package/dist/assets/{lost-passport-DiKkPtUB.js → lost-passport-CiVM9B2L.js} +4 -4
- package/dist/assets/{lottie-react.esm-CPHH620R.js → lottie-react.esm-D2t-u0YU.js} +1 -1
- package/dist/assets/{lottie-web-B6s7dDoL.js → lottie-web-jYmAQWuC.js} +1 -1
- package/dist/assets/omit-bLid3PKQ.js +1 -0
- package/dist/assets/{open-window-DjL5TW3X.js → open-window-D2wkW326.js} +1 -1
- package/dist/assets/{overview-zOWtcWbm.js → overview-C_fDcPQA.js} +2 -2
- package/dist/assets/{page-header-BhpaMk9g.js → page-header-C86YQnHE.js} +1 -1
- package/dist/assets/{passport-item-Cxkhzo-W.js → passport-item-C4X2VZeo.js} +1 -1
- package/dist/assets/{permission-_ttLx53e.js → permission-CbDCh9eS.js} +1 -1
- package/dist/assets/preferences-Cdzon7pe.js +1 -0
- package/dist/assets/profile-embed-Dr2ZxkvM.js +1 -0
- package/dist/assets/publish-resource-DumHfLtC.js +1 -0
- package/dist/assets/{raf-schd.esm-GV-XhwE0.js → raf-schd.esm-B3j6BePR.js} +1 -1
- package/dist/assets/{react-beautiful-dnd.esm-gUY08qHq.js → react-beautiful-dnd.esm-kcYalw4r.js} +1 -1
- package/dist/assets/{relative-time-DYjTOclf.js → relative-time-Dkz5qmEb.js} +1 -1
- package/dist/assets/runtime-HBzWjxDb.js +1 -0
- package/dist/assets/sdk-DuZx5LYY.js +1 -0
- package/dist/assets/{security-BD2-azah.js → security-BFBpBlQy.js} +4 -4
- package/dist/assets/session-CdQbSkeB.js +1 -0
- package/dist/assets/setup-BSfklNq4.js +19 -0
- package/dist/assets/{shorten-label-8jfEkawx.js → shorten-label-Dz7RgJfj.js} +1 -1
- package/dist/assets/{simple-select-CNZc1N7Q.js → simple-select-BlUQXxNL.js} +1 -1
- package/dist/assets/{slicedToArray-gyBkcGHe.js → slicedToArray-lOWXD6Th.js} +1 -1
- package/dist/assets/{spaces-B_YG3iE7.js → spaces-CcTi9vap.js} +1 -1
- package/dist/assets/{start-DIhK4VNY.js → start-BitVK7fH.js} +1 -1
- package/dist/assets/{status-CQCKGmiV.js → status-F7OR8ZWk.js} +1 -1
- package/dist/assets/{step-actions-DGcZdY1e.js → step-actions-Cmh5n2jE.js} +1 -1
- package/dist/assets/{studio-CC8lU96f.js → studio-CW2bLcBh.js} +1 -1
- package/dist/assets/{switch-control-BWuo2NQH.js → switch-control-BjOmRKBW.js} +1 -1
- package/dist/assets/{traffic-BIz-TYy2.js → traffic-CcfffSvS.js} +2 -2
- package/dist/assets/{transfer-OroSS_fF.js → transfer-DHcMO-R4.js} +1 -1
- package/dist/assets/{unsubscribe-cKpP6HeV.js → unsubscribe-DnPmucfC.js} +1 -1
- package/dist/assets/{use-app-logo-C5KrAQp3.js → use-app-logo-DnfizCGM.js} +1 -1
- package/dist/assets/{use-mobile-BbxjRR_q.js → use-mobile-Bgy7gTTP.js} +1 -1
- package/dist/assets/{use-mobile-T-9_nK_m.js → use-mobile-CcdVxg80.js} +1 -1
- package/dist/assets/useAsync-70zHrUMr.js +1 -0
- package/dist/assets/useAsync-BquSRC77.js +1 -0
- package/dist/assets/{useLocalStorage-BTc2ONSy.js → useLocalStorage-BJb7uGDO.js} +1 -1
- package/dist/assets/{useSetState-BL3ktMon.js → useSetState-CWq0AVWn.js} +1 -1
- package/dist/assets/user-center-u43jJYr4.js +77 -0
- package/dist/assets/{util-DA84MxE0.js → util-BYLEVYA_.js} +1 -1
- package/dist/assets/{util-Dvapjz4O.js → util-CJbxj6IE.js} +1 -1
- package/dist/assets/{vendor-arcblock-Dd-d3bxC.js → vendor-arcblock-CWji6U03.js} +300 -300
- package/dist/assets/{vendor-hooks-jg6xPUPF.js → vendor-hooks-DftG_2gV.js} +2 -2
- package/dist/assets/{vendor-mui-core-DiDsSLd-.js → vendor-mui-core-CfA4EdRA.js} +26 -26
- package/dist/assets/{vendor-mui-x-mVhD3N7n.js → vendor-mui-x-DSNWmGVo.js} +1 -1
- package/dist/assets/{vendor-react-DoD83n6N.js → vendor-react-DEoibe3W.js} +1 -1
- package/dist/assets/vendor-utils-BNHJB5U7.js +208 -0
- package/dist/assets/vendor-ux-did-connect-zBIy2ulO.js +2265 -0
- package/dist/assets/{wrap-locale-CyEJqSC4.js → wrap-locale-BSYWBgCo.js} +1 -1
- package/dist/assets/zh-_GYrLCB8.js +1 -0
- package/dist/index.html +9 -8
- package/dist/service-worker.js +1 -1
- package/package.json +30 -29
- package/dist/assets/actions-54wIQrhQ.js +0 -1
- package/dist/assets/api-DwjKcjK8.js +0 -1
- package/dist/assets/authorize-DVVvHvmA.js +0 -1
- package/dist/assets/branding-CY0aknSo.js +0 -40
- package/dist/assets/bundle-avatar-BcZExfqu.js +0 -1
- package/dist/assets/button-Cfb46ee0.js +0 -1
- package/dist/assets/click-to-copy-D4Cmyemb.js +0 -1
- package/dist/assets/cloneDeep-DUYD8ZBI.js +0 -1
- package/dist/assets/confirm-Bi4_XwxH.js +0 -7
- package/dist/assets/connect-Bzett2rh.js +0 -5
- package/dist/assets/connect-to-nP4HS-Z0.js +0 -1
- package/dist/assets/dashboard-27JnEnGY.js +0 -279
- package/dist/assets/domain-5-nsJfDM.js +0 -9
- package/dist/assets/domain-action-card-DrjkSQwC.js +0 -25
- package/dist/assets/domains-CD91MGQk.js +0 -1
- package/dist/assets/dot-BBxUn__M.js +0 -7
- package/dist/assets/index-B-h0rpyF.js +0 -10
- package/dist/assets/index-BeXUaMlG.js +0 -55
- package/dist/assets/index-Ca99ESdg.js +0 -1
- package/dist/assets/index-o53rWfYr.js +0 -113
- package/dist/assets/invite-BC0OYJxG.js +0 -1
- package/dist/assets/issue-passport-CD5ylk7Y.js +0 -1
- package/dist/assets/localization-Bqeaav45.js +0 -1
- package/dist/assets/logger-DzZIANXq.js +0 -1
- package/dist/assets/logo-uploader-BKxncdN2.js +0 -133
- package/dist/assets/omit-B1LDXfkq.js +0 -1
- package/dist/assets/preferences-C0eu3vgg.js +0 -1
- package/dist/assets/profile-embed-DfDaKcjJ.js +0 -1
- package/dist/assets/publish-resource-BEIDgQwd.js +0 -1
- package/dist/assets/runtime-B8E7DTqn.js +0 -1
- package/dist/assets/sdk-K0wUtuBQ.js +0 -1
- package/dist/assets/session-BPop7wxF.js +0 -1
- package/dist/assets/setup-DW_rcwsG.js +0 -19
- package/dist/assets/useAsync-B_98ShEr.js +0 -1
- package/dist/assets/user-center-DGFt0-Nt.js +0 -77
- package/dist/assets/vendor-utils-DMClavLd.js +0 -11
- package/dist/assets/vendor-ux-did-connect-qEfzi7sf.js +0 -1832
- package/dist/assets/zh-yJzqRkfw.js +0 -1
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import{r as b}from"./vendor-react-DEoibe3W.js";import{j as e,H as d,a8 as Pe,ac as yt,T as J,a9 as C,E as Fe,bo as _e,bz as et,bR as Te,bs as Re,bS as Ie,y as Se,b3 as Ee,aa as tt,ag as ce,a1 as st,bb as Xe,br as jt,bn as vt,q as Ze,bZ as St}from"./vendor-mui-core-CfA4EdRA.js";import{c as ie,az as ue,A as Ct}from"./vendor-utils-BNHJB5U7.js";import{Y as Z,j as P,b6 as Nt,r as ke,A as wt,u as te,bO as Tt,X as nt,B as Ae,a5 as at,al as Rt,ar as It,bt as Et}from"./vendor-ux-did-connect-zBIy2ulO.js";import{z as At,t as V,l as Dt,I as Je}from"./index-BWx6ivvZ.js";import{f as ee,a as De}from"./vendor-hooks-DftG_2gV.js";import{S as he}from"./shorten-label-Dz7RgJfj.js";import{I as it}from"./index-C7UL-KG1.js";import{A as Ot,S as Lt,a as Pt,b as Ft,B as _t}from"./list-BNd4p4TF.js";import{R as Be}from"./relative-time-Dkz5qmEb.js";import{a as ze}from"./dashboard-C9tAGBV0.js";import{W as kt}from"./did-address-DNf_-NM-.js";import{p as ot}from"./util-CJbxj6IE.js";import{D as Bt,g as zt}from"./traffic-CcfffSvS.js";import{i as Wt,a as Mt}from"./index-Hl4sXXdc.js";import{B as rt}from"./bundle-avatar-DFwyxj9P.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-CWji6U03.js";import"./index-C3XAI9I7.js";import"./use-app-logo-DnfizCGM.js";import"./InfoOutlined-ZIQMeu0p.js";import"./sdk-DuZx5LYY.js";import"./CheckCircle-C7lAzkFm.js";import"./index-Ds7z-vG7.js";import"./Phone-oJLFEdfI.js";import"./Location-BF9BwrVf.js";import"./Email-7cDhevM1.js";import"./Timezone-BtCtoEo9.js";import"./useLocalStorage-BJb7uGDO.js";import"./confirm-miQS3Z1c.js";import"./format-error-BrmqJs5a.js";import"./PlayArrow-rSzT1Thf.js";import"./get-safe-url-MZ-ksvtD.js";import"./session-CdQbSkeB.js";import"./dot-xwsgXXMo.js";import"./useAsync-BquSRC77.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-CcdVxg80.js";import"./base32--dljmFCF.js";import"./iframe-oHkt22fl.js";import"./LaunchOutlined-BVUDVgft.js";import"./ChevronLeft-fcaEvvT2.js";import"./ChevronRight-BWcj-otI.js";import"./index-DhGZEbPZ.js";import"./vendor-mui-x-DSNWmGVo.js";import"./AdapterDayjs-DcprbhsV.js";const lt=b.createContext({}),{Provider:qt,Consumer:mn}=lt;function Kt({children:t,blocklet:s=""}){const{api:n,inService:r,ws:{useSubscription:o}}=At(),[a,x]=b.useState([]),[u,T]=b.useState({total:0,pageSize:20,pageCount:0,page:1}),m=ee(()=>{var h;return(h=s.meta)==null?void 0:h.did},[s]),[v,S]=b.useState([]),[I,M]=b.useState({}),E=ee(()=>a.length?new Set(a.map(h=>h.id)):new Set,[a]),L=async({page:h=1,pageSize:O=20,...D}={})=>{if(!m)return[];try{const F={paging:{page:h,pageSize:O},...D,teamDid:m,dateRange:D.dateRange?[V(D.dateRange[0]).toISOString(),V(D.dateRange[1]).toISOString()]:void 0},{dids:B,...q}=F;let Q="";B&&B.includes("system")&&(Q="system");const z=B?B.filter(f=>f!=="system"):[],oe={...q,source:Q,componentDids:z},se=await n.getNotificationSendLog({input:oe});return M(oe),x(se.list),T(se.paging),se.list}catch(F){return Z.error(F.message),[]}},A=async()=>{const h=await n.getNotificationComponents({input:{teamDid:m}});S(h.componentDids)},G=b.useCallback(h=>{const O=s.children.find(D=>{var F;return((F=D.meta)==null?void 0:F.did)===h});if(O)return O.ancestors=[s],O},[s]),H=async({notificationId:h,receivers:O,channels:D,...F})=>{await n.resendNotification({input:{teamDid:m,notificationId:h,receivers:O,channels:D.map(B=>B==="wallet"?P.NOTIFICATION_SEND_CHANNEL.WALLET:B==="pushKit"?P.NOTIFICATION_SEND_CHANNEL.PUSH:B),...F}})},U=b.useCallback(async h=>(await n.getUser({input:{teamDid:m,user:{did:h}}})).user,[n,m]),N=b.useCallback(async({page:h=1,pageSize:O=20,...D}={})=>{try{const F={paging:{page:h,pageSize:O},...D,userName:D.searchText||"",teamDid:m,dateRange:D.dateRange?[V(D.dateRange[0]).toISOString(),V(D.dateRange[1]).toISOString()]:void 0};return await n.getReceivers({input:F})}catch(F){throw Z.error(F.message),F}},[n,m]);b.useEffect(()=>{m&&A()},[m]),o(P.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,h=>{E.has(h.notificationId)&&L(I)},[E,I]),o(P.EVENTS.NOTIFICATION_BLOCKLET_CREATE,h=>{E.has(h.id)||L(I)},[E,I]);const k={fetch:L,data:a,paging:u,blocklet:s,getComponent:G,resendNotification:H,getUser:U,componentDids:v,getReceivers:N,inService:r,teamDid:m};return e.jsx(qt,{value:{notificationRecords:k},children:t})}function We(){const{notificationRecords:t}=b.useContext(lt);return t}const ye={common:{black:"#000",white:"#fff"},primary:{main:"#3773F2",contrastText:"#fff"},secondary:{main:"#16CED1",contrastText:"#fff"},error:{main:"#F16E6E",contrastText:"#fff"},warning:{main:"#DE9E37",contrastText:"#fff"},info:{main:"#0775F8",contrastText:"#fff"},success:{main:"#34BE74",contrastText:"#fff"},grey:{50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#d5d5d5",A200:"#aaaaaa",A400:"#303030",A700:"#616161"},text:{primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.54)",disabled:"rgba(0, 0, 0, 0.38)",hint:"rgba(0, 0, 0, 0.38)"},divider:"rgba(0, 0, 0, 0.12)",background:{default:"#fff"},did:{primary:"#4598FA",secondary:"#49C3AD"}};ge.propTypes={severity:d.oneOf(Object.values(["info","success","error","warning"])).isRequired};const Ht={info:"primary",success:"success",error:"error",warning:"warning"};function ge({severity:t="info"}){return e.jsx(Nt,{type:Ht[t],children:t})}var Me={},Ut=Pe;Object.defineProperty(Me,"__esModule",{value:!0});var ct=Me.default=void 0,$t=Ut(ke()),Vt=e;ct=Me.default=(0,$t.default)((0,Vt.jsx)("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"CheckCircleOutline");var qe={},Gt=Pe;Object.defineProperty(qe,"__esModule",{value:!0});var dt=qe.default=void 0,Yt=Gt(ke()),Xt=e;dt=qe.default=(0,Yt.default)((0,Xt.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12m8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8"}),"Block");var Ke={},Zt=Pe;Object.defineProperty(Ke,"__esModule",{value:!0});var ut=Ke.default=void 0,Jt=Zt(ke()),Qt=e;ut=Ke.default=(0,Jt.default)((0,Qt.jsx)("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"}),"Refresh");const es=(t,s,n="")=>{if(!n||!s)return"";switch(n){case P.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:s});case P.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:s});case P.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:s});case P.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return n}};function pt(t,s,n={}){const{status:r,updatedAt:o,reason:a="",channel:x="wallet"}=n,u=o?t("notification.sendStatus.sentTime",{date:Dt(o,s)}):"",T=es(t,x,a);return r===P.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:u,reason:T}:r===P.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:u}:{status:"pending",title:t("notification.sendStatus.pending"),reason:T,sentTime:u}}const Oe={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Le=["wallet","pushKit","email"],Qe=["info","success","error","warning"],ft=t=>{var n,r;const{settings:s}=t;return(r=(n=s==null?void 0:s.notification)==null?void 0:n.email)==null?void 0:r.enabled},mt=t=>{var n,r;const{settings:s}=t;return(r=(n=s==null?void 0:s.notification)==null?void 0:n.pushKit)==null?void 0:r.enabled},ts=(t,s)=>{const n=ie(s,"extra.notifications.email",!0);return{available:ft(t),enabled:n}},ss=(t,s)=>{const n=ie(s,"extra.notifications.push",!0);return{available:mt(t),enabled:n}},ns=t=>({enabled:ie(t,"extra.notifications.wallet",!0)}),as=t=>({enabled:ie(t,"extra.webhooks",[]).length>0}),xe=(t=3)=>new Promise(s=>{setTimeout(()=>{s()},t*1e3)}),is=(t,s)=>s==="wallet"||s==="webhook"?[{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:s==="pushKit"||s==="email"?[{channel:s,type:"available",pass:t("notification.sendStatus.reason.available",{channel:s}),fail:t("notification.sendStatus.reason.unavailable",{channel:s})},{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:[],be=(t=[])=>{const s=V().startOf("day");return t.filter(n=>V(n.sendAt).isSame(s,"day")).length},os=(t,s="")=>{if(s&&Le.includes(s)){const a=`${s}SendRecord`,x=ie(t,a,[]);return be(x)}const n=ie(t,"webhook",{}),r=Object.keys(n??{})??[];if(s&&r.includes(s)){const a=n[s]??[];return be(a)}const o={};return Le.forEach(a=>{const x=`${a}SendRecord`,u=ie(t,x,[]),T=be(u);o[a]=T}),r.length>0&&r.forEach(a=>{const x=n[a]??[],u=be(x);o[a]=u}),o},je=(t,s,n)=>{if(!Array.isArray(t))throw new Error("Invalid filterList or index");return t[n].splice(s,1),t},ve=(t,s)=>{if(!Array.isArray(s))throw new Error("filters must be an array");return s.length?!s.includes(t):!1},rs=t=>{switch(t){case P.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case P.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case P.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case P.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},ht=()=>wt({typography:{fontSize:14,button:{textTransform:"none"}},components:{MUIDataTableFilter:{styleOverrides:{header:{marginBottom:0,p:{margin:0}},root:{"& .MuiGrid-container":{marginTop:0,"& .MuiGrid-item":{paddingTop:0}}}}},MuiPopover:{styleOverrides:{root:{"&.MuiPopover-root":{"& .MuiPaper-root:has(.filter-container)":{width:"420px"}}}}}}});function ne({config:t,enableTooltip:s=!0,showTitle:n=!1,children:r}){const{status:o,title:a="",sentTime:x="",reason:u=""}=t,T=[a,u].filter(Boolean).join(", ");return e.jsx(yt,{title:s?e.jsxs(e.Fragment,{children:[e.jsx(J,{color:"inherit",sx:{fontSize:12},children:T}),e.jsx("span",{children:x})]}):null,arrow:!0,placement:"top",children:e.jsxs(C,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(C,{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center",children:[e.jsx(C,{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Oe[o],style:{opacity:.15}}),e.jsx(C,{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Oe[o]})]}),e.jsx(J,{color:"inherit",sx:{fontSize:12},children:n?a:r})]})})}ne.propTypes={config:d.object.isRequired,enableTooltip:d.bool,showTitle:d.bool,children:d.node};ne.defaultProps={enableTooltip:!0,showTitle:!1,children:null};pe.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};pe.defaultProps={onDelete:()=>{}};function pe({list:t,label:s,onDelete:n}){const{t:r,locale:o}=te();return e.jsxs(C,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(J,{children:[s,": "]}),t.map(a=>{const x=pt(r,o,{status:a});return e.jsx(Fe,{size:"small",label:e.jsx(C,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(ne,{config:x,enableTooltip:!1,children:x.title})}),onDelete:u=>n(u,a)},a)})]})}He.propTypes={filterList:d.array.isRequired,onChange:d.func.isRequired,index:d.number.isRequired,column:d.object.isRequired,filterValues:d.array.isRequired,label:d.string.isRequired,renderLabel:d.func.isRequired};function He({filterList:t,onChange:s,index:n,column:r,filterValues:o,label:a,renderLabel:x}){return e.jsxs(_e,{className:"filter-container",children:[e.jsx(et,{component:"legend",children:a}),e.jsx(Te,{row:!0,children:o.map(u=>e.jsx(Re,{control:e.jsx(Ie,{checked:t[n].indexOf(u.value??u)>-1,onChange:T=>{const m=[...t];T.target.checked?m[n]=[...m[n],u.value??u]:m[n]=m[n].filter(v=>v!==(u.value??u)),s(m[n],n,r)},name:u.value??u}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:x(u)})},u.value??u))})]})}function we(t){return e.jsx(He,{...t,renderLabel:s=>e.jsx(ne,{enableTooltip:!1,config:{status:s.status},children:s.label})})}de.propTypes={status:d.number.isRequired,updatedAt:d.string.isRequired,reason:d.string,channel:d.string,onResend:d.func};function de({status:t,updatedAt:s,reason:n="",channel:r="wallet",onResend:o}){const{t:a,locale:x}=te(),u=pt(a,x,{status:t,updatedAt:s,reason:n,channel:r});return e.jsxs(C,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(ne,{config:u,showTitle:!0}),u.status!=="success"&&e.jsx(Se,{className:"resend-btn",size:"small",startIcon:e.jsx(ze,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:o,children:a("notification.resend")})]})}Ue.propTypes={value:d.array.isRequired,onChange:d.func};function Ue({value:t,onChange:s}){const{locale:n}=te(),r=V().toDate(),[o,a]=b.useState(null),x=b.useCallback(m=>{a(o?null:m.currentTarget)},[o]),u=!!o,T=b.useCallback(m=>{if(!m.startDate||!m.endDate){Z.error("Please select a date range");return}if(V(m.startDate).isAfter(m.endDate)||!V(m.startDate).isValid()||!V(m.endDate).isValid()){Z.error("Invalid date range");return}s([m.startDate,m.endDate]),a(null)},[s]);return e.jsxs("div",{children:[e.jsx(J,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:0,children:e.jsxs(Se,{onClick:x,variant:"outlined",size:"small",color:"inherit",children:[Je(t[0],n)," - ",Je(t[1],n)]})}),e.jsx(Ee,{open:u,anchorEl:o,onClose:()=>{a(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(Bt,{open:!0,maxDate:r,initialDateRange:{startDate:t[0],endDate:t[1]},toggle:x,definedRanges:zt(r),onChange:T})})]})}$e.propTypes={itemComponent:d.elementType.isRequired};function $e({itemComponent:t,...s}){var o;const{t:n}=te();return!((o=s==null?void 0:s.filterList)!=null&&o.filter(a=>a.length).length)?null:e.jsxs(C,{display:"flex",gap:1,alignItems:"center",children:[e.jsx("div",{className:"toolbar-filter-title",children:n("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(Tt.TableFilterList,{...s,ItemComponent:t})})]})}function Ce({label:t,onDelete:s,canDelete:n=()=>!0,...r}){const o=s&&typeof s=="function"?s:void 0;let a=!0;return n&&typeof n=="function"&&(a=n({label:t,...r})),e.jsx(Fe,{label:t,variant:"outlined",...o&&a?{onDelete:o}:{}})}Ce.propTypes={label:d.string.isRequired,onDelete:d.func,canDelete:d.func};Ce.defaultProps={canDelete:()=>!0};const ls=[{label:"Wallet",value:"app",checked:!0},{label:"Email",value:"email",checked:!0},{label:"Push Kit",value:"push",checked:!0},{label:"Webhook",value:"webhook",checked:!0}];Ve.propTypes={loading:d.bool,onCancel:d.func,onConfirm:d.func};Ve.defaultProps={loading:!1,onCancel:()=>{},onConfirm:()=>{}};function Ve({loading:t=!1,onCancel:s,onConfirm:n}){const{t:r}=te(),[o,a]=b.useState(ls),[x,u]=b.useState(!0),T=(v,S)=>{S.checked=v.target.checked;const I=o.map(M=>({...M,checked:M.value===S.value?S.checked:M.checked}));a(I)},m=v=>{v.stopPropagation(),n({channels:o.filter(S=>S.checked).map(S=>S.value),isResendFailedOnly:x})};return e.jsxs(C,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(J,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(C,{className:"choose-channel",children:e.jsxs(_e,{component:"fieldset",variant:"standard",children:[e.jsx(et,{component:"legend",children:r("notification.selectChannels")}),e.jsx(Te,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:o.map(v=>e.jsx(Re,{control:e.jsx(Ie,{checked:v.checked,onChange:S=>T(S,v),name:v.value}),label:v.label},v.value))})]})}),e.jsx(C,{className:"resend-config-footer",children:e.jsx(Te,{children:e.jsx(Re,{control:e.jsx(Ie,{checked:x,onChange:v=>u(v.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(C,{display:"flex",justifyContent:"flex-end",gap:1,className:"resend-config-footer-tip",children:[e.jsx(Se,{onClick:v=>{v.stopPropagation(),s()},color:"inherit",children:r("common.cancel")}),e.jsxs(Se,{onClick:m,color:"primary",disabled:t,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[t&&e.jsx(tt,{size:16}),r("common.confirm")]})]})]})}gt.propTypes={notificationId:d.string.isRequired,handleResend:d.func,resending:d.bool};function gt({notificationId:t,handleResend:s,resending:n=!1}){const{t:r,locale:o}=te(),{getReceivers:a,inService:x,teamDid:u,getUser:T,blocklet:m}=We(),[v,S]=b.useState(!1),[I,M]=b.useState([]),E=De({anchorEl:null,position:null}),L=De({anchorEl:null,position:null}),[A,G]=b.useState(null),[H,U]=b.useState({total:0,pageSize:10,pageCount:0,page:1}),[N,k]=b.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[V().subtract(1,"month").startOf("day").toDate(),V().endOf("day").toDate()]}),[h,O]=b.useState([]),D=[{label:r("notification.sendStatus.pending"),value:0,status:"pending"},{label:r("notification.sendStatus.success"),value:1,status:"success"},{label:r("notification.sendStatus.failed"),value:2,status:"failed"}],F=async()=>{if(!v&&t)try{S(!0);const i=await a({notificationId:t,...N}),l=i.list.map(c=>({...c,receiverUser:{...c.receiverUser,avatar:ot(c.receiverUser.avatar,u,x)}}));M(l),U(i.paging),S(!1)}catch(i){Z.error(i.message),S(!1)}};b.useEffect(()=>{F()},[N]);const B=i=>{i.stopPropagation();const l=i.currentTarget;L.anchorEl=l;const c=l.getBoundingClientRect();L.position={top:c.top+window.scrollY,left:c.left+window.scrollX}},q=i=>i.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(Ae,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(ze,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:B,children:r("notification.resend")})}):null,Q={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:H.page-1,rowsPerPage:H.pageSize,count:H.total,searchText:N.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:h,onRowSelectionChange:(i,l)=>{O(l.map(c=>c.dataIndex))},customToolbarSelect:q},z=({page:i,rowsPerPage:l,searchText:c,filterList:j})=>{const[,_=[],$=[],K=[]]=j;N.pageSize!==l?k(W=>({...W,pageSize:l,page:1})):N.page!==i+1?k(W=>({...W,page:i+1})):N.searchText!==c?k(W=>({...W,searchText:c,page:1})):ue(_,N.walletSendStatus)?ue($,N.pushKitSendStatus)?ue(K,N.emailSendStatus)||k(W=>({...W,emailSendStatus:K,page:1})):k(W=>({...W,pushKitSendStatus:$,page:1})):k(W=>({...W,walletSendStatus:_,page:1}))},oe=b.useCallback(async(i,l)=>{if(!l)return!1;const c=await T(l);return c?i==="wallet"?ns(c):i==="email"?ts(m,c):i==="pushKit"?ss(m,c):i==="webhook"?as(c):!0:!1},[T,m]),se=b.useCallback(i=>is(r,i),[r]),f=()=>{E.anchorEl=null,E.position=null,G(null)},p=()=>{L.anchorEl=null,L.position=null},g=async(i,l,c=!0,j="")=>{if(!(!l.length||!i.length))try{s(i,l,c,j),L.anchorEl||(await xe(.5),f())}catch(_){console.error("handleResend error",{error:_})}},y=async({channels:i,isResendFailedOnly:l})=>{const c=h.map(j=>I[j].receiver);await g(i,c,l),await xe(.5),p(),O([])},R=async(i,l=[],c=!0)=>{try{await g(["webhook"],[i.receiver],c,l)}catch(j){Z.error(j.response?j.response.statusText:j.message)}},w=async(i,l,c,j=[],_=!0)=>{if(i.stopPropagation(),os(l,c)>=4){Z.warning(r("notification.resendLimit"));return}if(!Le.includes(c)){await R(l,j,_);return}if(i){const K=i.currentTarget,W=K.getBoundingClientRect();E.anchorEl=K,E.position={top:W.top+window.scrollY,left:W.left+window.scrollX}}G({channel:c});try{const K=await oe(c,l.receiver);await xe(1),G({channel:c,result:K}),(typeof K=="boolean"&&K||Ct(K)&&Object.values(K).every(W=>!!W))&&(await s([c],[l.receiver],_),L.anchorEl||(await xe(.5),f()))}catch(K){Z.error(K.message)}},Y=i=>{k(l=>({...l,dateRange:i,page:1}))},X=(i,l,c,j)=>{i.stopPropagation();const _=c.filter($=>$!==l);k($=>({...$,[j]:_,page:1}))},ae=ee(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:i=>{const{receiverUser:l,receiver:c}=I[i];return l?e.jsxs(C,{"data-cy":`member-name-${l.fullName}`,display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start",children:[e.jsx(nt,{src:`${l.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:c,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(he,{children:l.fullName})]},c):e.jsx(kt,{size:14,responsive:!1,compact:!0,copyable:!1,did:c})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:N.walletSendStatus??[],customFilterListOptions:{render:i=>e.jsx(pe,{list:i,label:"Wallet",onDelete:(l,c)=>{l.stopPropagation(),X(l,c,ae[1].options.filterList,"walletSendStatus")}}),update:je},filterOptions:{names:D,fullWidth:!0,logic:ve,display:(i,l,c,j)=>e.jsx(we,{label:"Wallet",filterList:i,onChange:l,index:c,column:j,filterValues:D})},customBodyRenderLite:i=>{const{walletSendStatus:l,walletSendAt:c,walletSendFailedReason:j}=I[i];return e.jsx(de,{status:l,updatedAt:c,reason:j,channel:"wallet",onResend:_=>w(_,I[i],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:i=>{const{pushKitSendStatus:l,pushKitSendAt:c,pushKitSendFailedReason:j}=I[i];return e.jsx(de,{status:l,updatedAt:c,reason:j,channel:"pushkit",onResend:_=>w(_,I[i],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:N.pushKitSendStatus??[],customFilterListOptions:{render:i=>e.jsx(pe,{list:i,label:"Push Kit",onDelete:(l,c)=>{l.stopPropagation(),X(l,c,ae[2].options.filterList,"pushKitSendStatus")}}),update:je},filterOptions:{names:D,fullWidth:!0,logic:ve,display:(i,l,c,j)=>e.jsx(we,{label:"Push Kit",filterList:i,onChange:l,index:c,column:j,filterValues:D})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:i=>{const{emailSendStatus:l,emailSendAt:c,emailSendFailedReason:j}=I[i];return e.jsx(de,{status:l,updatedAt:c,reason:j,channel:"email",onResend:_=>w(_,I[i],"email",[],!1)})},filter:!0,filterType:"custom",filterList:N.emailSendStatus??[],customFilterListOptions:{render:i=>e.jsx(pe,{list:i,label:"Email",onDelete:(l,c)=>{l.stopPropagation(),X(l,c,ae[3].options.filterList,"emailSendStatus")}}),update:je},filterOptions:{names:D,fullWidth:!0,logic:ve,display:(i,l,c,j)=>e.jsx(we,{label:"Email",filterList:i,onChange:l,index:c,column:j,filterValues:D})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:i=>{const{webhook:l}=I[i];if(!l)return null;const c=Object.entries(l)[0];if(!c)return null;const[j,_]=c,$=_[0];return e.jsx(C,{display:"flex",flexDirection:"column",gap:1,children:e.jsxs(C,{className:"webhook-item",fontSize:12,children:[e.jsx(he,{maxLength:30,children:j},j),e.jsx(de,{status:$.status,updatedAt:$.sendAt,reason:$.failedReason,channel:"webhook",onResend:K=>w(K,I[i],"webhook",[j],!1)})]},j)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:i=>{const{createdAt:l}=I[i];return e.jsx(Be,{value:l,locale:o,shouldUpdate:!0})}}}],[I,o,N,r]),Ye=[e.jsx(Ue,{value:N.dateRange,onChange:Y},"date-picker"),e.jsx(Ae,{variant:"contained",size:"small",color:"primary",loading:v,startIcon:e.jsx(ut,{}),onClick:()=>F(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(C,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(ds,{children:e.jsxs(st,{theme:ht(),children:[e.jsx(at,{className:"receivers-table",locale:o,loading:v,columns:ae,data:I,onChange:z,options:Q,customButtons:Ye,components:{TableFilterList:i=>e.jsx($e,{...i,itemComponent:l=>e.jsx(Ce,{...l,canDelete:()=>!1})})}}),E.anchorEl&&e.jsx(Ee,{open:!!E.anchorEl,anchorReference:"anchorPosition",anchorPosition:E.position,onClose:f,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(us,{children:[e.jsxs(J,{variant:"body1",component:"div",className:"check-title",children:[A==null?void 0:A.channel," Checking"]}),e.jsx(C,{display:"flex",flexDirection:"column",sx:{gap:"4px"},children:se(A==null?void 0:A.channel).map(i=>{var _,$;const{type:l,pass:c,fail:j}=i;return!(A!=null&&A.result)||(_=A==null?void 0:A.result)!=null&&_[l]?e.jsxs(J,{variant:"body1",component:"div",className:"check-item",display:"flex",alignItems:"center",sx:{gap:"4px",color:($=A==null?void 0:A.result)!=null&&$[l]?ye.success.main:"inherit"},children:[A!=null&&A.result?e.jsx(ct,{}):e.jsx(tt,{size:12,sx:{color:ye.primary.main}}),e.jsx("span",{children:c})]},l):e.jsxs(J,{variant:"body1",component:"div",display:"flex",alignItems:"center",className:"check-item",sx:{gap:"4px",color:ye.error.main},children:[e.jsx(dt,{}),e.jsx("span",{children:j})]},l)})})]})}),L.anchorEl&&e.jsx(Ee,{open:!!L.anchorEl,anchorReference:"anchorPosition",anchorPosition:L.position,onClose:p,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(Ve,{loading:n,onCancel:p,onConfirm:y})})]})})})}const cs=b.memo(gt),ds=ce.div`
|
|
2
|
+
td.MuiTableCell-footer {
|
|
3
|
+
border: none !important;
|
|
4
|
+
}
|
|
5
|
+
.sent-status-cell {
|
|
6
|
+
.resend-btn {
|
|
7
|
+
display: none;
|
|
8
|
+
}
|
|
9
|
+
&:hover {
|
|
10
|
+
.resend-btn {
|
|
11
|
+
display: flex;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
`,us=ce.div`
|
|
16
|
+
padding: 8px 16px;
|
|
17
|
+
.check-title {
|
|
18
|
+
font-weight: 500;
|
|
19
|
+
margin-bottom: 8px;
|
|
20
|
+
&::first-letter {
|
|
21
|
+
text-transform: uppercase;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
.check-item {
|
|
25
|
+
svg {
|
|
26
|
+
font-size: 16px;
|
|
27
|
+
}
|
|
28
|
+
font-size: 12px;
|
|
29
|
+
}
|
|
30
|
+
`,fe=t=>t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t;function ps(t){const{wallet:s,push:n,email:r,webhook:o}=t;return[{name:"Wallet",value:e.jsx(re,{item:s})},{name:"Push",value:e.jsx(re,{item:n})},{name:"Email",value:e.jsx(re,{item:r})},...o.total>0?[{name:"Webhook",value:e.jsx(re,{item:o,isWebhook:!0})}]:[]]}function fs(t,s,n){const{wallet:r,push:o,email:a,webhook:x}=t;return[{name:"Wallet",value:e.jsx(le,{loading:n,channel:P.NOTIFICATION_SEND_CHANNEL.WALLET,item:r,onResend:s})},{name:"Push",value:e.jsx(le,{loading:n,channel:P.NOTIFICATION_SEND_CHANNEL.PUSH,item:o,onResend:s})},{name:"Email",value:e.jsx(le,{loading:n,channel:P.NOTIFICATION_SEND_CHANNEL.EMAIL,item:a,onResend:s})},...x.total>0?[{name:"Webhook",value:e.jsx(le,{loading:n,channel:P.NOTIFICATION_SEND_CHANNEL.WEBHOOK,item:x,isWebhook:!0,onResend:s})}]:[]]}Ne.propTypes={statistics:d.object.isRequired,onResend:d.func,mode:d.oneOf(["simple","detail"]),resending:d.bool};Ne.defaultProps={mode:"simple",onResend:()=>{},resending:!1};re.propTypes={item:d.object.isRequired,isWebhook:d.bool};re.defaultProps={isWebhook:!1};function re({item:t,isWebhook:s=!1}){const{t:n}=te(),r=s?t.success.length:t.success,o=t.total,a=r===o?"success":"failed";return e.jsx(C,{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:2,children:e.jsx(C,{display:"flex",alignItems:"center",gap:1,children:e.jsxs(ne,{config:{status:a},enableTooltip:!1,children:[fe(r)," / ",fe(o)," ",n("notification.sendStatus.success")]})})})}le.propTypes={item:d.object.isRequired,isWebhook:d.bool,channel:d.string,onResend:d.func,loading:d.bool};le.defaultProps={isWebhook:!1,channel:P.NOTIFICATION_SEND_CHANNEL.WALLET,onResend:()=>{},loading:!1};function le({channel:t,item:s,isWebhook:n=!1,onResend:r,loading:o}){const{t:a}=te(),{success:x,failed:u,pending:T}=s,m=rs(t),v=n?x.length:x,S=n?u.length:u,I=n?T.length:T,M=async G=>{G.stopPropagation();const H=n?[...new Set([...x,...u].map(U=>U))]:[];await r([t],[],!0,H)},E=v+S,L=E>0?v/E*100:0,A=E>0?S/E*100:0;return e.jsxs(ms,{successRatio:L,failedRatio:A,children:[e.jsxs(J,{variant:"h6",children:[m," (",s.total,")"]}),e.jsxs(J,{variant:"body1",sx:{mb:2},children:[e.jsx("span",{style:{color:Oe.success,fontWeight:600,fontSize:24},children:fe(v)}),e.jsx("small",{style:{paddingLeft:4},children:a("notification.sendStatus.success")})]}),e.jsxs(C,{className:"unsent-area",children:[e.jsxs(C,{children:[e.jsxs(ne,{config:{status:"failed"},enableTooltip:!1,children:[fe(S)," ",a("notification.sendStatus.failed")]}),e.jsxs(ne,{config:{status:"pending"},enableTooltip:!1,children:[fe(I)," ",a("notification.sendStatus.pending")]})]}),S>0&&e.jsx(C,{className:"resend-btn",children:e.jsx(Ae,{size:"small",color:"primary",loading:o,variant:"contained",startIcon:e.jsx(ze,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:M,children:a("notification.resend")})})]})]})}function Ne({statistics:t,mode:s="simple",onResend:n,resending:r}){const o=ee(()=>s==="simple"?ps(t):fs(t,n,r),[t,s]);return s==="simple"?e.jsx("div",{children:o.map(a=>e.jsx(it,{style:{alignItems:"flex-start",marginBottom:s==="simple"?0:16},valueComponent:"div",nameWidth:100,name:a.name,children:a.value},a.name))}):e.jsx(Xe,{container:!0,spacing:2,children:o.map(a=>e.jsx(Xe,{item:!0,md:4,sm:6,xs:12,children:a.value},a.name))})}const ms=ce(C)`
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
align-items: flex-start;
|
|
34
|
+
padding: 16px;
|
|
35
|
+
border-radius: 8px;
|
|
36
|
+
background: ${({successRatio:t,failedRatio:s})=>t===0&&s===0?"#eff3fa":`linear-gradient(to right, #dafee7 ${t}%, #fef2f2 ${t}%)`};
|
|
37
|
+
transition: 'background 0.5s ease',
|
|
38
|
+
cursor: pointer;
|
|
39
|
+
.unsent-area {
|
|
40
|
+
width: 100%;
|
|
41
|
+
position: relative;
|
|
42
|
+
.resend-btn {
|
|
43
|
+
position: absolute;
|
|
44
|
+
right: 0;
|
|
45
|
+
bottom: 0;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
`;xt.propTypes={notification:d.object.isRequired,onCancel:d.func,blocklet:d.object.isRequired,tab:d.string};function xt({notification:t,onCancel:s=()=>{},blocklet:n,tab:r="info"}){const{t:o,locale:a}=te(),{getComponent:x,resendNotification:u}=We(),[T,m]=b.useState(!1),v=ee(()=>x(t.componentDid)||n,[n,t.componentDid]),S=De({tab:r||"info"}),I=b.useCallback(async(h,O,D=!0,F=[])=>{var Q;if(!h.length||!t.id)return;const B=O.length>0?O:(Q=t==null?void 0:t.receivers)==null?void 0:Q.map(z=>z.receiver);if(!B.length)return;let q=[...h];if(q.includes(P.NOTIFICATION_SEND_CHANNEL.PUSH)&&!mt(n)&&(Z.warning(o("notification.sendStatus.reason.unavailable",{channel:"Push Kit"})),q=q.filter(z=>z!==P.NOTIFICATION_SEND_CHANNEL.PUSH)),q.includes(P.NOTIFICATION_SEND_CHANNEL.EMAIL)&&!ft(n)&&(Z.warning(o("notification.sendStatus.reason.unavailable",{channel:"Email"})),q=q.filter(z=>z!==P.NOTIFICATION_SEND_CHANNEL.EMAIL)),!!q.length)try{m(!0),await u({notificationId:t.id,receivers:B,channels:q,resendFailedOnly:D,...q.includes("webhook")&&F.length?{webhookUrls:F}:{}}),Z.success("Message has been sent!")}catch(z){console.error("handleResend error",{error:z}),Z.error(z.response?z.response.statusText:z.message)}finally{m(!1)}},[n,t.id,t==null?void 0:t.receivers,u,o]),M=ee(()=>Wt(t),[t]),E=ee(()=>Mt(t),[t]),L=ee(()=>M?t==null?void 0:t.actorInfo:[],[t]),A=ee(()=>{var h;return(n==null?void 0:n.did)||((h=n==null?void 0:n.meta)==null?void 0:h.did)||""},[n]);function G(){return[{name:o("notification.from"),value:M&&E?e.jsx(Ot,{actors:L,teamDid:A,size:32,showName:!0}):e.jsx(Lt,{size:32,blocklet:v,showName:!0,hideDot:!0})},{name:o("notification.notificationTitle"),value:e.jsx(he,{maxLength:50,children:t.title})},{name:o("notification.body"),value:M?e.jsx(Pt,{notification:t,blocklet:n}):e.jsx(Ft,{notification:t,rows:0})},{name:o("notification.severity"),value:e.jsx(ge,{severity:t.severity})},{name:o("notification.createdAt"),value:e.jsx(Be,{value:t.createdAt,locale:a,shouldUpdate:!0})}].map(O=>e.jsx(it,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:120,name:O.name,children:O.value},O.name))}const H={info:{label:o("common.basicInfo"),value:"info",component:G},receivers:{label:o("notification.receiver"),value:"receivers"},statistics:{label:o("notification.statistics"),value:"statistics"}},U=Object.values(H).map(({label:h,value:O})=>({label:h,value:O})),N=H[S.tab]||H.info,k=h=>{S.tab=h};return e.jsx(Rt,{title:o("notification.notificationDetails"),fullWidth:!0,maxWidth:"lg",onClose:()=>{S.tab="info",s()},open:!0,actionsPosition:"left",sx:{".ux-dialog_header":{paddingBottom:0},".MuiDialogContent-root":{paddingTop:0}},children:e.jsxs(gs,{children:[e.jsx(C,{mx:3,className:"tabs",children:e.jsx(It,{tabs:U,current:S.tab,onChange:k,scrollButtons:"auto"})}),e.jsxs("div",{className:"body",children:[S.tab==="receivers"&&e.jsx(cs,{notificationId:t.id,resending:T,handleResend:I}),S.tab==="statistics"&&e.jsx(Ne,{statistics:t.statistics,mode:"detail",resending:T,onResend:I}),S.tab==="info"&&e.jsx(N.component,{})]})]})})}const hs=b.memo(xt),gs=ce.div`
|
|
49
|
+
& > .notification-row {
|
|
50
|
+
padding: 0;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.tabs {
|
|
54
|
+
margin: 0;
|
|
55
|
+
}
|
|
56
|
+
.body {
|
|
57
|
+
margin-top: 16px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.channel-item {
|
|
61
|
+
display: flex;
|
|
62
|
+
padding: 4px;
|
|
63
|
+
justify-content: flex-start;
|
|
64
|
+
align-items: center;
|
|
65
|
+
gap: 8px;
|
|
66
|
+
> p {
|
|
67
|
+
font-size: 15px;
|
|
68
|
+
}
|
|
69
|
+
.resend-btn {
|
|
70
|
+
svg {
|
|
71
|
+
font-size: 16px;
|
|
72
|
+
}
|
|
73
|
+
display: flex;
|
|
74
|
+
align-items: center;
|
|
75
|
+
font-size: 12px;
|
|
76
|
+
cursor: pointer;
|
|
77
|
+
&.disabled {
|
|
78
|
+
cursor: not-allowed;
|
|
79
|
+
color: ${ye.text.disabled};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
`;me.propTypes={blocklet:d.object,label:d.string};me.defaultProps={blocklet:null,label:""};const xs=ce.div`
|
|
84
|
+
display: flex;
|
|
85
|
+
justify-items: flex-start;
|
|
86
|
+
align-items: center;
|
|
87
|
+
gap: 8px;
|
|
88
|
+
.name {
|
|
89
|
+
display: block;
|
|
90
|
+
max-width: 260px;
|
|
91
|
+
white-space: nowrap;
|
|
92
|
+
overflow: hidden;
|
|
93
|
+
text-overflow: ellipsis;
|
|
94
|
+
}
|
|
95
|
+
`;function me({blocklet:t,label:s}){var n;return e.jsx(xs,{children:t?e.jsxs(e.Fragment,{children:[e.jsx(rt,{size:24,blocklet:t,ancestors:t.ancestors}),e.jsx("span",{className:"name",children:t.title||((n=t.meta)==null?void 0:n.title)})]}):e.jsx("span",{className:"name",children:s})})}Ge.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};Ge.defaultProps={onDelete:()=>{}};function Ge({list:t,label:s,onDelete:n}){return e.jsxs(C,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(J,{children:[s,": "]}),t.map(r=>e.jsx(Fe,{size:"small",label:e.jsx(C,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(ge,{severity:r})}),onDelete:o=>n(o,r)},r))]})}function bs(t){return e.jsx(He,{...t,renderLabel:s=>e.jsx(ge,{severity:s})})}function ys({customTableButtons:t}){var se;const{t:s,locale:n}=te(),[r,o]=b.useState(!1),{data:a,paging:x,blocklet:u,fetch:T,getComponent:m,componentDids:v,inService:S,teamDid:I}=We(),M=b.useRef(null),[E,L]=b.useState(null),[A,G]=b.useState("info"),H=`notification-records-${(se=u.meta)==null?void 0:se.did}`,U=Et(H),[N,k]=b.useState({pageSize:U.rowsPerPage||10,page:U.page?U.page+1:1,dids:U.dids||[],dateRange:U.dateRange||[V().subtract(1,"month").startOf("day").toDate(),V().endOf("day").toDate()]}),h=ee(()=>{if(!u.children||!u.children.length)return[];const f=[];return u.children.forEach(p=>{var y;const g=p.did||((y=p.meta)==null?void 0:y.did);v.includes(g)&&(p.ancestors=[u],f.push(p))}),f},[v,u]),O=b.useCallback(async()=>{try{o(!0),await T(N),o(!1)}finally{o(!1)}},[T,N]);b.useEffect(()=>{O()},[]),b.useEffect(()=>{const f=a.find(p=>p.id===(E==null?void 0:E.id));E&&f&&L({...f})},[a,E]);const D=(f,p,g,y)=>{f.stopPropagation();const R=g.filter(w=>w!==p);k(w=>({...w,[y]:R,page:1}))},F=({page:f,rowsPerPage:p,filterList:g})=>{const[y=[],,,,R=[]]=g;N.pageSize!==p?k(w=>({...w,pageSize:p,page:1})):N.page!==f+1?k(w=>({...w,page:f+1})):ue(N.dids,y)?ue(N.severities,R)||k(w=>({...w,severities:R,page:1})):k(w=>({...w,dids:y,page:1}))},B=b.useCallback(()=>{L(null),G("info")},[]),q=b.useCallback(()=>{T(N)},[T,N]),Q=[{label:s("notification.from"),name:"sender",width:400,options:{filter:!0,filterType:"custom",customFilterListOptions:{render:f=>f.map((p,g)=>{var R;if(p==="system")return e.jsx("span",{children:s("notification.system")},`system-${g}`);const y=h.find(w=>{var X;return(w.did||((X=w.meta)==null?void 0:X.did))===p});return e.jsx(me,{blocklet:y,label:(y==null?void 0:y.title)||((R=y==null?void 0:y.meta)==null?void 0:R.title)},p)}),update:(f,p,g)=>(f[g].splice(p,1),f)},filterOptions:{names:h,logic:(f,p)=>p.length?!p.includes(f):!1,display:(f,p,g,y)=>e.jsxs(_e,{style:{width:"380px"},children:[e.jsx(jt,{id:"demo-simple-select-label",style:{background:"#ffffff"},children:"Sender"}),e.jsxs(vt,{multiple:!0,value:f[g],renderValue:R=>e.jsx(C,{display:"flex",gap:1,alignItems:"center",style:{overflow:"hidden",textOverflow:"ellipsis"},children:R.map(w=>{var X;if(w==="system")return e.jsx("span",{children:s("notification.system")},w);const Y=h.find(ae=>{var i;return(ae.did||((i=ae.meta)==null?void 0:i.did))===w});return e.jsx(me,{blocklet:Y,label:(Y==null?void 0:Y.title)||((X=Y==null?void 0:Y.meta)==null?void 0:X.title)},w)})}),onChange:R=>{f[g]=R.target.value,p(f[g],g,y)},children:[e.jsx(Ze,{value:"system",children:s("notification.system")}),h.map(R=>{var Y,X;const w=R.did||((Y=R.meta)==null?void 0:Y.did);return e.jsx(Ze,{value:w,children:e.jsx(me,{blocklet:R,label:R.title||((X=R.meta)==null?void 0:X.title)})},w)})]})]})},customBodyRenderLite:f=>{var y,R;const p=a[f],g=m(p.componentDid);return e.jsxs(C,{display:"flex",alignItems:"center",gap:1,children:[g?e.jsx(rt,{size:32,blocklet:g,ancestors:g.ancestors??[]}):e.jsx(_t,{blocklet:u,size:32}),e.jsx(he,{maxLength:50,children:((y=g==null?void 0:g.meta)==null?void 0:y.title)||((R=u==null?void 0:u.meta)==null?void 0:R.title)})]})}}},{label:s("notification.receiver"),name:"receivers",width:300,options:{filter:!1,customBodyRenderLite:f=>{const p=a[f],{receivers:g}=p;return e.jsx(St,{total:g.length,renderSurplus:y=>y<100?e.jsxs("span",{children:["+",y]}):e.jsx("span",{children:"99+"}),max:3,sx:{justifyContent:"flex-end",height:"32px",".MuiAvatar-root":{width:"32px",height:"32px",fontSize:"12px",border:0,zIndex:2}},onClick:y=>{y.stopPropagation(),L(p),G("receivers")},children:g.map(y=>{const{receiverUser:R}=y,w=ot(R.avatar,I,S);return e.jsx(nt,{alt:R.fullName,src:`${w}?imageFilter=resize&w=48&h=48`,size:32,did:y.receiver,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}},y.receiver)})})}}},{label:s("notification.statistics"),name:"statistics",width:400,options:{filter:!1,customBodyRenderLite:f=>{const p=a[f];return e.jsx(C,{onClick:g=>{g.stopPropagation(),L(p),G("statistics")},children:e.jsx(Ne,{statistics:p.statistics})})}}},{label:s("notification.notificationPreview"),name:"data",options:{filter:!1,customBodyRenderLite:f=>{const p=a[f];return e.jsx(he,{maxLength:50,children:p.title})}}},{label:s("notification.severity"),name:"severity",width:200,options:{setCellProps:()=>({className:"severity-cell"}),customBodyRenderLite:f=>{const p=a[f];return e.jsx(ge,{severity:p.severity})},filter:!0,filterType:"custom",filterList:N.severities??[],customFilterListOptions:{render:f=>e.jsx(Ge,{list:f,label:s("notification.severity"),onDelete:(p,g)=>{p.stopPropagation(),D(p,g,Q[4].options.filterList,"severities")}}),update:je},filterOptions:{names:Qe,fullWidth:!0,logic:ve,display:(f,p,g,y)=>e.jsx(bs,{label:s("notification.severity"),filterList:f,onChange:p,index:g,column:y,filterValues:Qe})}}},{label:s("common.createdAt"),name:"createdAt",width:300,options:{filter:!1,customBodyRenderLite:f=>{const{createdAt:p}=a[f];return e.jsx(Be,{value:p,locale:n,shouldUpdate:!0})}}}],z=f=>{k(p=>({...p,dateRange:f,page:1}))},oe=[...t||[]];return e.jsxs(C,{ref:M,sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:[e.jsx(js,{children:e.jsx(st,{theme:ht(),children:e.jsx(at,{className:"main-table",verticalKeyWidth:100,loading:r,locale:n,columns:Q,data:a,durable:H,onChange:F,options:{sort:!1,download:!1,print:!1,search:!1,expandableRowsOnClick:!0,page:x.page-1,rowsPerPage:x.pageSize,count:x.total,...U,onRowClick:(f,{dataIndex:p})=>{L(a[p])}},customPreButtons:[e.jsx(Ue,{value:N.dateRange,onChange:z})],customButtons:oe,components:{TableFilterList:f=>e.jsx($e,{...f,itemComponent:p=>e.jsx(Ce,{...p,canDelete:g=>{var R;const y=(R=g==null?void 0:g.columnNames)==null?void 0:R[(g==null?void 0:g.index)||0];return(y==null?void 0:y.name)==="sender"}})})}})})}),E&&e.jsx(hs,{refresh:q,onCancel:B,notification:E,blocklet:u,tab:A})]})}const js=ce.div`
|
|
96
|
+
td.MuiTableCell-footer {
|
|
97
|
+
border: none !important;
|
|
98
|
+
}
|
|
99
|
+
.sent-status-cell {
|
|
100
|
+
.resend-btn {
|
|
101
|
+
display: none;
|
|
102
|
+
}
|
|
103
|
+
&:hover {
|
|
104
|
+
.resend-btn {
|
|
105
|
+
display: flex;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.custom-toobar-btns {
|
|
111
|
+
gap: 4px;
|
|
112
|
+
}
|
|
113
|
+
`;bt.propTypes={blocklet:d.object.isRequired,customTableButtons:d.array};bt.defaultProps={customTableButtons:[]};function bt({blocklet:t={},customTableButtons:s}){return e.jsx(Kt,{blocklet:t,children:e.jsx(ys,{customTableButtons:s})})}export{bt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./vendor-react-
|
|
1
|
+
import"./vendor-react-DEoibe3W.js";import{j as L}from"./vendor-mui-core-CfA4EdRA.js";var t=function(e){return L.jsxs("svg",{...e,children:[L.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M50.152 10.6417L31.72 0L13.288 10.6417V24.7942L1 31.8887V53.1722L19.432 63.8139L31.6902 56.7366L31.72 56.7538L31.7498 56.7366L44.008 63.8139L62.44 53.1722V31.8887L50.152 24.7942V10.6417ZM60.52 32.9972L48.232 25.9027V11.7502L31.72 2.21703L15.208 11.7502V25.9028L2.92 32.9972V52.0636L19.432 61.5968L31.6902 54.5196L31.72 54.5368L31.7498 54.5196L44.008 61.5968L60.52 52.0636V32.9972Z",fill:"url(#paint0_linear_615_426)"}),L.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M50.1521 24.8307L31.7201 14.189L13.2881 24.8307V46.1141L31.7201 56.7558L50.1521 46.1141V24.8307ZM15.2081 25.9392L31.7201 16.406L48.2321 25.9392V45.0056L31.7201 54.5388L15.2081 45.0056V25.9392ZM28.5464 23.0464C28.6641 22.6342 29.0408 22.3501 29.4695 22.3501H33.9707C34.3993 22.3501 34.776 22.6342 34.8938 23.0464L35.7504 26.0447L37.8696 27.2681L40.8945 26.5109C41.3103 26.4068 41.7447 26.591 41.959 26.9622L44.2096 30.8604C44.424 31.2316 44.3662 31.6998 44.0682 32.0079L41.8999 34.2489V36.6959L44.0682 38.9369C44.3662 39.245 44.424 39.7133 44.2096 40.0845L41.959 43.9827C41.7447 44.3539 41.3103 44.538 40.8945 44.4339L37.8696 43.6767L35.7504 44.9002L34.8938 47.8984C34.776 48.3106 34.3993 48.5947 33.9707 48.5947H29.4695C29.0408 48.5947 28.6641 48.3106 28.5464 47.8984L27.6897 44.9002L25.5706 43.6767L22.5457 44.4339C22.1299 44.538 21.6955 44.3539 21.4812 43.9827L19.2305 40.0845C19.0162 39.7133 19.0739 39.245 19.372 38.9369L21.5402 36.6959V34.2489L19.372 32.0079C19.0739 31.6998 19.0162 31.2316 19.2305 30.8604L21.4812 26.9622C21.6955 26.591 22.1299 26.4068 22.5457 26.5109L25.5706 27.2681L27.6897 26.0447L28.5464 23.0464ZM28.9861 27.5132C29.2018 27.3887 29.3607 27.1851 29.4292 26.9456L30.1936 24.2701H33.2466L34.011 26.9456C34.0794 27.1851 34.2383 27.3887 34.4541 27.5132L37.2459 29.1251C37.4617 29.2497 37.7174 29.2855 37.9591 29.225L40.6583 28.5493L42.1848 31.1932L40.25 33.193C40.0768 33.372 39.9799 33.6114 39.9799 33.8605V37.0843C39.9799 37.3334 40.0768 37.5728 40.25 37.7518L42.1848 39.7516L40.6583 42.3955L37.9591 41.7198C37.7174 41.6593 37.4617 41.6951 37.2459 41.8197L34.4541 43.4316C34.2383 43.5561 34.0794 43.7597 34.011 43.9992L33.2466 46.6747H30.1936L29.4292 43.9992C29.3607 43.7597 29.2018 43.5561 28.9861 43.4316L26.1942 41.8197C25.9785 41.6951 25.7228 41.6593 25.4811 41.7198L22.7819 42.3955L21.2554 39.7516L23.1902 37.7518C23.3634 37.5728 23.4602 37.3334 23.4602 37.0843V33.8605C23.4602 33.6114 23.3634 33.372 23.1902 33.193L21.2554 31.1932L22.7819 28.5493L25.4811 29.225C25.7228 29.2855 25.9785 29.2497 26.1942 29.1251L28.9861 27.5132ZM31.7201 41.6407C28.3134 41.6407 25.5517 38.8791 25.5517 35.4724C25.5517 32.0657 28.3134 29.3041 31.7201 29.3041C35.1268 29.3041 37.8884 32.0657 37.8884 35.4724C37.8884 38.8791 35.1268 41.6407 31.7201 41.6407ZM35.9684 35.4724C35.9684 37.8187 34.0664 39.7207 31.7201 39.7207C29.3738 39.7207 27.4717 37.8187 27.4717 35.4724C27.4717 33.1261 29.3738 31.2241 31.7201 31.2241C34.0664 31.2241 35.9684 33.1261 35.9684 35.4724Z",fill:"url(#paint1_linear_615_426)"}),L.jsxs("defs",{children:[L.jsxs("linearGradient",{id:"paint0_linear_615_426",x1:"31.72",y1:"95.7208",x2:"95.488",y2:"34.3249",gradientUnits:"userSpaceOnUse",children:[L.jsx("stop",{stopColor:"#0FA4B7"}),L.jsx("stop",{offset:"0.494757",stopColor:"#1DC1C7"}),L.jsx("stop",{offset:"1",stopColor:"#2BE0D7"})]}),L.jsxs("linearGradient",{id:"paint1_linear_615_426",x1:"28.4374",y1:"99.2464",x2:"98.7613",y2:"44.9372",gradientUnits:"userSpaceOnUse",children:[L.jsx("stop",{stopColor:"#0FA4B7"}),L.jsx("stop",{offset:"0.494757",stopColor:"#1DC1C7"}),L.jsx("stop",{offset:"1",stopColor:"#2BE0D7"})]})]})]})};t.defaultProps={width:"64",height:"64",viewBox:"0 0 64 64",fill:"none",xmlns:"http://www.w3.org/2000/svg"};var s=function(e){return L.jsx("svg",{...e,children:L.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.36096 2.3999C7.04725 2.3999 6.76249 2.58326 6.63267 2.86886L0.872671 15.5409C0.825415 15.6448 0.800964 15.7577 0.800964 15.8719V15.9999V27.3919C0.800964 27.8337 1.15914 28.1919 1.60096 28.1919H30.401C30.8428 28.1919 31.201 27.8337 31.201 27.3919V15.8719C31.201 15.7577 31.1765 15.6448 31.1293 15.5409L25.3693 2.86886C25.2394 2.58326 24.9547 2.3999 24.641 2.3999H7.36096ZM2.40096 16.7999V26.5919H29.601V16.7932C29.5669 16.7976 29.5321 16.7999 29.4968 16.7999H22.3993L20.3328 19.8997C20.1845 20.1222 19.9347 20.2559 19.6672 20.2559H11.6032C11.3357 20.2559 11.0859 20.1222 10.9375 19.8997L8.87104 16.7999H2.40096ZM29.2167 15.1999H21.9712C21.7037 15.1999 21.4539 15.3336 21.3056 15.5561L19.239 18.6559H12.0313L9.96483 15.5561C9.81645 15.3336 9.56667 15.1999 9.29919 15.1999H2.78519L7.8761 3.9999H24.1258L29.2167 15.1999Z",fill:"currentColor"})})};s.defaultProps={width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg"};export{s as E,t as S};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as r,T as i}from"./vendor-mui-core-
|
|
1
|
+
import{j as r,T as i}from"./vendor-mui-core-CfA4EdRA.js";import{Z as p,al as x}from"./vendor-utils-BNHJB5U7.js";import{s as c}from"./vendor-ux-did-connect-zBIy2ulO.js";function h({name:t,nameFormatter:a=o=>typeof o=="string"?o.split(" ").map(f=>p(x(f))).join(" "):o,layout:n="horizontal",children:e,valueComponent:l="div",nameWidth:s=90,...m}){return r.jsxs(u,{layout:n,width:s,...m,children:[r.jsx(i,{color:"textSecondary",className:"info-row__name",children:a(t)}),e&&r.jsx(i,{color:"textPrimary",component:l,className:"info-row__value",children:e})]})}const u=c("div")`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: ${t=>t.layout==="vertical"?"column":"row"};
|
|
4
4
|
justify-content: flex-start;
|
|
@@ -33,4 +33,4 @@ import{j as r,T as i}from"./vendor-mui-core-DiDsSLd-.js";import{Z as p,ah as x}f
|
|
|
33
33
|
margin-top: 8px;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
`;export{
|
|
36
|
+
`;export{h as I};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as j}from"./vendor-react-
|
|
1
|
+
import{r as j}from"./vendor-react-DEoibe3W.js";import{u as I,V as $,j as Y,B as N,b2 as pe,al as se,b4 as ue,bt as fe,c0 as xe,a5 as ge}from"./vendor-ux-did-connect-zBIy2ulO.js";import{r as ne}from"./passport-item-C4X2VZeo.js";import{l as R,z as B,aF as ye,C as he,f as je}from"./index-BWx6ivvZ.js";import{u as _}from"./dashboard-C9tAGBV0.js";import{j as e,H as h,ak as W,O as U,bo as oe,br as ae,bn as re,q as ie,a9 as u,aa as q,bs as be,bS as Ce,ag as z,T as P,ac as J,aj as ke}from"./vendor-mui-core-CfA4EdRA.js";import{K as Ae,Y as ve}from"./vendor-arcblock-CWji6U03.js";import{T as ce}from"./index-BT3gX_Gs.js";import{C as le}from"./confirm-miQS3Z1c.js";import{_ as Se}from"./vendor-utils-BNHJB5U7.js";import{C as X}from"./click-to-copy-CbKZyfyr.js";import{D as Ke}from"./delete-confirm-kKb8VxbQ.js";import{d as Te}from"./Edit-C-ChSGAK.js";import{P as we}from"./permission-CbDCh9eS.js";import{m as De,G as Ie}from"./vendor-hooks-DftG_2gV.js";import{U as Re,C as Be,I as _e}from"./index-Ds7z-vG7.js";import{B as Ne}from"./bundle-avatar-DFwyxj9P.js";import{p as ze}from"./util-CJbxj6IE.js";import{W as Z}from"./did-address-DNf_-NM-.js";import{f as Pe}from"./format-error-BrmqJs5a.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-BJb7uGDO.js";import"./PlayArrow-rSzT1Thf.js";import"./get-safe-url-MZ-ksvtD.js";import"./session-CdQbSkeB.js";import"./index-Hl4sXXdc.js";import"./InfoOutlined-ZIQMeu0p.js";import"./dot-xwsgXXMo.js";import"./useAsync-BquSRC77.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-CcdVxg80.js";import"./vendor-mui-x-DSNWmGVo.js";import"./AdapterDayjs-DcprbhsV.js";import"./shorten-label-Dz7RgJfj.js";import"./Phone-oJLFEdfI.js";import"./Location-BF9BwrVf.js";import"./Email-7cDhevM1.js";import"./Timezone-BtCtoEo9.js";import"./base32--dljmFCF.js";function F({value:s}){const{t:n,locale:x}=I(),b=new Date;return new Date(s)<b?e.jsxs("span",{style:{color:"red"},children:[e.jsx($,{value:s,locale:x}),`${n("setting.accessKey.expired",{time:""})}`]}):R(s,x)}F.propTypes={value:h.string.isRequired};const L=()=>{const s=Y.RBAC_CONFIG.roles.filter(m=>m.passport),{inService:n}=B(),{roles:x}=_(),b=[...s,...n?x:[]];return Se(b,"name").filter(m=>m.name!==Y.ROLES.OWNER)};function E(s){const{remark:n,onCreate:x}=s,{api:b}=B(),{teamDid:m}=_(),{t:i}=I(),[k,c]=j.useState(!1),[o,p]=j.useState(null),A=L(),d=()=>{c(!1),p(null)},K=async l=>{const{remark:f,passport:r}=l;c(!0);const t=await b.createAccessKey({input:{teamDid:m,remark:f.trim(),passport:r,expireAt:l.expireAt?new Date(l.expireAt).getTime():null}}),{data:C}=t;x(C),p(null),c(!1)},g={title:`${i("common.create")} ${i("accessKey")}`,description:(l,f,r)=>e.jsxs(W,{gap:3,children:[e.jsx(U,{label:i("setting.accessKey.tip"),autoComplete:"off",variant:"outlined",name:"remark",inputProps:{"data-cy":"remark-input"},fullWidth:!0,autoFocus:!0,margin:"dense",value:l.remark,onChange:t=>{f({...l,remark:t.target.value,__disableConfirm:!l.passport||!t.target.value.trim()}),t.target.value.trim()?r(""):r(i("setting.accessKey.remarkInvalid"))}}),e.jsxs(oe,{style:{width:"100%"},variant:"outlined",children:[e.jsx(ae,{children:i("setting.accessKey.passport")}),e.jsx(re,{"data-cy":"create-access-key-select-passport",value:l.passport,onChange:t=>{const C=t.target.value;r(null),f({...l,passport:C,__disableConfirm:!l.remark||!C})},fullWidth:!0,label:i("setting.accessKey.passport"),disabled:k,children:A.map(t=>e.jsx(ie,{value:t.name,"data-cy":`create-access-key-passport-option-${t.name}`,children:e.jsxs(u,{children:[e.jsx("span",{children:t.title||t.name}),e.jsx(u,{maxWidth:440,fontSize:12,color:"#999",whiteSpace:"normal",textAlign:"justify",children:t.description})]})},t.name))})]}),e.jsx(ce,{placeholder:i("setting.accessKey.expireTime"),value:l.expireAt,onChange:t=>{f({...l,expireAt:t,__disableConfirm:!l.passport||!l.remark||!t})}})]}),confirm:i("common.confirm"),cancel:i("common.cancel"),color:"primary",params:{remark:n,__disableConfirm:!n.trim()},onConfirm:K,onCancel:d};return e.jsxs(e.Fragment,{children:[e.jsxs(N,{edge:"end",variant:"contained",color:"primary","data-cy":"add-access-key-btn",onClick:()=>p(g),className:"rule-action",children:[k?e.jsx(q,{size:16}):e.jsx(Ae,{style:{fontSize:16}}),i("common.create")]}),o&&e.jsx(le,{title:o.title,description:o.description,confirm:o.confirm,color:o.color,cancel:o.cancel,params:o.params,onConfirm:o.onConfirm,onCancel:o.onCancel})]})}E.propTypes={remark:h.string,onCreate:h.func};E.defaultProps={onCreate:()=>{},remark:""};function M(s){const{onConfirm:n,accessKeyId:x,accessKeySecret:b}=s,{t:m}=j.useContext(pe),[i,k]=j.useState(!1),[c,o]=j.useState(!0),p=()=>{o(!c)},A=d=>{k(d.target.checked)};return e.jsxs(se,{title:m("common.createSuccess"),fullWidth:!0,open:!0,disableEscapeKeyDown:!0,onClose:n,showCloseButton:!1,actions:e.jsx("div",{children:e.jsx(N,{disabled:!i,onClick:n,color:"primary",autoFocus:!0,variant:"contained","data-cy":"submit-confirm-dialog",children:m("common.confirm")})}),"aria-labelledby":"simple-dialog-title",children:[e.jsx("div",{children:e.jsx(Le,{children:m("setting.accessKey.saveSecretTip")})}),e.jsx("div",{style:{marginTop:"20px"}}),e.jsxs(te,{children:[e.jsx(ee,{children:"Access Key"}),e.jsx(X,{children:x})]}),e.jsxs(te,{children:[e.jsx(ee,{children:"Access Secret"}),c?e.jsx(N,{"data-cy":"show-secret-btn",color:"primary",onClick:p,children:m("setting.accessKey.showSecret")}):e.jsx(X,{children:b})]}),e.jsx("div",{children:e.jsx(be,{value:"end",disabled:c,control:e.jsx(Ce,{checked:i,onChange:A}),label:m("setting.accessKey.iKnow"),labelPlacement:"end"})})]})}M.propTypes={accessKeyId:h.string.isRequired,accessKeySecret:h.string.isRequired,onConfirm:h.func};M.defaultProps={onConfirm:()=>{}};const ee=z.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
justify-content: space-between;
|
|
4
4
|
align-items: center;
|
|
@@ -9,14 +9,14 @@ import{r as j}from"./vendor-react-DoD83n6N.js";import{u as I,V as $,p as J,B as
|
|
|
9
9
|
`,Le=z.div`
|
|
10
10
|
font-size: 16px;
|
|
11
11
|
font-weight: bold;
|
|
12
|
-
`;function O(s){const{t:n,locale:x}=I(),{api:
|
|
12
|
+
`;function O(s){const{t:n,locale:x}=I(),{api:b}=B(),{teamDid:m}=_(),[i,k]=j.useState(!1),[c,o]=j.useState(null),{accessKeyId:p,time:A,remark:d,onDelete:K=()=>{}}=s,g=()=>{k(!1),o(null)},l=async()=>{k(!0);try{await b.deleteAccessKey({input:{teamDid:m,accessKeyId:p}}),K()}catch(t){console.error(t)}finally{k(!1),o(null)}},f=t=>({key:`<b>${p}</b>`,name:`<b>${d}</b>`,time:R(t,x),timeAge:ve(new Date(t),ye(x))}),r={keyName:d,title:n("setting.accessKey.title"),description:A?`${n("setting.accessKey.description",f(A))}`:`${n("setting.accessKey.descriptionNoTime",{key:`<b>${p}</b>`,name:`<b>${d}</b>`})}`,confirmPlaceholder:n("setting.accessKey.confirm_desc",{name:d}),confirm:n("common.delConfirm"),cancel:n("common.cancel"),onConfirm:l,onCancel:g};return e.jsxs(e.Fragment,{children:[e.jsxs(N,{edge:"end",onClick:t=>{t.stopPropagation(),o(r)},size:"small",className:"rule-action",color:"error",children:[i?e.jsx(q,{size:16}):e.jsx(ue,{style:{fontSize:16}}),n("common.delete")]}),c&&e.jsx(Ke,{keyName:c.keyName,title:c.title,description:c.description,confirmPlaceholder:c.confirmPlaceholder,confirm:c.confirm,cancel:c.cancel,params:c.params,onConfirm:c.onConfirm,onCancel:c.onCancel})]})}O.propTypes={accessKeyId:h.string.isRequired,time:h.string.isRequired,remark:h.string.isRequired,onDelete:h.func};O.defaultProps={onDelete:()=>{}};function V(s){const{accessKeyId:n,remark:x,onUpdate:b,passport:m,expireAt:i}=s,{api:k}=B(),{teamDid:c}=_(),{t:o}=I(),[p,A]=j.useState(!1),[d,K]=j.useState(null),g=L(),l=()=>{A(!1),K(null)},f=async t=>{const{accessKeyId:C,remark:D="",passport:y,expireAt:w}=t;A(!0),await k.updateAccessKey({input:{teamDid:c,accessKeyId:C,remark:D.trim(),passport:y,expireAt:w?new Date(w).getTime():null}}),b(),K(null),A(!1)},r={title:`${o("common.update")} ${o("accessKey")}`,description:(t,C,D)=>e.jsxs(W,{gap:3,children:[e.jsx(U,{label:o("setting.accessKey.accessKeyId"),autoComplete:"off",variant:"outlined",name:"accessKeyId",fullWidth:!0,autoFocus:!0,margin:"dense",value:t.accessKeyId,disabled:!0}),e.jsx(U,{label:o("common.remark"),autoComplete:"off",variant:"outlined",name:"remark",fullWidth:!0,autoFocus:!0,value:t.remark,onChange:y=>{C({...t,remark:y.target.value,__disableConfirm:!y.target.value.trim()}),y.target.value.trim()?D(""):D(o("setting.accessKey.remarkInvalid"))}}),e.jsxs(oe,{style:{width:"100%"},variant:"outlined",children:[e.jsx(ae,{children:o("setting.accessKey.passport")}),e.jsx(re,{"data-cy":"update-access-key-select-passport",value:t.passport,onChange:y=>{const w=y.target.value;D(null),C({...t,passport:w,__disableConfirm:!t.remark||!w})},fullWidth:!0,label:o("setting.accessKey.passport"),disabled:p,children:g.map(y=>e.jsx(ie,{value:y.name,"data-cy":`update-access-key-passport-option-${y.name}`,children:e.jsxs(u,{children:[e.jsx("span",{children:y.title||y.name}),e.jsx(u,{maxWidth:440,fontSize:12,color:"#999",whiteSpace:"normal",textAlign:"justify",children:y.description})]})},y.name))})]}),e.jsx(ce,{placeholder:o("setting.accessKey.expireTime"),value:t.expireAt,onChange:y=>{C({...t,expireAt:y,__disableConfirm:!t.passport||!t.remark||!y})}})]}),confirm:o("common.confirm"),cancel:o("common.cancel"),color:"primary",params:{accessKeyId:n,remark:x,passport:m,expireAt:i},onConfirm:f,onCancel:l};return e.jsxs(e.Fragment,{children:[e.jsxs(N,{edge:"end",onClick:t=>{t.stopPropagation(),K(r)},size:"small",className:"rule-action",color:"primary",children:[p?e.jsx(q,{size:16}):e.jsx(Te,{style:{fontSize:16}}),o("common.update")]}),d&&e.jsx(le,{title:d.title,description:d.description,confirm:d.confirm,color:d.color,cancel:d.cancel,params:d.params,onConfirm:d.onConfirm,onCancel:d.onCancel})]})}V.propTypes={accessKeyId:h.string.isRequired,remark:h.string,passport:h.string,expireAt:h.string,onUpdate:h.func};V.defaultProps={onUpdate:()=>{},remark:"",passport:"",expireAt:""};function G({accessKey:s,onCancel:n}){const{t:x}=I();return e.jsx(se,{title:x("accessKey"),onClose:n,open:!0,PaperProps:{style:{maxWidth:800}},fullWidth:!0,children:e.jsx($e,{children:e.jsx(me,{accessKey:s})})})}G.propTypes={accessKey:h.object.isRequired,onCancel:h.func.isRequired};G.defaultProps={};const $e=z(u)`
|
|
13
13
|
margin-top: -16px;
|
|
14
14
|
|
|
15
15
|
.tabs {
|
|
16
16
|
margin-left: 0;
|
|
17
17
|
margin-right: 0;
|
|
18
18
|
}
|
|
19
|
-
`;function me({accessKey:s}){var l,f;const{t:n,locale:x}=I(),{api:
|
|
19
|
+
`;function me({accessKey:s}){var l,f;const{t:n,locale:x}=I(),{api:b}=B(),{teamDid:m}=_(),{blocklet:i}=he(),k=L(),c=j.useCallback(async r=>r?(await b.getUser({input:{teamDid:m,user:{did:r}}})).user:null,[b,m]),o=De(()=>c(s.createdBy),{}),p=((i==null?void 0:i.children)||[]).find(r=>{var t;return((t=r==null?void 0:r.meta)==null?void 0:t.did)===s.componentDid}),A=j.useMemo(()=>{var r;return ze((r=o==null?void 0:o.data)==null?void 0:r.avatar,m,!0)},[(l=o==null?void 0:o.data)==null?void 0:l.avatar,m]),d=k.find(r=>r.name===s.passport),K=d?d.title:s.passport,g=[{title:n("common.baseInfo"),items:[{label:n("setting.accessKey.accessKeyId"),content:e.jsx(Z,{did:s.accessKeyId,showQrcode:!0})},{label:n("common.role"),content:e.jsx(u,{children:ne(K,s.passport)})},{label:n("common.createdVia"),content:s.createdVia},{label:n("common.createdBy"),content:o!=null&&o.data?e.jsx(u,{sx:{display:"flex",alignItems:"center",".MuiAvatar-root":{width:32,height:32}},children:e.jsx(Re,{user:{...o.data,avatar:A},showDid:!0,cardType:Be.Detailed,infoType:_e.Minimal,sx:{border:0,padding:0}})}):s.createdBy?e.jsx(Z,{did:s.createdBy,showQrcode:!0}):"-"}]},{title:n("common.timeInfo"),items:[{label:n("common.createdAt"),content:s.createdAt?R(s.createdAt,x):"-"},{label:n("common.lastUsedAt"),content:s.lastUsedAt?R(s.lastUsedAt,x):"-"},{label:n("common.expiredAt"),content:s.expireAt?e.jsx(F,{value:s.expireAt}):n("common.neverExpired")}]},{title:n("common.otherInfo"),items:[{label:n("setting.accessKey.authType"),content:s.authType},{label:n("common.remark"),content:s.remark},...s.authType!=="signature"?[{label:n("setting.accessKey.resourceType"),content:s.resourceType},{label:n("setting.accessKey.resourceId"),content:s.resourceId}]:[],...p?[{label:n("setting.accessKey.component"),content:e.jsxs(u,{width:{xs:250,sm:400},display:"flex",alignItems:"center",children:[e.jsx(Ne,{blocklet:p,ancestors:[i]}),e.jsx(u,{ml:"16px",sx:{minWidth:0},children:e.jsxs(u,{className:"component-header",children:[e.jsx(u,{className:"component-name",children:je.getDisplayName(p,!0)}),e.jsx(u,{className:"component-version",children:(f=p==null?void 0:p.meta)==null?void 0:f.version})]})})]},p)}]:[]]}];return e.jsx(Ue,{gap:3,children:e.jsx(u,{className:"info-area",children:g.map(r=>e.jsxs(u,{mb:3,children:[e.jsx(P,{variant:"h6",sx:{mb:1.5},children:r.title}),e.jsx(u,{className:"info-grid",children:r.items.map(t=>e.jsxs(u,{className:"info-item",children:[e.jsx(u,{className:"info-label",children:e.jsx(P,{variant:"subtitle2",color:"textSecondary",children:t.label})}),e.jsx(u,{children:t.content})]},t.label))})]},r.title))})})}me.propTypes={accessKey:h.object.isRequired};const Ue=z(W)`
|
|
20
20
|
.info-card {
|
|
21
21
|
margin-bottom: 24px;
|
|
22
22
|
overflow: hidden;
|
|
@@ -89,4 +89,4 @@ import{r as j}from"./vendor-react-DoD83n6N.js";import{u as I,V as $,p as J,B as
|
|
|
89
89
|
margin: 0;
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
`;function
|
|
92
|
+
`;function St(){var H,Q;const{t:s,locale:n}=I(),{api:x,inService:b}=B(),{teamDid:m}=_(),[i,k]=j.useState({}),[c,o]=j.useState(null),p=L(),A=j.useRef(null),d=`access-keys-${m}`,K=fe(d),[g,l]=j.useState({searchText:K.searchText||"",pageSize:K.rowsPerPage||10,page:1}),f=Ie(async()=>await x.getAccessKeys({input:{teamDid:m,paging:{page:g.page,pageSize:g.pageSize}}}),[g.page,g.pageSize]),{loading:r,error:t}=f,C=j.useMemo(()=>{var a;return((a=f.value)==null?void 0:a.list)||[]},[(H=f.value)==null?void 0:H.list]),D=j.useMemo(()=>[{label:s("common.name"),name:"remark",options:{customBodyRender:(a,{rowIndex:S})=>{const v=C[S];return e.jsx(u,{display:"flex",alignItems:"center",gap:2,children:e.jsx(P,{children:v.remark||"N/A"})})}}},{label:"Access Key ID",name:"accessKeyId",options:{customBodyRender:a=>e.jsx(xe,{showDidLogo:!1,children:a})}},{label:s("common.role"),name:"passport",options:{customBodyRender:a=>{const S=p.find(T=>T.name===a),v=S?S.title:a;return e.jsx(u,{children:ne(v,a)})}}},{label:s("common.createdVia"),name:"createdVia",options:{customBodyRender:a=>e.jsx(P,{children:a})}},{label:s("common.createdAt"),name:"createdAt",options:{customBodyRender:a=>e.jsx(J,{title:R(a,n),children:a?e.jsx($,{value:a,locale:n}):"-"})}},{label:s("common.lastUsedAt"),name:"lastUsedAt",options:{customBodyRender:a=>e.jsx(J,{title:R(a,n),children:a?e.jsx($,{value:a,locale:n}):"-"})}},{label:s("common.expiredAt"),name:"expireAt",options:{customBodyRender:a=>a?e.jsx(F,{value:a}):s("common.neverExpired")}},{label:s("common.actions"),name:"actions",width:100,options:{customBodyRender:(a,{rowIndex:S})=>{const v=C[S];return e.jsxs(u,{display:"flex",gap:1,children:[e.jsx(V,{...v,onUpdate:f.retry}),e.jsx(O,{accessKeyId:v.accessKeyId,time:v.lastUsedAt,remark:v.remark||"N/A",onDelete:f.retry})]})}}}],[C,n,s,f.retry,p]),y=({page:a,rowsPerPage:S,searchText:v})=>{g.pageSize!==S?l(T=>({...T,searchText:"",pageSize:S,page:1})):g.page!==a+1?l(T=>({...T,searchText:"",page:a+1})):g.searchText!==v&&l(T=>({...T,searchText:v,page:1}))},w=g.searchText?C.filter(a=>a.accessKeyId.toLowerCase().includes(g.searchText.toLowerCase())||(a.remark||"").toLowerCase().includes(g.searchText.toLowerCase())):C;return t?e.jsx(ke,{severity:"error",children:Pe(t)}):e.jsxs(u,{ref:A,sx:{".custom-toobar-btns":{gap:"8px"}},children:[e.jsx(ge,{durable:d,durableKeys:["page","rowsPerPage"],data:w,columns:D,options:{sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,page:g.page-1,rowsPerPage:g.pageSize,count:((Q=f.value)==null?void 0:Q.count)||0,searchDebounceTime:600,onRowClick(a,{dataIndex:S},v){var T;if((T=A.current)!=null&&T.contains(v.target)){const de=w[S];o(de)}}},loading:r,onChange:y,customButtons:[e.jsx(we,{permission:b?"":"mutate_accessKey",children:e.jsx(E,{onCreate:a=>{const{accessKeyId:S,accessKeySecret:v}=a;k({show:!0,accessKeyId:S,accessKeySecret:v})}})})]}),i.show&&e.jsx(M,{onConfirm:()=>{f.retry(),k({show:!1})},...i}),c&&e.jsx(G,{onCancel:()=>o(null),accessKey:c})]})}export{St as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as t,
|
|
1
|
+
import{j as t,aa as h,a9 as c,H as d,ag as g}from"./vendor-mui-core-CfA4EdRA.js";import{r as y}from"./vendor-react-DEoibe3W.js";import{b2 as v,C as w,B as m}from"./vendor-ux-did-connect-zBIy2ulO.js";import{P}from"./page-header-C86YQnHE.js";import{C as T}from"./index-BWx6ivvZ.js";import{u as B}from"./config-space-DEku2tJv.js";import{C as E,D as b,a as D}from"./connect-to-C-vFK0ym.js";import{S as u}from"./step-actions-Cmh5n2jE.js";import{S as N}from"./layout-DBsOgAhr.js";import"./vendor-utils-BNHJB5U7.js";import"./vendor-hooks-DftG_2gV.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-CWji6U03.js";import"./spaces-CcTi9vap.js";import"./api-BrU7j0QA.js";import"./DeleteOutline-CMgoFNHT.js";import"./format-error-BrmqJs5a.js";import"./use-mobile-CcdVxg80.js";import"./content-layout-JixQ7owc.js";function l({onNext:a,onPrevious:x}){var n,r,p;const{t:i}=y.useContext(v),{blocklet:e}=T(),{spaceGateway:f,settingStorageEndpoint:C,updateSpaceGateway:j,hasStorageEndpoint:S,loading:o,storageEndpoint:s}=B();return o?t.jsx(w,{relative:"parent",children:t.jsx(h,{})}):t.jsxs(G,{children:[t.jsx("div",{className:"header",children:t.jsx(P,{title:i("setup.didSpace.title"),subTitle:i("setup.didSpace.subTitle"),onClickBack:x})}),t.jsx(c,{sx:{width:"100%",maxWidth:"720px"},children:S?t.jsx(E,{spaceGateway:f,settingStorageEndpoint:C}):t.jsx(b,{})}),((n=e==null?void 0:e.capabilities)==null?void 0:n.didSpace)&&t.jsx(c,{display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"24px",children:t.jsx(D,{onConnect:j,storageEndpoint:s})}),((r=e==null?void 0:e.capabilities)==null?void 0:r.didSpace)==="required"&&t.jsx(u,{mt:8,children:t.jsx(m,{loading:o,variant:"contained",disabled:o||!s,onClick:()=>a(),children:i("setup.continue")})}),((p=e==null?void 0:e.capabilities)==null?void 0:p.didSpace)==="optional"&&t.jsx(u,{blocklet:e,onStartNow:()=>a("complete"),children:t.jsx(m,{className:"start-now",loading:o,variant:"contained",disabled:o,onClick:()=>a(),children:i(s?"setup.continue":"setup.skip")})})]})}l.propTypes={onNext:d.func,onPrevious:d.func};l.defaultProps={onNext:()=>{},onPrevious:()=>{}};const G=g(N)`
|
|
2
2
|
height: 100%;
|
|
3
3
|
overflow-y: auto;
|
|
4
4
|
`;export{l as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as j,e as O}from"./vendor-react-
|
|
1
|
+
import{g as j,e as O}from"./vendor-react-DEoibe3W.js";function J(i,t){for(var r=0;r<t.length;r++){const a=t[r];if(typeof a!="string"&&!Array.isArray(a)){for(const e in a)if(e!=="default"&&!(e in i)){const s=Object.getOwnPropertyDescriptor(a,e);s&&Object.defineProperty(i,e,s.get?s:{enumerable:!0,get:()=>a[e]})}}}return Object.freeze(Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}))}var d={default:O,call:function(i,t,r){var a="";typeof t=="function"&&(r=t,t={});var e={data:t===void 0?null:t};if(typeof r=="function"){var s="dscb"+window.dscb++;window[s]=r,e._dscbstub=s}return e=JSON.stringify(e),window._dsbridge?a=_dsbridge.call(i,e):(window._dswk||navigator.userAgent.indexOf("_dsbridge")!=-1)&&(a=prompt("_dsbridge="+i,e)),JSON.parse(a||"{}").data},register:function(i,t,r){var a=r?window._dsaf:window._dsf;window._dsInit||(window._dsInit=!0,setTimeout(function(){d.call("_dsb.dsinit")},0)),typeof t=="object"?a._obs[i]=t:a[i]=t},registerAsyn:function(i,t){this.register(i,t,!0)},hasNativeMethod:function(i,t){return this.call("_dsb.hasNativeMethod",{name:i,type:t||"all"})},disableJavascriptDialogBlock:function(i){this.call("_dsb.disableJavascriptDialogBlock",{disable:i!==!1})}};(function(){if(!window._dsf){var i={_dsf:{_obs:{}},_dsaf:{_obs:{}},dscb:0,dsBridge:d,close:function(){d.call("_dsb.closePage")},_handleMessageFromNative:function(r){var a=JSON.parse(r.data),e={id:r.callbackId,complete:!0},s=this._dsf[r.method],o=this._dsaf[r.method],p=function(u,_){e.data=u.apply(_,a),d.call("_dsb.returnValue",e)},v=function(u,_){a.push(function(w,y){e.data=w,e.complete=y!==!1,d.call("_dsb.returnValue",e)}),u.apply(_,a)};if(s)p(s,this._dsf);else if(o)v(o,this._dsaf);else{var l=r.method.split(".");if(l.length<2)return;var g=l.pop(),b=l.join("."),c=this._dsf._obs,f=c[b]||{},n=f[g];if(n&&typeof n=="function"){p(n,f);return}if(c=this._dsaf._obs,f=c[b]||{},n=f[g],n&&typeof n=="function"){v(n,f);return}}}};for(var t in i)window[t]=i[t];d.register("_hasJavascriptMethod",function(r,a){var e=r.split(".");if(e.length<2)return!!(_dsf[e]||_dsaf[e]);var r=e.pop(),s=e.join("."),o=_dsf._obs[s]||_dsaf._obs[s];return o&&!!o[r]})}})();var h=d;const N=j(h),k=J({__proto__:null,default:N},[h]);export{k as i};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{B as tT,D as qm,E as Km,F as jm}from"./vendor-hooks-
|
|
1
|
+
import{B as tT,D as qm,E as Km,F as jm}from"./vendor-hooks-DftG_2gV.js";import{B as Jm}from"./vendor-utils-BNHJB5U7.js";import{g as s2,b as l2,r as u2}from"./vendor-react-DEoibe3W.js";/*! *****************************************************************************
|
|
2
2
|
Copyright (c) Microsoft Corporation.
|
|
3
3
|
|
|
4
4
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import{u as ne,Y as U,bZ as Ee,b_ as Ue,i as le,I as K,bX as We,bY as Me,ab as _e,ac as $e,aa as Ve,b$ as Ne,b4 as De,j as he,r as He,b2 as X,c0 as xe,al as je,B as z,bM as Je,a4 as Ke,c1 as Ze,a5 as Ge,a1 as Ye,_ as Xe,ar as Ce}from"./vendor-ux-did-connect-zBIy2ulO.js";import{u as p,a as se,f as te,c as Qe}from"./vendor-hooks-DftG_2gV.js";import{r as R}from"./vendor-react-DEoibe3W.js";import{j as e,a9 as m,bs as W,bo as E,O,y as $,H as N,T as fe,I as ae,X as re,ag as Re,ak as J,cD as et,a8 as tt,e as be,aa as ge,a5 as Ae,ac as nt}from"./vendor-mui-core-CfA4EdRA.js";import{I as Y,a6 as st,b as qe,C as ot,n as G,aH as at,y as rt,z as it}from"./vendor-utils-BNHJB5U7.js";import{z as H,C as V,E as oe,F as I,aD as Fe}from"./index-BWx6ivvZ.js";import{S as ie}from"./switch-control-BjOmRKBW.js";import{S as D}from"./dashboard-C9tAGBV0.js";import{K as lt}from"./keyboard-arrow-down-rounded-DadBVmpO.js";import{K as Pe,Q as ct,c as dt}from"./vendor-arcblock-CWji6U03.js";import{I as ut}from"./index-C7UL-KG1.js";import{b as mt}from"./base32--dljmFCF.js";import{u as pt}from"./use-mobile-Bgy7gTTP.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-BJb7uGDO.js";import"./confirm-miQS3Z1c.js";import"./format-error-BrmqJs5a.js";import"./PlayArrow-rSzT1Thf.js";import"./get-safe-url-MZ-ksvtD.js";import"./session-CdQbSkeB.js";import"./index-Hl4sXXdc.js";import"./InfoOutlined-ZIQMeu0p.js";import"./dot-xwsgXXMo.js";import"./useAsync-BquSRC77.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-CcdVxg80.js";const ce={enabled:!1,domain:"",clientId:"",clientSecret:""};function ht(){var b,y,i;const{api:S}=H(),{blocklet:r}=V(),{t:n}=ne(),s=(b=r==null?void 0:r.meta)==null?void 0:b.did,w=Object.assign({...ce},((i=(y=r==null?void 0:r.settings)==null?void 0:y.oauth)==null?void 0:i.auth0)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=oe({defaultValues:Y(w,Object.keys(ce))}),d=h("enabled"),k=p(async a=>{var T,o;try{const{blocklet:j}=await S.configOAuth({input:{did:s,oauth:JSON.stringify({auth0:a})}}),u=Object.assign({...ce},((o=(T=j==null?void 0:j.settings)==null?void 0:T.oauth)==null?void 0:o.auth0)||{});l(u),U.success(n("oauth.saveSuccess"))}catch(j){U.error(j.message||n("oauth.saveFailed"))}}),L=p(a=>a!=null&&a.trim()?!0:n("oauth.auth0.domainDescription")),x=p(a=>a!=null&&a.trim()?!0:n("oauth.auth0.clientIdDescription")),g=p(a=>a!=null&&a.trim()?!0:n("oauth.auth0.clientSecretDescription")),v=p(()=>!0);return e.jsx(m,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.auth0.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:a})=>e.jsx(W,{control:e.jsx(ie,{sx:{ml:1},checked:a.value,...a})})})}),e.jsx(D,{title:n("oauth.auth0.domain"),children:e.jsx(I,{name:"domain",control:f,rules:{validate:d?L:v},render:({field:a})=>{var T;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.auth0.domain"),error:!!c.errors[a.name],helperText:((T=c.errors[a.name])==null?void 0:T.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.auth0.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?x:v},render:({field:a})=>{var T;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.auth0.clientId"),error:!!c.errors[a.name],helperText:((T=c.errors[a.name])==null?void 0:T.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.auth0.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?g:v},render:({field:a})=>{var T;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",type:"password",label:n("oauth.auth0.clientSecret"),error:!!c.errors[a.name],helperText:((T=c.errors[a.name])==null?void 0:T.message)||" ",disabled:!d})})}})}),e.jsx($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const de={enabled:!1,clientId:"",clientSecret:""};function xt(){var v,b,y;const{api:S}=H(),{blocklet:r}=V(),{t:n}=ne(),s=(v=r==null?void 0:r.meta)==null?void 0:v.did,w=Object.assign({...de},((y=(b=r==null?void 0:r.settings)==null?void 0:b.oauth)==null?void 0:y.github)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=oe({defaultValues:Y(w,Object.keys(de))}),d=h("enabled"),k=p(async i=>{var a,T;try{const{blocklet:o}=await S.configOAuth({input:{did:s,oauth:JSON.stringify({github:i})}}),j=Object.assign({...de},((T=(a=o==null?void 0:o.settings)==null?void 0:a.oauth)==null?void 0:T.github)||{});l(j),U.success(n("oauth.saveSuccess"))}catch(o){U.error(o.message||n("oauth.saveFailed"))}}),L=p(i=>i!=null&&i.trim()?!0:n("oauth.github.clientIdDescription")),x=p(i=>i!=null&&i.trim()?!0:n("oauth.github.clientSecretDescription")),g=p(()=>!0);return e.jsx(m,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.github.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:i})=>e.jsx(W,{control:e.jsx(ie,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(D,{title:n("oauth.github.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?L:g},render:({field:i})=>{var a;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.github.clientId"),error:!!c.errors[i.name],helperText:((a=c.errors[i.name])==null?void 0:a.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.github.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?x:g},render:({field:i})=>{var a;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",type:"password",label:n("oauth.github.clientSecret"),error:!!c.errors[i.name],helperText:((a=c.errors[i.name])==null?void 0:a.message)||" ",disabled:!d})})}})}),e.jsx($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const ue={enabled:!1,clientId:"",clientSecret:""};function ft(){var v,b,y;const{api:S}=H(),{blocklet:r}=V(),{t:n}=ne(),s=(v=r==null?void 0:r.meta)==null?void 0:v.did,w=Object.assign({...ue},((y=(b=r==null?void 0:r.settings)==null?void 0:b.oauth)==null?void 0:y.google)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=oe({defaultValues:Y(w,Object.keys(ue))}),d=h("enabled"),k=p(async i=>{var a,T;try{const{blocklet:o}=await S.configOAuth({input:{did:s,oauth:JSON.stringify({google:i})}}),j=Object.assign({...ue},((T=(a=o==null?void 0:o.settings)==null?void 0:a.oauth)==null?void 0:T.google)||{});l(j),U.success(n("oauth.saveSuccess"))}catch(o){U.error(o.message||n("oauth.saveFailed"))}}),L=p(i=>i!=null&&i.trim()?!0:n("oauth.google.clientIdDescription")),x=p(i=>i!=null&&i.trim()?!0:n("oauth.google.clientSecretDescription")),g=p(()=>!0);return e.jsx(m,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.google.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:i})=>e.jsx(W,{control:e.jsx(ie,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(D,{title:n("oauth.google.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?L:g},render:({field:i})=>{var a;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.google.clientId"),error:!!c.errors[i.name],helperText:((a=c.errors[i.name])==null?void 0:a.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.google.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?x:g},render:({field:i})=>{var a;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",type:"password",label:n("oauth.google.clientSecret"),error:!!c.errors[i.name],helperText:((a=c.errors[i.name])==null?void 0:a.message)||" ",disabled:!d})})}})}),e.jsx($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const me={enabled:!1,teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function gt(){var i,a,T;const{api:S}=H(),{blocklet:r}=V(),{t:n}=ne(),s=(i=r==null?void 0:r.meta)==null?void 0:i.did,w=Object.assign({...me},((T=(a=r==null?void 0:r.settings)==null?void 0:a.oauth)==null?void 0:T.apple)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=oe({defaultValues:Y(w,Object.keys(me))}),d=h("enabled"),k=p(async o=>{var j,u;try{const{blocklet:P}=await S.configOAuth({input:{did:s,oauth:JSON.stringify({apple:o})}}),A=Object.assign({...me},((u=(j=P==null?void 0:P.settings)==null?void 0:j.oauth)==null?void 0:u.apple)||{});l(A),U.success(n("oauth.saveSuccess"))}catch(P){U.error(P.message||n("oauth.saveFailed"))}}),L=p(o=>o!=null&&o.trim()?!0:n("oauth.apple.teamIdDescription")),x=p(o=>o!=null&&o.trim()?!0:n("oauth.apple.serviceIdDescription")),g=p(o=>o!=null&&o.trim()?!0:n("oauth.apple.keyIdDescription")),v=p(o=>o!=null&&o.trim()?!0:n("oauth.apple.authKeyDescription")),b=p(o=>o!=null&&o.trim()?!0:n("oauth.apple.bundleIdDescription")),y=p(()=>!0);return e.jsx(m,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(D,{title:n("oauth.apple.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:o})=>e.jsx(W,{control:e.jsx(ie,{sx:{ml:1},checked:o.value,...o})})})}),e.jsx(D,{title:n("oauth.apple.teamId"),children:e.jsx(I,{name:"teamId",control:f,rules:{validate:d?L:y},render:({field:o})=>{var j;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...o,size:"small",label:n("oauth.apple.teamId"),error:!!c.errors[o.name],helperText:((j=c.errors[o.name])==null?void 0:j.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.bundleId"),children:e.jsx(I,{name:"bundleId",control:f,rules:{validate:d?b:y},render:({field:o})=>{var j;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...o,size:"small",label:n("oauth.apple.bundleId"),error:!!c.errors[o.name],helperText:((j=c.errors[o.name])==null?void 0:j.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.serviceId"),children:e.jsx(I,{name:"serviceId",control:f,rules:{validate:d?x:y},render:({field:o})=>{var j;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...o,size:"small",label:n("oauth.apple.serviceId"),error:!!c.errors[o.name],helperText:((j=c.errors[o.name])==null?void 0:j.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.keyId"),children:e.jsx(I,{name:"keyId",control:f,rules:{validate:d?g:y},render:({field:o})=>{var j;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...o,size:"small",label:n("oauth.apple.keyId"),error:!!c.errors[o.name],helperText:((j=c.errors[o.name])==null?void 0:j.message)||" ",disabled:!d})})}})}),e.jsx(D,{title:n("oauth.apple.authKey"),children:e.jsx(I,{name:"authKey",control:f,rules:{validate:d?v:y},render:({field:o})=>{var j;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...o,size:"small",type:"password",label:n("oauth.apple.authKey"),multiline:!0,rows:4,error:!!c.errors[o.name],helperText:((j=c.errors[o.name])==null?void 0:j.message)||" ",disabled:!d})})}})}),e.jsx($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const jt={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 ve({title:S,id:r,children:n,index:s,onMove:w,defaultExpand:t,onEnd:f}){const[c,h]=R.useState(t),l=R.useRef(null),d=R.useRef(null),[{handlerId:k},L]=Ee({accept:"dragItem",collect(y){return{handlerId:y.getHandlerId()}},hover(y,i){var _,Q;if(!l.current)return;const a=y.index,T=s;if(a===T)return;const o=(_=l.current)==null?void 0:_.getBoundingClientRect(),j=(Q=d.current)==null?void 0:Q.getBoundingClientRect(),u=(j.bottom-j.top)/2,A=i.getClientOffset().y-o.top;a<T&&A<u||a>T&&A>u||(w(a,T),y.index=T)}}),[{isDragging:x},g]=Ue({item:{index:s,type:"dragItem"},collect:y=>({isDragging:y.isDragging()}),end:f});g(d),L(l);const v=x?.5:1,b=p(y=>{y.preventDefault(),y.stopPropagation(),h(!c)});return e.jsxs(m,{ref:l,children:[e.jsxs(m,{sx:{cursor:"pointer","&:hover":{backgroundColor:le.backgroundsBgSubtileHover}},ref:d,"data-handler-id":k,children:[e.jsxs(m,{sx:{py:2,px:1,opacity:v,display:"flex",alignItems:"center",gap:.5},draggable:!1,onClick:b,children:[e.jsx(m,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:le.textMuted,"&:hover":{color:le.textSubtitle}},children:e.jsx(K,{fontSize:20,icon:jt})}),e.jsx(fe,{sx:{flex:1},children:S}),e.jsx(ae,{size:"small",sx:{pointerEvents:"auto",transform:c?"":"rotate(180deg)",transition:"transform 0.3s ease"},children:e.jsx(K,{icon:lt,style:{transform:"scale(1.5)"}})})]}),e.jsx(re,{})]}),e.jsx(m,{sx:{pl:4,py:2.5,display:c?"block":"none"},children:n})]})}ve.propTypes={title:N.string.isRequired,id:N.string.isRequired,children:N.node.isRequired,index:N.number.isRequired,onMove:N.func.isRequired,onEnd:N.func.isRequired,defaultExpand:N.bool};ve.defaultProps={defaultExpand:!1};const bt=[{name:"github",title:"GitHub",icon:e.jsx(K,{icon:_e}),component:e.jsx(xt,{})},{name:"google",title:"Google",icon:e.jsx(K,{icon:$e}),component:e.jsx(ft,{})},{name:"apple",title:"Apple",icon:e.jsx(K,{icon:Ve}),component:e.jsx(gt,{})},{name:"auth0",title:"Auth0",icon:e.jsx(K,{icon:Ne}),component:e.jsx(ht,{})}],vt=["github","google","apple","auth0"];function yt(){var k,L;const{api:S}=H(),{blocklet:r}=V(),n=(k=r==null?void 0:r.meta)==null?void 0:k.did,s=((L=r==null?void 0:r.settings)==null?void 0:L.oauth)||{},w=Object.keys(s).sort((x,g)=>{var v,b,y;return((v=s[x])==null?void 0:v.order)!==void 0&&((b=s[g])==null?void 0:b.order)!==void 0?s[x].order-s[g].order:((y=s[x])==null?void 0:y.order)!==void 0?-1:1});for(const x of vt)w.includes(x)||w.push(x);const t=se(w.reduce((x,g,v)=>Object.assign(x,{[g]:v}),{})),f=te(()=>{const x=[...bt];return x.sort((g,v)=>t[g.name]-t[v.name]),x},[t.auth0,t.github,t.google]),c={};typeof window<"u"&&(c.context=window);const h=p(async x=>{const g={};Object.keys(x).forEach(v=>{g[v]={order:x[v]}}),await S.configOAuth({input:{did:n,oauth:JSON.stringify(g)}})}),l=p((x,g)=>{const v=f[x],b=f[g];t[v.name]=g,t[b.name]=x}),d=p(async()=>{await h(t)});return e.jsx(m,{sx:{".section-left":{width:"160px"}},children:e.jsx(We,{backend:Me,...c,children:f.map((x,g)=>e.jsx(ve,{index:g,id:x.name,title:x.title,icon:x.icon,onMove:l,onEnd:d,defaultExpand:x.enabled,children:x.component},x.name))})})}const Z={ttl:he.SESSION_TTL,cacheTtl:he.SESSION_CACHE_TTL,email:{enabled:!1,requireVerified:!1,requireUnique:!1,trustOauthProviders:!1,trustedIssuers:[],enableDomainBlackList:!1,domainBlackList:[],enableDomainWhiteList:!1,domainWhiteList:[]},phone:{enabled:!1,requireVerified:!1,requireUnique:!1,regionBlackList:[],trustedIssuers:[]}};function M(S){return e.jsx(ct,{...S,sx:{transform:"scale(0.75)"}})}function pe(S,r=!1){const n=r?S.ttl*86400:S.ttl/86400;return{...S,ttl:n}}function St(){var o,j;const{api:S}=H(),{blocklet:r}=V(),n=(o=r==null?void 0:r.meta)==null?void 0:o.did,s=st({},Z,((j=r==null?void 0:r.settings)==null?void 0:j.session)||{});qe(s.ttl)&&(s.ttl=Z.ttl),qe(s.cacheTtl)&&(s.cacheTtl=Z.cacheTtl),s.phone||(s.phone=Z.phone),s.email||(s.email=Z.email);const{handleSubmit:w,control:t,formState:f,reset:c,watch:h}=oe({defaultValues:Y(pe(s),["ttl","cacheTtl","email","phone"])}),{t:l}=ne(),d=h("email.enabled"),k=h("phone.enabled"),L=h("email.enableDomainBlackList"),x=h("email.enableDomainWhiteList"),{fields:g,append:v,remove:b}=Fe({control:t,name:"email.domainBlackList"}),{fields:y,append:i,remove:a}=Fe({control:t,name:"email.domainWhiteList"}),T=p(async u=>{var P;try{const{blocklet:A}=await S.updateAppSessionConfig({input:{did:n,config:ot(pe(u,!0),["phone"])}}),_=Object.assign({},Z,Y(((P=A==null?void 0:A.settings)==null?void 0:P.session)||{},["ttl","cacheTtl","email","phone"]));c(pe(_)),U.success(l("common.configSuccess"))}catch(A){U.error(A.message)}});return e.jsx(wt,{onSubmit:w(T),children:e.jsxs(J,{direction:"column",gap:6,children:[e.jsxs(m,{children:[e.jsxs(m,{children:[e.jsx(fe,{variant:"h6",fontWeight:600,children:l("blocklet.config.session.profile")}),e.jsx(m,{component:re,my:3})]}),e.jsxs(J,{gap:2,children:[e.jsx(D,{title:l("blocklet.config.session.fullNameEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(M,{disabled:!0,checked:!0})})}),e.jsx(D,{title:l("blocklet.config.session.avatarEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(M,{disabled:!0,checked:!0})})}),e.jsx(D,{title:l("blocklet.config.session.emailEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enabled",control:t,render:({field:u})=>e.jsx(M,{...u,checked:u.value})})})}),d&&e.jsxs(J,{direction:"column",ml:2,children:[e.jsx(D,{title:l("blocklet.config.session.emailRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.requireVerified",control:t,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.emailRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.requireUnique",control:t,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.emailTrustOauthProviders"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.trustOauthProviders",control:t,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.enableDomainBlackList"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enableDomainBlackList",control:t,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),L&&e.jsxs(m,{children:[g.map((u,P)=>e.jsxs(J,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(I,{name:`email.domainBlackList.${P}`,control:t,render:A=>e.jsx(O,{...A.field,size:"small",fullWidth:!0})}),e.jsx(ae,{onClick:()=>b(P),children:e.jsx(De,{})})]},u.id)),e.jsx($,{startIcon:e.jsx(Pe,{}),onClick:()=>v(""),children:l("blocklet.config.session.addDomain")})]}),e.jsx(D,{title:l("blocklet.config.session.enableDomainWhiteList"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enableDomainWhiteList",control:t,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),x&&e.jsxs(m,{children:[y.map((u,P)=>e.jsxs(J,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(I,{name:`email.domainWhiteList.${P}`,control:t,render:A=>e.jsx(O,{...A.field,size:"small",fullWidth:!0})}),e.jsx(ae,{onClick:()=>a(P),children:e.jsx(De,{})})]},u.id)),e.jsx($,{startIcon:e.jsx(Pe,{}),onClick:()=>i(""),children:l("blocklet.config.session.addDomain")})]})]}),e.jsxs(m,{sx:{display:"none"},children:[e.jsx(D,{title:l("blocklet.config.session.phoneEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.enabled",control:t,disabled:!0,render:({field:u})=>e.jsx(W,{sx:{mt:1},control:e.jsx(M,{...u,checked:u.value})})})})}),k&&e.jsxs(J,{direction:"column",ml:2,mt:1,children:[e.jsx(D,{title:l("blocklet.config.session.phoneRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.requireVerified",control:t,render:({field:u})=>e.jsx(W,{control:e.jsx(M,{...u,checked:u.value})})})})}),e.jsx(D,{title:l("blocklet.config.session.phoneRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.requireUnique",control:t,render:({field:u})=>e.jsx(W,{control:e.jsx(M,{...u,checked:u.value})})})})})]})]})]})]}),e.jsxs(m,{children:[e.jsx(fe,{variant:"h6",fontWeight:600,children:l("blocklet.config.session.period")}),e.jsx(m,{component:re,my:3}),e.jsx(J,{direction:"column",spacing:2,children:e.jsx(I,{name:"ttl",control:t,rules:{min:1,max:30},render:({field:u})=>e.jsx(E,{fullWidth:!0,sx:{mb:2},children:e.jsx(D,{title:l("blocklet.config.session.ttl",{day:u.value}),sectionLeftSx:{width:"600px"},children:e.jsx(m,{sx:{maxWidth:500,ml:1},children:e.jsx(et,{...u,defaultValue:7,step:1,marks:[{value:1,label:l("blocklet.config.session.day",{day:1})},{value:7,label:l("blocklet.config.session.days",{day:7})},{value:14,label:l("blocklet.config.session.days",{day:14})},{value:21,label:l("blocklet.config.session.days",{day:21})},{value:30,label:l("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto"})})})})})})]}),e.jsx(m,{children:e.jsx($,{type:"submit",variant:"contained",disabled:!f.isDirty,children:l("oauth.save")})})]})})}const wt=Re.form`
|
|
2
|
+
max-width: 1536px;
|
|
3
|
+
|
|
4
|
+
.advanced-config {
|
|
5
|
+
border: 0;
|
|
6
|
+
padding: 0;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.config-form {
|
|
10
|
+
flex-grow: 1;
|
|
11
|
+
overflow-y: auto;
|
|
12
|
+
will-change: transform;
|
|
13
|
+
|
|
14
|
+
&:first-child {
|
|
15
|
+
margin: 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
${S=>S.theme.breakpoints.down("md")} {
|
|
19
|
+
width: 100%;
|
|
20
|
+
flex-shrink: 0;
|
|
21
|
+
padding: 0 24px;
|
|
22
|
+
transform: translate(0, 0);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.config-item {
|
|
27
|
+
display: flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
justify-content: space-between;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.config-desc {
|
|
33
|
+
font-weight: normal;
|
|
34
|
+
font-size: 12px;
|
|
35
|
+
color: #666;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.form-item {
|
|
39
|
+
margin-top: 0;
|
|
40
|
+
}
|
|
41
|
+
`;var ye={},kt=tt;Object.defineProperty(ye,"__esModule",{value:!0});var Se=ye.default=void 0,Tt=kt(He()),Lt=e;Se=ye.default=(0,Tt.default)((0,Lt.jsx)("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2m4.24 16L12 15.45 7.77 18l1.12-4.81-3.73-3.23 4.92-.42L12 5l1.92 4.53 4.92.42-3.73 3.23z"}),"Stars");const It={width:24,height:24,body:'<path fill="currentColor" d="M6 12.05q0 1.125.425 2.188T7.75 16.2l.25.25V15q0-.425.288-.713T9 14q.425 0 .713.288T10 15v4q0 .425-.288.713T9 20H5q-.425 0-.713-.288T4 19q0-.425.288-.713T5 18h1.75l-.4-.35q-1.3-1.15-1.825-2.625T4 12.05Q4 9.7 5.2 7.787T8.425 4.85q.35-.2.738-.025t.512.575q.125.375-.013.75t-.487.575q-1.45.8-2.313 2.213T6 12.05Zm12-.1q0-1.125-.425-2.187T16.25 7.8L16 7.55V9q0 .425-.288.713T15 10q-.425 0-.713-.288T14 9V5q0-.425.288-.713T15 4h4q.425 0 .713.288T20 5q0 .425-.288.713T19 6h-1.75l.4.35q1.225 1.225 1.788 2.663T20 11.95q0 2.35-1.2 4.263t-3.225 2.937q-.35.2-.737.025t-.513-.575q-.125-.375.013-.75t.487-.575q1.45-.8 2.313-2.212T18 11.95Z"/>'},{DEFAULT_IP_DOMAIN_SUFFIX:Dt,SLOT_FOR_IP_DNS_SITE:Ct,DEFAULT_DID_DOMAIN:qt}=he,{encode:Oe}=mt,Ft=S=>`${Oe(S.meta.did)}-${Ct}.${Dt}`,Pt=({did:S,didDomain:r=qt})=>`${Oe(S)}.${r}`;var Rt={getIpDnsDomainForBlocklet:Ft,getDidDomainForBlocklet:Pt};const At=R.forwardRef((S,r)=>{var b,y;const{t:n}=R.useContext(X),{blocklet:s}=V(),{api:w}=H(),t=se({loadingReject:!1,loadingApprove:!1,mode:"view",show:!1,data:{},callback:G}),f=be(),c=((y=(b=f==null?void 0:f.transitions)==null?void 0:b.duration)==null?void 0:y.leavingScreen)||300,h=p(()=>{t.mode="view",t.data={},t.callback=G}),l=p(()=>{t.show=!1,setTimeout(()=>{h()},c)}),d=p(i=>{t.mode="view",t.show=!0,t.data=i}),k=p((i,a=G)=>{t.mode="approve",t.show=!0,t.data=i,t.callback=a});R.useImperativeHandle(r,()=>({open:d,close:l,approve:k}),[d,l,k]);const L=te(()=>{if(!t.show)return[];t.data.migratedFrom=[t.data.appId,t.data.appPid];const i=["appName","appLogo","appId","appPid","migratedFrom","appDescription","appUrl","version","appliedAt","status","serverId","serverVersion"];return t.data.isMaster!==!1&&at(i,"appliedAt","status"),i.map(a=>{const T=n(`federated.info.${a}`);let o=t.data[a];if(a==="appName"&&t.data.isMaster&&(o=e.jsxs(m,{children:[e.jsx(Ae,{component:Se}),o]})),["appId","appPid","serverId"].includes(a)&&(o=e.jsx(xe,{children:o})),["appUrl"].includes(a)&&(o=e.jsx(m,{component:"a",href:o,target:"_blank",children:o})),["appLogo"].includes(a)){const j=rt(`https://${Rt.getDidDomainForBlocklet({did:t.data.appPid})}`,"/.well-known/service/blocklet/logo");try{const u=new URL(j);u.searchParams.set("imageFilter","resize"),u.searchParams.set("w","80"),u.searchParams.set("h","80"),o=e.jsx("img",{src:u.href,width:"60",height:"60",alt:t.data.appName})}catch{o=e.jsx("img",{src:j,width:"60",height:"60",alt:t.data.appName})}}return a==="status"&&(o=o&&n(`federated.status.${o}`)),a==="migratedFrom"&&(o=(t.data.migratedFrom||[]).filter(P=>![t.data.appId,t.data.appPid].includes(P)).map(P=>e.jsx(xe,{children:P}))),it(o)&&(o="-"),{name:T,value:o}})},[t.data]),x=t.mode==="approve",g=p(async()=>{try{t.loadingReject=!0,await w.auditFederatedLogin({input:{memberPid:t.data.appPid,did:s.appPid,status:"rejected"}}),l(),t==null||t.callback(!1)}finally{t.loadingReject=!1}}),v=p(async()=>{try{t.loadingApprove=!0,await w.auditFederatedLogin({input:{memberPid:t.data.appPid,did:s.appPid,status:"approved"}}),l(),t==null||t.callback(!0)}finally{t.loadingApprove=!1}});return e.jsx(je,{open:t.show,title:n(x?"federated.approveToJoinLogin":"federated.siteDetail"),onClose:l,actions:x?e.jsxs(e.Fragment,{children:[e.jsxs($,{color:"error",variant:"contained",onClick:g,disabled:t.loadingReject,children:[t.loadingReject?e.jsx(ge,{size:16,color:"grey"}):null,n("common.reject")]}),e.jsxs($,{variant:"contained",onClick:v,disabled:t.loadingApprove,children:[t.loadingApprove?e.jsx(ge,{size:16,color:"grey"}):null,n("common.approve")]})]}):e.jsx($,{variant:"outlined",onClick:l,children:n("common.close")}),children:L.map(i=>e.jsx(ut,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:180,name:i.name,children:i.value},i.name))})}),Be=R.forwardRef((S,r)=>{var d,k;const n=be(),s=((k=(d=n==null?void 0:n.transitions)==null?void 0:d.duration)==null?void 0:k.leavingScreen)||300,{t:w}=R.useContext(X),t=se({show:!1,data:{link:""}}),f=p(()=>{t.data.link=""}),c=p(()=>{t.show=!1,setTimeout(()=>{f()},s)}),h=p(({link:L})=>{t.show=!0,t.data.link=L});R.useImperativeHandle(r,()=>({open:h,close:c}),[h,c]);const l=p(()=>{Qe(t.data.link),c()});return e.jsxs(je,{open:t.show,title:w("federated.joinFederatedLogin"),onClose:c,PaperProps:{style:{minHeight:"unset"}},actions:e.jsx(z,{color:"primary",autoFocus:!0,variant:"contained",onClick:l,children:w("common.copyAndClose")}),children:[e.jsx(m,{mb:1,children:w("federated.inviteJoinFederatedLoginDescription")}),e.jsx(m,{sx:{"& .copy-button":{display:"none !important"}},children:e.jsx(Je,{language:"shell",style:{marginBottom:0},children:t.data.link})})]})});function we({mode:S}){var Q,ke,Te,Le,Ie;const r=R.useRef(null),n=R.useRef(null),{t:s,locale:w}=R.useContext(X),{blocklet:t,actions:{refreshBlocklet:f}}=V(),{confirmApi:c,confirmHolder:h}=Ke(),{api:l}=H(),d=((Q=t.settings.federated)==null?void 0:Q.sites)||[],k=((ke=t.settings.federated)==null?void 0:ke.config)||{},L=k.isMaster!==!1,x=d.find(C=>C.appPid===t.appPid),g=se({loadingSync:!1}),v=p(C=>{var q;(q=n.current)==null||q.open(C)}),b=p(C=>{var q;(q=n.current)==null||q.approve(C,f)}),y=p(C=>{c.open({title:s("federated.removeFederatedLogin"),content:s("federated.removeFederatedLoginDescription"),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(q){await l.quitFederatedLogin({input:{did:t.appPid,targetDid:C.appPid}}),q()}})}),i=p(C=>{c.open({title:s("federated.disableFederatedLogin"),content:s("federated.disableFederatedLoginDescription"),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(q){await l.auditFederatedLogin({input:{memberPid:C.appPid,did:t.appPid,status:"revoked"}}),q()}})}),a=p(C=>{c.open({title:s("federated.enableFederatedLogin"),content:s("federated.enableFederatedLoginDescription"),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),async onConfirm(q){await l.auditFederatedLogin({input:{memberPid:C.appPid,did:t.appPid,status:"approved"}}),q()}})}),T=te(()=>{const C=[{label:s("common.name"),name:"appName",options:{customBodyRenderLite:q=>{const F=d[q],ee=F.isMaster!==!1;return e.jsx(m,{display:"inline-block",children:e.jsxs(m,{component:"a",display:"flex",alignItems:"center",href:F.appUrl,target:"_blank",onClick:B=>{B.stopPropagation()},children:[ee&&e.jsx(Ae,{component:Se,style:{marginRight:"4px"}}),F.appName]})})}}},{label:s("common.did"),name:"appId",options:{customBodyRenderLite:q=>{const F=d[q];return e.jsx(xe,{children:F.appId})}}},{label:s("common.status"),name:"status",options:{customBodyRenderLite:q=>{const F=d[q],ee=F.isMaster!==!1;return e.jsx(m,{children:ee?"-":s(`federated.status.${F.status}`)})}}}];return L&&C.push({label:s("common.actions"),name:"actions",options:{customBodyRenderLite:q=>{const F=d[q],ee=F.isMaster!==!1;return e.jsx(m,{display:"flex",gap:1,children:ee?e.jsxs(e.Fragment,{children:[F.status==="rejected"&&e.jsx(z,{variant:"contained",color:"error",size:"small",onClick:B=>{B.stopPropagation()},children:s("federated.status.rejected")}),F.status==="revoked"&&e.jsx(z,{variant:"contained",color:"secondary",size:"small",onClick:B=>{B.stopPropagation()},children:s("federated.status.revoked")})]}):e.jsxs(e.Fragment,{children:[e.jsx(z,{variant:"contained",color:"error",size:"small",onClick:B=>{B.stopPropagation(),y(F)},children:s("federated.quitMember")},"quiteSite"),F.status==="pending"&&e.jsx(z,{variant:"contained",color:"primary",size:"small",onClick:B=>{B.stopPropagation(),b(F)},children:s("federated.status.pending")},"auditSite"),F.status==="approved"&&e.jsx(z,{variant:"contained",color:"error",size:"small",onClick:B=>{B.stopPropagation(),i(F)},style:{whiteSpace:"nowrap"},children:s("federated.revoke")},"revokeSite"),F.status==="revoked"&&e.jsx(z,{variant:"contained",color:"warning",size:"small",onClick:B=>{B.stopPropagation(),a(F)},style:{whiteSpace:"nowrap"},children:s("federated.approve")},"approveSite")]})})}}}),C},[k.appId,d,L,s]),o=te(()=>({sort:!0,download:!1,filter:!1,print:!1,expandableRowsOnClick:!0,onRowClick(C,{dataIndex:q}){const F=d[q];v(F)}}),[]),j=p(()=>{var q;const C=t.environments.find(F=>F.key===dt.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL);C!=null&&C.value?(q=r.current)==null||q.open({link:C.value}):U.error(s("federated.failedToGetFederatedLoginLink"))},[(Ie=(Le=(Te=t.site)==null?void 0:Te.domainAliases)==null?void 0:Le[0])==null?void 0:Ie.href]),u=p(()=>{c.open({title:s("federated.quitFederatedLogin"),content:s("federated.quitFederatedLoginDescription"),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(C){await l.quitFederatedLogin({input:{did:t.appPid}}),C()}})}),P=p(()=>{c.open({title:s("federated.disbandFederatedLogin"),content:s("federated.disbandFederatedLoginDescription"),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(C){await l.disbandFederatedLogin({input:{did:t.appPid}}),C()}})}),A=p(async()=>{try{g.loadingSync=!0,await Promise.all([await l.syncFederatedConfig({input:{did:t.appPid}}),Ze(500)]),U.success(s("common.succeeded"))}finally{g.loadingSync=!1}}),_=[];return x.status!=="pending"&&_.push(e.jsx(nt,{title:s("federated.syncConfig"),children:e.jsx(ae,{size:"small",onClick:A,disabled:g.loadingSync,sx:[{"@keyframes spin":{from:{transform:"rotate(0deg)"},to:{transform:"rotate(360deg)"}}},g.loadingSync?{animation:"spin 1s linear infinite"}:{}],children:e.jsx(K,{icon:It,style:{fontSize:24}})},"syncConfig")})),S==="master"?(_.push(e.jsx(z,{size:"small",variant:"contained",onClick:j,sx:{ml:1},children:s("federated.inviteJoinFederatedLogin")},"inviteJoinFederatedLogin")),_.push(e.jsx(z,{color:"error",size:"small",variant:"contained",onClick:P,sx:{ml:1},children:s("federated.disbandFederatedLogin")},"disbandFederatedLogin"))):_.push(e.jsx(z,{size:"small",variant:"contained",color:"error",onClick:u,sx:{ml:1},children:s("federated.quitFederatedLogin")},"quitFederatedLogin")),e.jsxs(e.Fragment,{children:[e.jsx(Ge,{className:"main-table",locale:w,data:d,columns:T,customButtons:_,title:e.jsx(m,{className:"table-toolbar-left",children:s("oauth.federated")}),options:o}),h,e.jsx(Be,{ref:r}),e.jsx(At,{ref:n})]})}we.propTypes={mode:N.oneOf(["member","master"])};we.defaultProps={mode:"member"};const Ot=R.forwardRef((S,r)=>{var g,v;const{t:n}=R.useContext(X),{api:s}=H(),{blocklet:w}=V(),t=w==null?void 0:w.appPid,f=be(),c=((v=(g=f==null?void 0:f.transitions)==null?void 0:g.duration)==null?void 0:v.leavingScreen)||300,h=se({loading:!1,show:!1,appUrl:"",appUrlError:"",callback:G}),l=p(()=>{h.appUrl="",h.appUrlError="",h.callback=G}),d=p(()=>{h.show=!1,setTimeout(()=>{l()},c)}),k=p((b=G)=>{h.show=!0,h.callback=b});R.useImperativeHandle(r,()=>({open:k,close:d}),[k,d]);const L=p(b=>{if(!b)throw new Error(n("federated.federatedJoinAppUrlRequired"));if(!Ye(b))throw new Error(n("federated.federatedJoinAppUrlInvalid"))}),x=p(async()=>{try{L(h.appUrl),h.loading=!0;const b=await s.joinFederatedLogin({input:{did:t,appUrl:h.appUrl}});h.show=!1,d(),h==null||h.callback(b)}catch(b){h.appUrlError=b.message}finally{h.loading=!1}});return e.jsxs(je,{open:h.show,title:n("federated.joinFederatedLogin"),onClose:d,PaperProps:{style:{minHeight:"unset"}},actions:e.jsxs(z,{color:"primary",autoFocus:!0,variant:"contained",onClick:x,disabled:h.loading,children:[h.loading?e.jsx(ge,{size:16,sx:{mr:1},color:"grey"}):null,n("common.confirm")]}),children:[e.jsx(m,{mb:1,children:n("federated.joinFederatedLoginDescription")}),e.jsx(O,{fullWidth:!0,variant:"outlined",margin:"dense",placeholder:n("federated.federatedJoinAppUrl"),label:n("federated.federatedJoinAppUrl"),value:h.appUrl,error:!!h.appUrlError,helperText:h.appUrlError||"eg: https://www.arcblock.io",onChange:b=>{h.appUrl=b.target.value}})]})});function Bt(){var c,h,l,d,k;const S=R.useRef(null),r=R.useRef(null),{t:n}=R.useContext(X),{blocklet:s,actions:{refreshBlocklet:w}}=V(),t=p(()=>{var x,g,v,b;const L=(v=(g=(x=s.site)==null?void 0:x.domainAliases)==null?void 0:g[0])==null?void 0:v.href;if(L)try{const y=new URL(L);(b=S.current)==null||b.open({link:y.origin})}catch{U.error(n("federated.failedToGetFederatedLoginLink"))}},[(l=(h=(c=s.site)==null?void 0:c.domainAliases)==null?void 0:h[0])==null?void 0:l.href]),f=p(()=>{var L;(L=r.current)==null||L.open(()=>{w()})});if(((d=s.settings.federated)==null?void 0:d.sites.length)>0){const L=((k=s.settings.federated)==null?void 0:k.config.isMaster)!==!1;return e.jsx(we,{mode:L?"master":"member"})}return e.jsxs(e.Fragment,{children:[e.jsxs(m,{display:"flex",flexDirection:"column",gap:2,justifyContent:"center",alignItems:"center",minHeight:"200px",children:[e.jsx(z,{variant:"contained",onClick:t,children:n("federated.inviteJoinFederatedLogin")}),e.jsx(re,{sx:{width:"150px",color:"rgba(0, 0, 0, 0.3)"},children:"OR"}),e.jsx(z,{variant:"outlined",onClick:f,children:n("federated.joinFederatedLogin")})]}),e.jsx(Be,{ref:S}),e.jsx(Ot,{ref:r})]})}function ze({orientation:S="horizontal"}){const{t:r}=R.useContext(X),n=pt({key:"lg"}),s=[{label:e.jsx(m,{textAlign:"center",width:"100%",children:r("oauth.commonSettings")}),value:"settings"},{label:e.jsx(m,{textAlign:"center",width:"100%",children:r("oauth.federated")}),value:"federated"},{label:e.jsx(m,{textAlign:"center",width:"100%",children:r("oauth.oauth")}),value:"oauth"},{label:e.jsx(m,{textAlign:"center",width:"100%",children:r("oauth.moreLogin")}),value:"more"}],[w,t]=R.useState(s[0].value),f=te(()=>({oauth:e.jsx(yt,{}),federated:e.jsx(Bt,{}),more:e.jsx(Xe,{children:r("oauth.comingSoon")}),settings:e.jsx(St,{})}),[r]);return S==="vertical"?e.jsx(zt,{children:e.jsxs(J,{direction:{md:"column",lg:"row"},gap:2,children:[e.jsx(m,{sx:{minWidth:"240px",flexShrink:0},children:e.jsx(Ce,{tabs:s,current:w,orientation:n?"horizontal":"vertical",onChange:t,sx:{borderRight:n?0:1,height:"100%",borderColor:"divider"}})}),e.jsx(m,{sx:{flexGrow:1,minWidth:0},children:e.jsx(m,{maxWidth:"1200px",children:f[w]})})]})}):e.jsxs(m,{children:[e.jsx(Ce,{tabs:s,current:w,onChange:t}),e.jsx(m,{marginTop:"10px",children:f[w]})]})}ze.propTypes={orientation:N.oneOf(["horizontal","vertical"])};ze.defaultProps={orientation:"horizontal"};const zt=Re.div`
|
|
42
|
+
.MuiTab-root {
|
|
43
|
+
text-align: left;
|
|
44
|
+
align-items: flex-start;
|
|
45
|
+
font-weight: normal;
|
|
46
|
+
|
|
47
|
+
div {
|
|
48
|
+
text-align: left;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.Mui-selected {
|
|
53
|
+
font-weight: bold;
|
|
54
|
+
}
|
|
55
|
+
`;export{ze as default};
|