@abtnode/blocklet-services 1.16.52-beta-20250908-085420-224a58fa → 1.16.52-beta-20250911-023851-d988be85
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/emails/_components/footer.js +7 -2
- package/api/libs/email.js +5 -1
- package/api/routes/user.js +52 -2
- package/api/services/auth/connect/verify-destroy.js +42 -9
- package/api/socket/util.js +4 -1
- package/api/state/message.js +9 -1
- package/api/util/utm.js +241 -0
- package/dist/assets/{AdapterDayjs-ffU9bx7e.js → AdapterDayjs-CKA_54eZ.js} +1 -1
- package/dist/assets/{Google-GRs7AwNK.js → Google-DzJt8j2p.js} +1 -1
- package/dist/assets/{access-control-D02QLhEy.js → access-control-DTQ50N6V.js} +1 -1
- package/dist/assets/{add-component-core-DmrTn-fB.js → add-component-core-BrVCLSN6.js} +1 -1
- package/dist/assets/{add-resource-BuXNw0by.js → add-resource-c90mXjXe.js} +1 -1
- package/dist/assets/{addon-CJVfVQdN.js → addon-CxluIuPz.js} +1 -1
- package/dist/assets/{advanced-BQI2sreZ.js → advanced-DFALg-CZ.js} +1 -1
- package/dist/assets/{aigne-CzGA8IUU.js → aigne-C4_yXAUg.js} +1 -1
- package/dist/assets/{appearance-BsyCLclh.js → appearance-DKolOYs4.js} +1 -1
- package/dist/assets/{ar-CPI6kJBB.js → ar-DGfbWcRb.js} +1 -1
- package/dist/assets/{arrow-down.svg-CeA5tsyp.js → arrow-down.svg-CGgLriRk.js} +1 -1
- package/dist/assets/{audit-logs-DE_zWK7V.js → audit-logs-numMr61S.js} +1 -1
- package/dist/assets/{authorize-D07NMtq7.js → authorize-Cs-nLZVa.js} +1 -1
- package/dist/assets/{base32-DUdjIQpj.js → base32-2BTO5zmk.js} +1 -1
- package/dist/assets/{bind-account-D809ACvG.js → bind-account-DATlcjGM.js} +1 -1
- package/dist/assets/{branding-IdArDAjP.js → branding-ChMkwmNu.js} +1 -1
- package/dist/assets/{branding-DZQe1PsD.js → branding-CpqfcsE-.js} +1 -1
- package/dist/assets/{branding-DLVsPMDM.js → branding-Dv6FvDLK.js} +2 -2
- package/dist/assets/{bundle-avatar-bJGgXPJZ.js → bundle-avatar-CfoJFi5J.js} +1 -1
- package/dist/assets/{button-C0DX42gM.js → button-VDZIHEym.js} +1 -1
- package/dist/assets/{click-to-copy-r3y_3V-6.js → click-to-copy-CH3FJWJo.js} +1 -1
- package/dist/assets/{complete-C_LldbSL.js → complete-CshVhiET.js} +1 -1
- package/dist/assets/{component-EW2m-2Hq.js → component-B1O9WT7z.js} +3 -3
- package/dist/assets/{config-BppAex79.js → config-Bmq4DJl0.js} +1 -1
- package/dist/assets/{config-CJ2tOrVe.js → config-CmIvwzmQ.js} +1 -1
- package/dist/assets/{config-navigation-QgsadD0w.js → config-navigation-R4T6jiU3.js} +3 -3
- package/dist/assets/{config-space-v48mujCK.js → config-space-BVAKDgsX.js} +1 -1
- package/dist/assets/{config-CeYMoY4R.js → config-vTUk_Yfk.js} +1 -1
- package/dist/assets/{confirm-CV_ukxE_.js → confirm-DV4YCyEc.js} +1 -1
- package/dist/assets/{connect-DUM8FA7f.js → connect-C9A-I8R8.js} +1 -1
- package/dist/assets/{connect-to-B_ABoYFh.js → connect-to-CtS-ZsP9.js} +1 -1
- package/dist/assets/{connect-DcYdVgbK.js → connect-vQygM1gc.js} +1 -1
- package/dist/assets/{createClass-CpGAUQg2.js → createClass-DNqt7UI8.js} +1 -1
- package/dist/assets/{dashboard-CmGsGxlD.js → dashboard-CzGF4PYs.js} +3 -3
- package/dist/assets/{de-DXdF82Jr.js → de-DGZI-Bsh.js} +1 -1
- package/dist/assets/{delete-confirm-gyn7XAac.js → delete-confirm-ad8t0UXs.js} +1 -1
- package/dist/assets/{did-address-CPLUdwKY.js → did-address-4KKI5Z_V.js} +1 -1
- package/dist/assets/{domain-UrJgIaK0.js → domain-D-3zw7uG.js} +1 -1
- package/dist/assets/{domain-action-card-YXDKcuVT.js → domain-action-card-wBZ8YZ_K.js} +1 -1
- package/dist/assets/{domains-4FokCnh1.js → domains-BjPU8dXK.js} +1 -1
- package/dist/assets/{email-YS4JhMeS.js → email-DCapsREm.js} +1 -1
- package/dist/assets/engine-CRVby1S4.js +1 -0
- package/dist/assets/{es-Cdb297yS.js → es-CMwFpp7C.js} +1 -1
- package/dist/assets/{exchange-passport-P_xK2-vf.js → exchange-passport-CuSVCQpP.js} +1 -1
- package/dist/assets/{form-DT1p2SWd.js → form-2mrhORLa.js} +1 -1
- package/dist/assets/{form-text-input-B8adEKSe.js → form-text-input-CyaKz-aW.js} +1 -1
- package/dist/assets/{fr-CQValz_y.js → fr-eKsI9Vcp.js} +1 -1
- package/dist/assets/{fuel-DP0Q8hTa.js → fuel-DHo_QvBk.js} +1 -1
- package/dist/assets/{gen-access-key-BG7JXR4u.js → gen-access-key-D3bzBUlQ.js} +1 -1
- package/dist/assets/{gen-simple-access-key-DaNnWhrp.js → gen-simple-access-key-BKkuz2Fk.js} +1 -1
- package/dist/assets/get-safe-url-D4-uUwWa.js +1 -0
- package/dist/assets/{hdkey-BCusmuac.js → hdkey-CZt5k06-.js} +1 -1
- package/dist/assets/{hi-CAensap9.js → hi-C0JqybmN.js} +1 -1
- package/dist/assets/{home-Bhiyk77K.js → home-DgBfnhbE.js} +1 -1
- package/dist/assets/{id-6AFgcYKj.js → id-DHF6PX-M.js} +1 -1
- package/dist/assets/{iframe-Ce3kroAM.js → iframe-amFSSPgY.js} +1 -1
- package/dist/assets/{index-BWBlDFjU.js → index-B0DwBoe3.js} +1 -1
- package/dist/assets/{index-Br7RGSFv.js → index-B2EmOTH7.js} +61 -61
- package/dist/assets/{index-BLonWJ__.js → index-BFMIW-KL.js} +1 -1
- package/dist/assets/{index-DPwiaPyc.js → index-BFQzptXM.js} +1 -1
- package/dist/assets/{index-Cb8NmoOI.js → index-BNWq4zK7.js} +1 -1
- package/dist/assets/{index-O6p0L2t4.js → index-BV5aEWS1.js} +1 -1
- package/dist/assets/{index-JrJd98Of.js → index-BWhAMS1Q.js} +1 -1
- package/dist/assets/{index-CcYh_TwI.js → index-BjLb1HBo.js} +1 -1
- package/dist/assets/{index-CipehFwZ.js → index-BmPcC1s0.js} +1 -1
- package/dist/assets/{index-Ed1obN0N.js → index-C1-AZbYf.js} +1 -1
- package/dist/assets/{index-DK4dVb7h.js → index-C1pPU9qq.js} +1 -1
- package/dist/assets/{index-C14bbQSS.js → index-C4j3gH0o.js} +1 -1
- package/dist/assets/{index-h9p2Gwwd.js → index-CBP6lyxa.js} +1 -1
- package/dist/assets/{index-DffJvJ-f.js → index-CZYE2JtK.js} +4 -4
- package/dist/assets/{index-DCsimtEZ.js → index-Ca0DgcTh.js} +1 -1
- package/dist/assets/{index-CcGgdXu3.js → index-CcuDh75j.js} +1 -1
- package/dist/assets/{index-BrgPswzL.js → index-Cgvk2QQ_.js} +1 -1
- package/dist/assets/index-DBhVhw1v.js +124 -0
- package/dist/assets/{index-ejiOKw1E.js → index-DVMWAhrt.js} +1 -1
- package/dist/assets/{index-DNgNPmIn.js → index-DkTLhY6N.js} +1 -1
- package/dist/assets/{index-sflWxhj_.js → index-FBIc-uda.js} +1 -1
- package/dist/assets/{index-CDP_L1qy.js → index-HB59rGor.js} +3 -3
- package/dist/assets/index-LTZrTPAZ.js +113 -0
- package/dist/assets/{index-BC_z-zsl.js → index-S5gZ547W.js} +1 -1
- package/dist/assets/{index-_sKq7vql.js → index-Vdt8KS2l.js} +1 -1
- package/dist/assets/{index-B9WrGYJf.js → index-ub2vI299.js} +1 -1
- package/dist/assets/{index-ClwjZe6L.js → index-zmlRlLsp.js} +1 -1
- package/dist/assets/{invitation-BZnf93ev.js → invitation-CsaolrG3.js} +1 -1
- package/dist/assets/{invite-CBTmzhwp.js → invite-Bz_emQWL.js} +1 -1
- package/dist/assets/{isURL-C56b9oXx.js → isURL-DviHJNBO.js} +1 -1
- package/dist/assets/{issue-passport-B0hsJjTB.js → issue-passport-ZQsWd3Dr.js} +1 -1
- package/dist/assets/{item-DFbQgetg.js → item-vw_cuyBZ.js} +1 -1
- package/dist/assets/{ja-D59y1sZ9.js → ja-c-6MaUg1.js} +1 -1
- package/dist/assets/{ko-DlSyClni.js → ko-CTFi4Ndk.js} +1 -1
- package/dist/assets/{landing-page-hbXRmObM.js → landing-page-CVL3NbvQ.js} +1 -1
- package/dist/assets/{layout-n_wdIvvX.js → layout-BKp8C5F-.js} +1 -1
- package/dist/assets/{list-Dg6YcsMU.js → list-CY0v9mkZ.js} +1 -1
- package/dist/assets/{list-DkhTNTRK.js → list-zVgARuTW.js} +3 -3
- package/dist/assets/localization-UoEVomCp.js +1 -0
- package/dist/assets/{log-C_yeI_wV.js → log-CuQWYZCB.js} +1 -1
- package/dist/assets/logger-DtNL0LIQ.js +1 -0
- package/dist/assets/{login-BUd7xYia.js → login-1ZsKClLU.js} +1 -1
- package/dist/assets/{login-oauth-callback-YoW0x_7a.js → login-oauth-callback-YZd7R3pO.js} +1 -1
- package/dist/assets/{logo-uploader-BMMUJR7a.js → logo-uploader-DuDo-4bO.js} +2 -2
- package/dist/assets/{lost-passport-DNLvYerq.js → lost-passport-Dx86JuPR.js} +1 -1
- package/dist/assets/{open-window-BbZDdsmg.js → open-window-DnjhXMUE.js} +1 -1
- package/dist/assets/{over-due-invoice-payment-BY3BR46r.js → over-due-invoice-payment-Dam76xor.js} +1 -1
- package/dist/assets/{overview-BFVzb-zB.js → overview-DiuRZ10x.js} +1 -1
- package/dist/assets/{passport-item-CRrICCXE.js → passport-item-CwFxbGyQ.js} +1 -1
- package/dist/assets/{permission-UQGu_-Cf.js → permission-DwyNIiFn.js} +1 -1
- package/dist/assets/{preferences-CyALDCap.js → preferences-D93Xc9AW.js} +1 -1
- package/dist/assets/profile-embed-C7ST7lEr.js +1 -0
- package/dist/assets/{pt-C_3CX1PR.js → pt-QkdDdQuw.js} +1 -1
- package/dist/assets/{publish-resource-Dp_w1Dsi.js → publish-resource-DU3M6kAz.js} +1 -1
- package/dist/assets/{react-beautiful-dnd.esm-U2orHJvj.js → react-beautiful-dnd.esm-DFIGUIPG.js} +1 -1
- package/dist/assets/{ru-FBGLUlo5.js → ru-swMH4bvc.js} +1 -1
- package/dist/assets/{runtime--G1ujVXp.js → runtime-Cp_2Mkns.js} +1 -1
- package/dist/assets/sdk-j_z17Rma.js +1 -0
- package/dist/assets/{security-B3L7qXQI.js → security-DNzyYn22.js} +1 -1
- package/dist/assets/{session-Ba0-LWgc.js → session-DGj-_oAZ.js} +1 -1
- package/dist/assets/{setup-DnpqJaf3.js → setup-IfocPlKr.js} +1 -1
- package/dist/assets/{spaces-BhyNdJUR.js → spaces-CoMtZGNH.js} +1 -1
- package/dist/assets/{start-C4D5Pzw8.js → start-CtfSNTEq.js} +1 -1
- package/dist/assets/{starting-progress-lkMq6cOR.js → starting-progress-BTBrLO78.js} +1 -1
- package/dist/assets/{status-eTkWlbrh.js → status-DYzeHwu5.js} +1 -1
- package/dist/assets/{step-actions-vRB4cPjs.js → step-actions-CJGBq_RL.js} +1 -1
- package/dist/assets/{studio-1TB86ZrO.js → studio-cTiQkJ_r.js} +1 -1
- package/dist/assets/{switch-control-BSK_y5_P.js → switch-control-AvyGKeHh.js} +1 -1
- package/dist/assets/{table-tips-Da_IM0mp.js → table-tips-1QxzlCjR.js} +1 -1
- package/dist/assets/{team-cktMvdm0.js → team-B8B1ZhIQ.js} +1 -1
- package/dist/assets/{th-DmSMYMH5.js → th-DuqieD90.js} +1 -1
- package/dist/assets/{traffic-h0HcpbzT.js → traffic-DqTwvxdl.js} +1 -1
- package/dist/assets/{transfer-B1a67F8a.js → transfer-Yhxjz3He.js} +1 -1
- package/dist/assets/{unsubscribe-CS5n7_0d.js → unsubscribe-D98i3Dcl.js} +1 -1
- package/dist/assets/{use-app-logo-CPHV51wY.js → use-app-logo-wJojGoX8.js} +1 -1
- package/dist/assets/{use-window-close-WM1XwCg5.js → use-window-close-Dxp_DCzQ.js} +1 -1
- package/dist/assets/{useLocalStorage-CKq67DKE.js → useLocalStorage-DyyYsV_-.js} +1 -1
- package/dist/assets/{user-center-CNEk-tbg.js → user-center-4QiBEXkz.js} +4 -4
- package/dist/assets/user-follower-daqBbJjL.js +32 -0
- package/dist/assets/{user-sessions-vBiV3ZpR.js → user-sessions-gPGe7NTf.js} +1 -1
- package/dist/assets/{util-BhLlQ2DE.js → util-6fgrHxDz.js} +1 -1
- package/dist/assets/{util-DgyQXNeO.js → util-BkJCSJXb.js} +1 -1
- package/dist/assets/{vendor-arcblock-DNHIum0y.js → vendor-arcblock-CzdgnaKl.js} +1 -1
- package/dist/assets/{vendor-ux-D0eHYGOw.js → vendor-ux-DnuP69h2.js} +1 -1
- package/dist/assets/{vi-CjDg6MoB.js → vi-42QzvOuM.js} +1 -1
- package/dist/assets/{wait-connect-a1iJrIWL.js → wait-connect-D0ORg2Ga.js} +1 -1
- package/dist/assets/{wizard-DJ-ny10T.js → wizard-C7eP8Bda.js} +1 -1
- package/dist/assets/{wizard-components-BTwaxDI2.js → wizard-components-CXkOVy_c.js} +2 -2
- package/dist/assets/wrap-locale-BARiwFz6.js +1 -0
- package/dist/assets/{zh-wVmF24jB.js → zh-Blu7Gys0.js} +1 -1
- package/dist/assets/{zh-DaR6QxjC.js → zh-C-k4DKK-.js} +1 -1
- package/dist/assets/{zh-DzdD_L9N.js → zh-D04z7ZNH.js} +1 -1
- package/dist/assets/{zh-tw-yfBxbyqP.js → zh-tw-BLENKI0o.js} +1 -1
- package/dist/assets/{zh-tw-DaxtX1HY.js → zh-tw-Dxa4oubT.js} +1 -1
- package/dist/index.html +3 -3
- package/dist/service-worker.js +1 -1
- package/package.json +31 -31
- package/dist/assets/engine-7LquCtMt.js +0 -1
- package/dist/assets/get-safe-url-DPk9Y1BS.js +0 -1
- package/dist/assets/index-CpGvMg-0.js +0 -124
- package/dist/assets/index-RVnyxqfr.js +0 -113
- package/dist/assets/localization-BZqBkopy.js +0 -1
- package/dist/assets/logger-CjTCwj01.js +0 -1
- package/dist/assets/profile-embed-pDRs_z78.js +0 -1
- package/dist/assets/sdk-jN4-Pc0q.js +0 -1
- package/dist/assets/user-follower-CKUYyDFI.js +0 -32
- package/dist/assets/wrap-locale-DVJLDD-_.js +0 -1
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import{j as e,y as St,bb as Re,M as ae,ak as x,Q as q,W as p,J as fe,c0 as Pt,I as N,aN as Rt,T as I,aj as It,b5 as Be,P as We,b6 as J,a5 as Oe,z as Qe,A as Ze,ci as Tt,bf as At,U as Ce,d5 as Mt,d6 as zt,at as te,d7 as Et,a6 as V,n as le,D as Lt,d8 as Bt,ar as De,b1 as Ie,d9 as Wt,aX as Ot,ai as Dt,am as X,bp as Nt,bq as ve,a$ as $t,cS as Ut}from"./vendor-mui-core-Bq_sfmbr.js";import{r as b,a as Ft,u as _t,j as qt}from"./vendor-react-Dvs43sk9.js";import{t as Je,Y as Ht,a6 as Gt,R as Ne,D as Kt,C as ce,n as Y,A as Yt}from"./vendor-utils-DQK0pEML.js";import{a as Vt,G as Qt,bw as Zt,c as Te,d as Jt,Y as Xt,bx as er,aZ as Ae,W as xe,bh as tr,by as rr,a5 as nr,a$ as or,a6 as sr,bz as ir}from"./index-Br7RGSFv.js";import{a as T,h as Xe,k as re,g as H,b as E,j as ar}from"./vendor-hooks-DLNZ8kxG.js";import{l as et}from"./arrow-down.svg-CeA5tsyp.js";import{G as Me,ab as D,T as O,aM as lr,O as tt,aN as cr,H as _,aO as dr,aP as ur,aQ as $e,J as pr,D as rt,I as ze,aR as fr,aS as M,a2 as xr,a1 as hr,$ as nt,aT as gr,aU as mr,a0 as br,C as de,a6 as Ue,ac as yr}from"./vendor-ux-D0eHYGOw.js";import{N as vr}from"./list-Dg6YcsMU.js";import{d as wr}from"./search-4YYphs0l.js";import{B as Fe}from"./bundle-avatar-bJGgXPJZ.js";import{h as _e,T as jr}from"./team-cktMvdm0.js";import{b as Cr,d as kr,a as Sr,c as Pr,e as Rr,f as Ir,h as Tr,_ as Ar}from"./user-center-CNEk-tbg.js";import{N as ot,U as st}from"./index-ejiOKw1E.js";import{u as Q}from"./use-mobile-C8UweHoJ.js";import Mr from"./index-sflWxhj_.js";import{f as ee}from"./index-DBs9Ljax.js";import{u as ke}from"./index-CcYh_TwI.js";import{U as we}from"./user-sessions-vBiV3ZpR.js";import zr from"./index-DCsimtEZ.js";import{o as Er}from"./vendor-arcblock-DNHIum0y.js";import{c as Lr,b as ue,a as Br,S as Wr}from"./index-O6p0L2t4.js";import"./index-C14bbQSS.js";import"./index-BojVbZw0.js";import{U as Or}from"./user-follower-CKUYyDFI.js";import"./lottie-web-4koyQiv_.js";import"./server-logo-notext.svg-CKQB0tIp.js";import"./index-JrJd98Of.js";import"./util-DgyQXNeO.js";import"./base32-DUdjIQpj.js";import"./session-Ba0-LWgc.js";import"./isURL-C56b9oXx.js";import"./use-app-logo-CPHV51wY.js";import"./index-CipehFwZ.js";import"./api-sewNv0AE.js";import"./table-tips-Da_IM0mp.js";import"./use-mobile-D2h0sedv.js";import"./passport-item-CRrICCXE.js";import"./did-address-CPLUdwKY.js";import"./index-DK4dVb7h.js";import"./vendor-mui-x-BbwECMfi.js";import"./AdapterDayjs-ffU9bx7e.js";import"./confirm-CV_ukxE_.js";import"./click-to-copy-r3y_3V-6.js";import"./delete-confirm-gyn7XAac.js";import"./permission-UQGu_-Cf.js";import"./actions-Cqn-jwqV.js";import"./index-DRYJ0xIl.js";function Dr(){let t=new Map;function s({root:o,rootMargin:n,threshold:l}){let i=t.get(o);i||(i=new Map,t.set(o,i));let a=JSON.stringify({rootMargin:n,threshold:l}),d=i.get(a);if(!d){let r=new Map;d={observer:new IntersectionObserver(f=>{f.forEach(m=>{r.get(m.target)?.(m)})},{root:o,rootMargin:n,threshold:l}),entryCallbacks:r},i.set(a,d)}return{observe:(r,f)=>{d.entryCallbacks.set(r,f),d.observer.observe(r)},unobserve:r=>{d.entryCallbacks.delete(r),d.observer.unobserve(r)}}}return{getObserver:s}}var Nr="0px",$r=[0],Ur=Dr();function Fr(t){let s=t?.rootMargin??Nr,o=t?.threshold??$r,n=b.useRef(null),l=b.useRef(null),i=b.useRef(null),[a,d]=b.useState(),r=b.useCallback(()=>{let C=n.current;if(!C){d(void 0);return}let v=Ur.getObserver({root:l.current,rootMargin:s,threshold:o});v.observe(C,c=>{d(c)}),i.current=v},[s,o]),f=b.useCallback(()=>{let C=i.current,v=n.current;v&&C?.unobserve(v),i.current=null},[]),m=b.useCallback(C=>{f(),n.current=C,r()},[r,f]),h=b.useCallback(C=>{f(),l.current=C,r()},[r,f]);return[m,{entry:a,rootRef:h}]}var _r=Fr;function qr(t){let[s,o]=_r(t),n=!!o.entry?.isIntersecting,[l,i]=b.useState(n);return n&&!l&&i(!0),[s,{...o,isVisible:n,wasEverVisible:l}]}var Hr=qr,Gr=100;function Kr({loading:t,hasNextPage:s,onLoadMore:o,rootMargin:n,disabled:l,delayInMs:i=Gr}){let a=b.useRef(o),[d,{rootRef:r,isVisible:f}]=Hr({rootMargin:n});b.useEffect(()=>{a.current=o},[o]);let m=!l&&!t&&f&&s;return b.useEffect(()=>{if(m){let h=setTimeout(()=>{a.current()},i);return()=>{clearTimeout(h)}}},[m,i]),[d,{rootRef:r}]}var Yr=Kr;const je={info:"#3B82F6",success:"#10B981",warning:"#F59E0B",error:"#EF4444"};pe.propTypes={severity:p.oneOf(["info","success","warning","error",""]).isRequired,size:p.number};function pe({severity:t,size:s=8}){return je[t]?e.jsx(x,{component:"span",sx:{display:"inline-block",width:s,height:s,borderRadius:"50%",backgroundColor:je[t]||je.info}}):null}it.propTypes={theme:p.string,type:p.oneOf(["button","line","select"]),onSelectType:p.func,extra:p.node,loading:p.bool,currentTab:p.oneOf(["info","success","warning","error",""])};function it({theme:t="dark",type:s="button",onSelectType:o,extra:n=void 0,currentTab:l="",loading:i=!1,...a}){const{t:d}=b.useContext(Me),r=[{label:d("notification.allSeverity"),value:""},{label:d("notification.severityType.info"),value:"info"},{label:d("notification.severityType.success"),value:"success"},{label:d("notification.severityType.warning"),value:"warning"},{label:d("notification.severityType.error"),value:"error"}],f=g=>{(g!==l||!i)&&o(g)},m=b.useMemo(()=>{const g={width:"100%",bgcolor:t==="dark"?"#F9FAFB":"",overflowY:"auto",paddingTop:s==="select"?"0":"5px",whiteSpace:"nowrap",borderRadius:0,display:"flex",justifyContent:"space-between",alignItems:"flex-end",flexWrap:"wrap",gap:"8px"};return s==="line"?Object.assign(g,{}):g},[s,t]),h=(g,S,R)=>e.jsx(q,{disabled:i,onClick:()=>f(g.value),className:`profile-button ${S?"active":""}`,...a,children:g.label},g.value||R),C=(g,S,R)=>e.jsx(q,{variant:"text",disabled:i,onClick:()=>f(g.value),className:`profile-line-button ${S?"active":""}`,...a,children:g.label},g.value||R),v=()=>r?.map((g,S)=>{const R=l===g?.value;return s==="line"?e.jsx(b.Fragment,{children:C(g,R,S)},g.value||S):e.jsx(b.Fragment,{children:h(g,R,S)},g.value||S)}),c=g=>{const{value:S}=g.target;f(S==="all"?"":S)};return s==="select"?e.jsx(St,{sx:{maxWidth:300},children:e.jsx(Re,{value:l||"all",onChange:c,size:"small",label:"Severity",IconComponent:g=>e.jsx(et,{...g,width:20,height:20}),MenuProps:{autoFocus:!1,PaperProps:{style:{maxHeight:400,overflowY:"auto",borderRadius:"8px",boxShadow:"0px 6px 24px rgba(0, 0, 0, 0.15)"}}},variant:"outlined",sx:{fieldset:{border:"none"}},children:r.map((g,S)=>e.jsx(ae,{value:g.value||"all",children:e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(pe,{severity:g.value}),g.label]})},g.value||S))})}):e.jsxs(x,{className:"severity-tabs",sx:m,children:[e.jsx(x,{sx:{...s==="line"?{flex:1,borderBottom:"1px solid",borderColor:"grey.200"}:{display:"flex",gap:"24px"}},children:v()}),n]})}at.propTypes={paging:p.objectOf(p.any).isRequired,loading:p.bool.isRequired,onChange:p.func.isRequired};function at({loading:t,paging:s,onChange:o}){const{t:n}=b.useContext(Me),l=fe(r=>r.breakpoints.down("md"));if(s.pageCount<=0||l)return null;const i=(r,f)=>{o({page:f+1})},a=r=>{const f=Number(r.target.value);o({page:1,pageSize:f})},d=s.page-1<=0?0:s.page-1;return e.jsx(x,{className:"notification-pagination",sx:{mt:2,display:"flex",justifyContent:"flex-end"},children:e.jsx(Pt,{component:"div",disabled:t,count:s.total,page:d,rowsPerPageOptions:[10,20,50,100],labelRowsPerPage:n("pagination.rowsPerPage"),labelDisplayedRows:({from:r,to:f,count:m})=>`${r}–${f} / ${m!==-1?m:`${n()}more than ${f}`}`,rowsPerPage:s.pageSize,onPageChange:i,onRowsPerPageChange:a})})}const Vr=b.memo(at),Qr={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4h16v2.172a2 2 0 0 1-.586 1.414L15 12v7l-6 2v-8.5L4.52 7.572A2 2 0 0 1 4 6.227V4z"/>'},qe=6,He={"& .MuiCheckbox-root":{padding:"4px"},"& .MuiCheckbox-root .MuiSvgIcon-root":{fontSize:"1.35rem"},"& .MuiCheckbox-root:not(.Mui-checked)":{color:"divider"},"& .MuiCheckbox-root.Mui-checked":{color:"primary.main"},"& .MuiCheckbox-root .css-i4bv87-MuiSvgIcon-root":{width:"1.1em",height:"1.1em"},"& .MuiCheckbox-root svg":{stroke:"divider",strokeWidth:.7}},Zr={border:"1px solid",borderColor:"divider",borderRadius:1,overflow:"hidden",backgroundColor:"background.paper",backgroundImage:"none",transition:"all 0.2s ease-in-out"},Ge=()=>({...Zr,width:"calc(50% - 8px)"});lt.propTypes={loading:p.bool,type:p.oneOf(["server","service"]),onFilterChange:p.func,blockletMap:p.object,filterType:p.oneOf(["component","entity"]),selectedId:p.array,severity:p.array,enableMarkAllAsRead:p.bool,unReadCount:p.number,onReadFilterChange:p.func,currentReadFilter:p.string};function lt({onFilterChange:t=()=>{},loading:s=!1,type:o="service",blockletMap:n={},filterType:l="component",selectedId:i=[],severity:a=[],enableMarkAllAsRead:d=!0,unReadCount:r=0,onReadFilterChange:f=()=>{},currentReadFilter:m="all"}){const{t:h}=b.useContext(Me),[C,v]=b.useState(null),c=!!C,[g,S]=b.useState(i),[R,P]=b.useState(a),[y,z]=b.useState(!1),[L,U]=b.useState(""),[j,k]=b.useState([]);b.useEffect(()=>{S(i),P(a)},[i,a]);const B=[{label:h("notification.filterType.all"),value:"all"},{label:h("notification.filterType.unread"),value:"unread"}],G=u=>{(u!==m||!s)&&f(u)},Z=[{label:h("notification.severityType.info"),value:"info"},{label:h("notification.severityType.success"),value:"success"},{label:h("notification.severityType.warning"),value:"warning"},{label:h("notification.severityType.error"),value:"error"}],ne=u=>{v(u.currentTarget),U(""),z(!1)},ge=()=>{v(null)},oe=u=>{const w=g.includes(u)?g.filter(A=>A!==u):[...g,u];S(w),t({id:w,severity:R})},se=u=>{const w=R.includes(u)?R.filter(A=>A!==u):[...R,u];P(w),t({severity:w,id:g})},me=u=>{U(u.target.value)},be=()=>{z(!y)},K=Ft.useMemo(()=>{if(!n.size)return[];const u=[];return l==="component"&&u.push({label:h("notification.system"),id:"system"}),Array.from(n).forEach(([,w])=>{const A=w.did||w.meta?.did,W=w.title||w.meta?.title||"",F=w.appPid||w.appDid;(l==="component"&&F!==A||l==="entity"&&F===A)&&u.push({label:W,id:A,blocklet:w,ancestors:w.ancestors})}),u},[n,l,h]);b.useEffect(()=>{if(L.trim()==="")k(K);else{const u=L.toLowerCase(),w=K.filter(A=>A.label.toLowerCase().includes(u));k(w)}},[L,K]);const ye=L.trim()!==""||y?j:j.slice(0,qe);return e.jsxs(x,{children:[e.jsxs(x,{sx:{display:"flex",justifyContent:d?"space-between":"flex-end",alignItems:"flex-start",flexWrap:"wrap",gap:1},children:[d&&e.jsx(x,{sx:{display:"flex",gap:1.5},children:B.map(u=>e.jsxs(q,{disabled:s,onClick:()=>G(u.value),className:`profile-button ${m===u.value?"active":""}`,sx:{...o==="service"&&m===u.value?{color:"secondary.main"}:{},color:"red",fontWeight:m===u.value?"bold":"normal"},children:[u.label,u.value==="unread"&&r>0&&` (${r})`]},u.value))}),e.jsxs(x,{sx:{display:"flex",justifyContent:"flex-end",gap:2},children:[e.jsx(N,{size:"small",onClick:ne,disabled:s,sx:{minWidth:"auto",borderRadius:1,border:"1px solid",borderColor:"divider","&:hover":{backgroundColor:"action.hover"}},children:e.jsx(D,{icon:Qr,hFlip:!0})}),e.jsx(Rt,{open:c,anchorEl:C,onClose:ge,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{paper:{sx:{p:3,width:450,maxHeight:500,overflowY:"auto",backgroundColor:"background.paper",backgroundImage:"none",borderRadius:1,boxShadow:"0px 6px 24px rgba(0, 0, 0, 0.15)"}}},children:e.jsxs(x,{children:[e.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2,height:"28px"},children:[e.jsx(I,{variant:"subtitle1",sx:{fontWeight:"bold"},children:h("notification.severity")}),e.jsx(x,{sx:{minWidth:"60px",display:"flex",justifyContent:"flex-end"},children:(g.length>0||R.length>0)&&e.jsx(q,{size:"small",onClick:()=>{S([]),P([]),t({severity:[],id:[]})},startIcon:e.jsx(It,{fontSize:"small"}),sx:{color:"text.secondary",textTransform:"none",minWidth:"auto","&:hover":{backgroundColor:"transparent"},"& .MuiButton-startIcon":{marginRight:"2px"}},children:h("notification.clear")})})]}),e.jsx(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(Be,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:2,flex:1},children:Z.map(u=>e.jsx(We,{elevation:0,sx:Ge(R.includes(u.value)),children:e.jsx(J,{sx:{margin:0,padding:.5,width:"100%","& .MuiFormControlLabel-label":{display:"flex",alignItems:"center",gap:1,fontSize:"0.875rem"},...He},control:e.jsx(Oe,{checked:R.includes(u.value),onChange:()=>se(u.value),disabled:s,size:"small"}),label:e.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:.5},children:[e.jsx(pe,{severity:u.value}),u.label]})})},u.value))})}),e.jsxs(x,{sx:{mb:2},children:[e.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:2,mb:1.5},children:[e.jsx(I,{variant:"subtitle1",sx:{fontWeight:"bold",width:"calc(100% - 36px)"},children:h("notification.from")}),e.jsx(x,{sx:{display:"flex",alignItems:"center",width:"calc(100% - 36px)"},children:e.jsx(Qe,{size:"small",placeholder:"search",value:L,onChange:me,sx:{width:"100%","& .MuiOutlinedInput-input":{padding:"6px 4px 6px 0"},".MuiOutlinedInput-root":{"&:hover":{fieldset:{borderColor:"divider"}},"&.Mui-focused":{fieldset:{borderColor:"divider"}}},fieldset:{borderColor:"divider"}},slotProps:{input:{size:"small",startAdornment:e.jsx(Ze,{position:"start",sx:{marginRight:"2px"},children:e.jsx(D,{icon:wr})})}}})})]}),e.jsx(Be,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:2},children:ye.map(u=>e.jsx(We,{elevation:0,sx:Ge(g.includes(u.id)),children:e.jsx(J,{sx:{margin:0,padding:.5,width:"100%","& .MuiFormControlLabel-label":{fontSize:"0.875rem",width:"calc(100% - 36px)"},...He},control:e.jsx(Oe,{checked:g.includes(u.id),onChange:()=>oe(u.id),disabled:s,size:"small"}),label:e.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:.5,minWidth:0,width:"100%"},children:[u.blocklet&&e.jsx(Fe,{size:20,blocklet:u.blocklet,ancestors:u.ancestors,style:{borderRadius:4,flexShrink:0}}),e.jsx(I,{noWrap:!0,variant:"body2",component:"span",title:u.label,sx:{flex:1,overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%"},children:u.label})]})})},u.id))}),j.length>qe&&L.trim()===""&&e.jsx(q,{fullWidth:!0,size:"small",onClick:be,sx:{mt:1},endIcon:y?e.jsx(Tt,{}):e.jsx(At,{})})]})]})})]})]}),g.length>0||R.length>0?e.jsxs(x,{className:"notification-filter-content",sx:{display:"flex",flexWrap:"wrap",gap:1,mt:2},children:[R.map(u=>{const w=Z.find(A=>A.value===u);return e.jsx(Ce,{label:e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx(pe,{severity:u}),w?w.label:u]}),onDelete:()=>se(u),size:"small",variant:"outlined",sx:{borderRadius:2,color:"text.secondary",borderColor:"divider","& .MuiChip-label":{display:"flex",alignItems:"center"}}},`severity-${u}`)}),g.map(u=>{const w=K.find(A=>A.id===u);return e.jsx(Ce,{label:e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:.5},children:[w?.blocklet&&e.jsx(Fe,{size:16,blocklet:w.blocklet,ancestors:w.ancestors,style:{borderRadius:4,flexShrink:0}}),w?w.label:u]}),variant:"outlined",onDelete:()=>oe(u),size:"small",sx:{borderRadius:2,color:"text.secondary",borderColor:"divider","& .MuiChip-label":{display:"flex",alignItems:"center"}}},`component-${u}`)})]}):null]})}const Jr=te(Et)`
|
|
2
|
-
position: fixed;
|
|
3
|
-
bottom: 20px;
|
|
4
|
-
right: 20px;
|
|
5
|
-
z-index: 1000;
|
|
6
|
-
@media (max-width: 600px) {
|
|
7
|
-
bottom: 16px;
|
|
8
|
-
right: 16px;
|
|
9
|
-
transform: scale(0.9);
|
|
10
|
-
}
|
|
11
|
-
`;function Xr(){const[t,s]=b.useState(!1);b.useEffect(()=>{const n=Je(()=>{s(window.pageYOffset>300)},200);return window.addEventListener("scroll",n),n(),()=>window.removeEventListener("scroll",n)},[]);const o=()=>{try{"scrollTo"in window?window.scrollTo({top:0,behavior:"smooth"}):window.scrollTo(0,0)}catch{window.scrollTo(0,0)}};return e.jsx(Mt,{in:t,children:e.jsx(Jr,{color:"primary",size:"small","aria-label":"scroll back to top",onClick:o,children:e.jsx(zt,{})})})}const en=te.div`
|
|
12
|
-
display: flex;
|
|
13
|
-
flex-direction: column;
|
|
14
|
-
gap: ${t=>t.inDialog?0:"24px"};
|
|
15
|
-
.MuiContainer-root {
|
|
16
|
-
padding-right: 0;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
.profile-button.MuiButtonBase-root {
|
|
20
|
-
border-radius: 9999px;
|
|
21
|
-
margin-right: 2px;
|
|
22
|
-
padding: 5px 12px;
|
|
23
|
-
line-height: 22px;
|
|
24
|
-
font-size: 13px;
|
|
25
|
-
border: 1px solid transparent;
|
|
26
|
-
background-color: ${({theme:t})=>t.palette.background.default};
|
|
27
|
-
color: ${({theme:t})=>t.palette.text.primary};
|
|
28
|
-
font-weight: 400;
|
|
29
|
-
border: 1px solid ${({theme:t})=>t.palette.divider} !important;
|
|
30
|
-
}
|
|
31
|
-
.profile-button.active.MuiButtonBase-root,
|
|
32
|
-
.profile-button.active.MuiButtonBase-root:hover {
|
|
33
|
-
color: ${({theme:t})=>t.palette.primary.main};
|
|
34
|
-
font-weight: 600;
|
|
35
|
-
background-color: ${({theme:t})=>le(t.palette.primary.main,.1)};
|
|
36
|
-
border: 1px solid ${({theme:t})=>le(t.palette.primary.main,.24)} !important;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.profile-button.MuiButtonBase-root:hover {
|
|
40
|
-
background-color: rgba(0, 0, 0, 0.04);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.profile-line-button.MuiButtonBase-root {
|
|
44
|
-
margin-right: 2px;
|
|
45
|
-
color: ${({theme:t})=>t.palette.text.secondary};
|
|
46
|
-
padding: 5px 12px;
|
|
47
|
-
line-height: 22px;
|
|
48
|
-
font-size: 13px;
|
|
49
|
-
border: none !important;
|
|
50
|
-
border-radius: 0;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.profile-line-button.active.MuiButtonBase-root {
|
|
54
|
-
color: ${({theme:t})=>t.palette.text.primary};
|
|
55
|
-
border-bottom: 1px solid ${({theme:t})=>t.palette.text.primary} !important;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.profile-button.MuiButtonBase-root:last-of-type,
|
|
59
|
-
.profile-line-button.MuiButtonBase-root {
|
|
60
|
-
margin-right: 0;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.profile-line-button.MuiButtonBase-root:hover {
|
|
64
|
-
color: ${({theme:t})=>t.palette.text.primary};
|
|
65
|
-
background-color: unset;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
* {
|
|
69
|
-
scrollbar-width: none; /* Firefox */
|
|
70
|
-
-ms-overflow-style: none; /* IE and Edge */
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
*::-webkit-scrollbar {
|
|
74
|
-
display: none; /* Chrome, Safari and Opera */
|
|
75
|
-
}
|
|
76
|
-
`;ct.propTypes={blocklets:p.array,context:p.object,pagination:p.bool,inDialog:p.bool,filterType:p.oneOf(["component","entity"]),toViewAll:p.func,type:p.oneOf(["server","service"])};function ct({blocklets:t=[],context:s,pagination:o=!0,inDialog:n=!1,filterType:l="component",toViewAll:i=()=>{},type:a="service"}){const{data:d,paging:r,refresh:f,loading:m,params:h,onReadNotification:C,componentDids:v,filterUnReadCount:c,initial:g}=s,S=u=>{f({...h,severity:u&&typeof u=="string"?[u]:u||[],paging:{...h.paging,page:1}})},[R]=_t(),P=T(()=>R.get("id"),[R]),y=fe(u=>u.breakpoints.down("md")),[z,L]=b.useState(0),[U,j]=b.useState(!1),k=b.useMemo(()=>h.read===!1?"unread":"all",[h.read]),B=T(()=>Je(u=>{if(m)return;const w=d.length,A=d.filter(F=>!_e(F)).length;let W={...h,append:!0,paging:{...h.paging,...u,currentPage:(r.currentPage||0)+1}};k==="unread"&&A<w&&u.page>h.paging.page&&(W={...h,append:!0,paging:{...h.paging,...u,page:h.paging.page||1,currentPage:(r.currentPage||0)+1}}),f(W)},500),[d,h,k,r,m,f]);Xe(()=>{g&&typeof g=="function"&&g()}),b.useEffect(()=>{(!r.currentPage||r.currentPage===1)&&L(r.total)},[r.total,r.currentPage]),b.useEffect(()=>{setTimeout(()=>{const u=document.getElementById(P);u&&u.scrollIntoView({behavior:"smooth",block:"center"}),j(!0)},100),setTimeout(()=>{j(!1)},3e3)},[P]);const G=T(()=>d?.length>0&&d.length<z,[d,z]),Z=b.useCallback(u=>{const{blocklet:w={}}=window,A=[w?.did,...(w?.ancestors||[]).map(W=>W)];return v?.includes(u)||A.findIndex(W=>W===u)>-1},[v]),ne=b.useMemo(()=>{const u=new Map;return t.length&&t.forEach(w=>{const A=w?.did||w.meta?.did;A&&!u.has(A)&&(w.ancestors=[],u.set(A,w),w?.alsoKnownAs?.length>0&&w.alsoKnownAs.forEach(W=>{u.has(W)||u.set(W,w)})),w?.children?.length>0&&w.children.forEach(W=>{const F=W?.did||W.meta?.did;F&&!u.has(F)&&Z(F)&&(W.ancestors=[w],u.set(F,W))})}),u},[t,Z]),ge=b.useCallback(()=>{m||B({page:r.page+1})},[r.page,m,B]),[oe]=Yr({loading:m,hasNextPage:G,onLoadMore:ge}),se=u=>{!u||_e(u)||C(u.id).then(()=>{n&&i()})},me=({severity:u,id:w})=>{if(m)return;let A={};l==="component"?A={entityId:[],componentDid:w}:l==="entity"&&(A={componentDid:[],entityId:w}),f({...h,severity:u,...A,paging:{...h.paging,page:1}})},be=u=>{if(m)return;let w={...h,paging:{...h.paging,page:1}};u==="unread"?(w.read=!1,w.paging.currentPage=1):w=Ht(w,"read"),f(w)},K=T(()=>l==="component"?Array.isArray(h.componentDid)?h.componentDid:[]:l==="entity"?Array.isArray(h.entityId)?h.entityId:[]:[],[h,l]),ye=T(()=>(Array.isArray(h.severity)?h.severity:[])[0]||"",[h.severity]);return e.jsxs(en,{inDialog:!!n,children:[n?e.jsx(it,{currentTab:ye,type:"line",theme:"light",onSelectType:S}):e.jsx(lt,{loading:m,blockletMap:ne,unReadCount:c,filterType:l,type:a,selectedId:K,onFilterChange:me,severity:h.severity,onReadFilterChange:be,currentReadFilter:k}),!y&&m?e.jsx(x,{sx:{display:"flex",width:"100%",minHeight:400,justifyContent:"center",alignItems:"center"},children:e.jsx(V,{})}):e.jsx(vr,{data:d,blockletMap:ne,onReadNotification:se,onReadBatch:C,inDialog:n,highlightId:P,highlight:!n&&U,type:a}),o&&!y?e.jsx(Vr,{loading:m,paging:r,onChange:B}):null,o&&y&&(m||G)?e.jsx(x,{ref:oe,sx:{display:"flex",width:"100%",minHeight:100,justifyContent:"center",alignItems:"center"},children:e.jsx(V,{})}):null,!n&&y?e.jsx(Xr,{}):null]})}const tn=b.memo(ct),$=new Zt;function he(t){const{userDid:s=""}={},{session:o}=Vt(),n=T(()=>{if(s)return s;const r=window.location.href,f=Gt(r);return f?.did?Array.isArray(f.did)?f.did[0]:f.did:o?.user?.did},[o?.user?.did,s]),l=T(()=>o.user,[o]),i=T(()=>l?n===l?.did:!1,[n,l?.did]),a=re(async()=>{if(await Qt(()=>o?.initialized),i)return o.user;if(n)return $.user.getUserPublicInfo({did:n})},{refreshDeps:[n,i,o?.initialized,l]}),d=T(()=>l.passports?.some(r=>r.role===Te.ROLES.OWNER),[l]);return{currentDid:n,session:o,isMyself:i,user:l,viewUser:a.data,isOwner:d}}function dt({user:t,...s}){const{t:o}=O(),n=Lt(),l=T(()=>{const d=(t?.passports||[]).map(r=>({...r,revoked:r.status===lr.REVOKED}));return d.sort((r,f)=>r.revoked===f.revoked?0:r.revoked?1:-1),Ne(d.filter(r=>!r.display),"role").concat(Ne(d.filter(r=>r.display),"display.content"))},[t?.passports]),i=T(()=>l?.find(d=>d.name===t.role),[l,t?.role]),a=n.palette.primary.main;return l.length===0?e.jsx(x,{children:e.jsx(tt,{children:o("userCenter.noPassport")})}):e.jsx(x,{...s,sx:{display:"grid",justifyItems:"start",gridTemplateColumns:{xs:"repeat(2, 1fr)",sm:"repeat(2, 1fr)",md:"repeat(3, 1fr)",lg:"repeat(5, 1fr)"},gap:2.5,...s.sx},children:l.map(d=>e.jsx(Cr,{passport:d,user:t,color:window.blocklet.passportColor,createPassportSvg:Jt,title:i&&i.role===d.role?o("userCenter.currentPassport"):"",sx:{flexDirection:"column",alignItems:"center",gap:1,".passport-item__display":{width:166,height:166,borderRadius:1,px:2,display:"flex",justifyContent:"center",backgroundColor:"grey.50",boxShadow:i&&i.role===d.role?`0px 2px 4px 0px ${a}, 0px 1px 2px -1px ${a}, 0px 0px 0px 1px ${a} !important`:"unset"},".passport-item__body":{marginLeft:"0 !important"}}},d.id))})}dt.propTypes={user:p.object.isRequired};function rn({visible:t,onClose:s,nft:o}){return!t||!o?null:e.jsx(nn,{children:e.jsx(Bt,{open:t,onClose:s,children:e.jsx(on,{onClick:s,children:e.jsx(ot,{data:st(o),address:o.address,inset:!0})})})})}const nn=te.div`
|
|
77
|
-
position: relative;
|
|
78
|
-
width: 100%;
|
|
79
|
-
height: 100%;
|
|
80
|
-
cursor: pointer;
|
|
81
|
-
|
|
82
|
-
&:hover {
|
|
83
|
-
.mask {
|
|
84
|
-
opacity: 1;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.mask {
|
|
89
|
-
position: absolute;
|
|
90
|
-
top: 0;
|
|
91
|
-
left: 0;
|
|
92
|
-
display: flex;
|
|
93
|
-
align-items: center;
|
|
94
|
-
justify-content: center;
|
|
95
|
-
width: 100%;
|
|
96
|
-
height: 100%;
|
|
97
|
-
background: rgba(0, 0, 0, 0.6);
|
|
98
|
-
opacity: 0;
|
|
99
|
-
transition: opacity 0.2s;
|
|
100
|
-
}
|
|
101
|
-
`,on=te.div`
|
|
102
|
-
display: flex;
|
|
103
|
-
justify-content: center;
|
|
104
|
-
align-items: center;
|
|
105
|
-
height: 100vh;
|
|
106
|
-
width: 100vw;
|
|
107
|
-
|
|
108
|
-
img,
|
|
109
|
-
object {
|
|
110
|
-
max-width: 90vw;
|
|
111
|
-
max-height: 75vh;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
.nft-display--inset {
|
|
115
|
-
> .MuiBox-root,
|
|
116
|
-
.nft-display__loading {
|
|
117
|
-
width: 75vmin;
|
|
118
|
-
height: 75vmin;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
`,sn=t=>({position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.6)",opacity:0,transition:"opacity 0.3s ease-in-out",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1,"& .mask-item":{backgroundColor:le(t.palette.background.paper,.9),color:"text.primary","&:hover":{backgroundColor:le(t.palette.background.paper,1)}}}),an={position:"absolute",bottom:0,left:0,right:0,height:24,backgroundColor:"rgba(0, 0, 0, 0.6)",display:"flex",alignItems:"center",justifyContent:"center",color:"white",gap:1,zIndex:1,"& .mask-item":{width:20,height:20,color:"white"}},Ke="https://main.abtnetwork.io/explorer";function ut({user:t}){const{t:s}=O(),o=Q(),[n,l]=b.useState({visible:!1,nft:null}),[i,a]=b.useState({anchorEl:null,props:null}),d=P=>{const y=ce(Ke,"assets",P);window.open(y,"_blank")},r=(P,y)=>{let z="";typeof y.data?.value=="string"?z=JSON.parse(y.data?.value)?.domain:z=y.data?.value?.domain,a({anchorEl:P,props:{title:z?`Hey, I just won an NFT at the ${z} event!`:"Hey, I just won an NFT!",url:ce(Ke,"assets",y.address)}})},f=P=>{l({visible:!0,nft:P})},m=H({page:1,size:20}),h=re(async(P=m)=>(await Kt.get(`${Te.WELLKNOWN_SERVICE_PATH_PREFIX}/ocap/listAssets`,{params:{ownerAddress:t.did,...P}})).data,{ready:t?.did&&m,defaultParams:[m],refreshDeps:[t?.did,m]}),{loading:C,data:v}=h,c=v?.page??{cursor:0,next:!1,total:0},g=(P,y)=>{m.page=y,h.run(m)},S=E(P=>[e.jsx(N,{size:"small",className:"mask-item",onClick:y=>{y.stopPropagation(),d(P.address)},children:e.jsx(D,{icon:"tabler:link",fontSize:18})},"link"),e.jsx(N,{size:"small",onClick:y=>{y.stopPropagation(),r(y.currentTarget,P)},className:"mask-item",children:e.jsx(D,{icon:"tabler:share-2",fontSize:18})},"share"),e.jsx(N,{size:"small",onClick:y=>{y.stopPropagation(),f(P)},className:"mask-item",children:e.jsx(D,{icon:"tabler:eye",fontSize:18})},"view")]),R=T(()=>{if(C){const P=["skeleton-1","skeleton-2","skeleton-3","skeleton-4","skeleton-5"].map(y=>e.jsx(De,{variant:"rectangular",width:"15%",height:166,sx:{borderRadius:1,flexShrink:0}},y));return e.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:2},children:[e.jsx(De,{width:"20%"}),e.jsx(x,{sx:{display:"flex",flexDirection:"row",gap:2,flexWrap:"nowrap"},children:P})]})}return e.jsxs(e.Fragment,{children:[e.jsx(I,{sx:{color:"grey.A700",fontWeight:600,mb:2.5},children:s("userCenter.common.nft")}),v?.assets?.length===0&&!C&&e.jsx(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",height:"100%"},children:e.jsx(tt,{children:s("userCenter.common.noNFT")})}),e.jsx(x,{className:"nft-list-wrapper",sx:{display:"grid",justifyItems:"start",gridTemplateColumns:{xs:"repeat(2, 1fr)",sm:"repeat(3, 1fr)",md:"repeat(3, 1fr)",lg:"repeat(5, 1fr)"},gap:2.5},children:v?.assets?.map(P=>e.jsxs(x,{sx:{flexShrink:0,width:{xs:120,sm:120,md:120,lg:166},height:{xs:120,sm:120,md:120,lg:166},position:"relative",borderRadius:1,overflow:"hidden",cursor:"pointer",...o?{}:{"&:hover .mask":{opacity:1}}},children:[e.jsx(ot,{data:st(P),address:P.address,inset:!0,imageFilter:{imageFilter:"resize",w:"500",f:"webp"}}),o?e.jsx(x,{className:"footer-mask",sx:an,children:S(P)}):e.jsx(x,{className:"mask",sx:sn,children:e.jsx(Ie,{direction:"row",spacing:1,children:S(P)})})]},P.address))}),c.next||m.page>1?e.jsx(Wt,{sx:{display:"flex",justifyContent:"center",mt:2},page:m.page,onChange:g,count:Math.ceil(c.total/m.size),size:"small"}):null,e.jsx(rn,{visible:n.visible&&!!n.nft,nft:n.nft,onClose:()=>{l({visible:!1,nft:null})}}),e.jsx(cr,{anchorEl:i.anchorEl,onClose:()=>{a({anchorEl:null,props:null})},sharedProps:i.props||{title:"",url:""}})]})},[C,c,m.page,m.size,g,i,n]);return e.jsx(x,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2,mb:5},children:R})}ut.propTypes={user:p.object.isRequired};function ln(){const{t}=O(),{user:s,isMyself:o,viewUser:n}=he();return e.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:2.5},children:[o?e.jsxs(x,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1.5,p:2},children:[e.jsx(I,{sx:{color:"text.primary",fontWeight:600,mb:2.5},children:t("userCenter.passport")}),e.jsx(dt,{user:s})]}):null,e.jsx(ut,{user:o?s:n})]})}const cn=[{name:"English",code:"en"},{name:"中文",code:"zh"}];function pt({user:t,onSave:s}){const{t:o,changeLocale:n}=O(),l=H({locale:t.locale,loading:!1}),i=E(async a=>{try{const{value:d}=a.target;l.loading=!0,await $.user.saveProfile({locale:d}),await s("profile"),n(d),l.locale=d}catch(d){_.error(ee(d))}finally{l.loading=!1}});return e.jsxs(x,{sx:{gap:1,display:"grid",alignItems:"center",gridTemplateColumns:{xs:"1fr",sm:"max-content 1fr"}},children:[e.jsx(x,{children:o("userCenter.commonSetting.locale")}),e.jsx(x,{children:e.jsx(Re,{value:l.locale,onChange:i,size:"small",IconComponent:a=>e.jsx(et,{...a,width:20,height:20}),sx:{minWidth:200,"&:hover":{"fieldset.MuiOutlinedInput-notchedOutline":{borderColor:"divider"}},fieldset:{borderColor:"divider"}},children:(window.blocklet.languages||cn).map(a=>e.jsx(ae,{value:a.code,children:a.name},a.code))})})]})}pt.propTypes={user:p.shape({locale:p.string}).isRequired,onSave:p.func.isRequired};function Se({onTest:t=Y,onDelete:s=Y,onSave:o=Y,onCancel:n=Y,type:l="slack",url:i="",edit:a=!1}){const{t:d}=O(),r=H({type:l||"slack",url:i||"",edit:a??!1,error:"",loading:!1}),f=E(()=>r.url?Xt(r.url)?(r.error="",!0):(r.error=d("common.invalid"),!1):(r.error=d("common.required"),!1)),m=E(()=>{r.edit=!1,r.url=i||"",r.type=l||"slack",r.error="",r.loading=!1,n()}),h=E(async c=>{r.loading=!0,await t(c),r.loading=!1}),C=E(c=>()=>{f()&&c({type:r.type,url:r.url})}),v=T(()=>r.error?e.jsx(I,{component:"span",color:"error",children:r.error}):r.edit?r.loading?e.jsx(V,{size:16}):e.jsx(N,{size:"small",onClick:C(h),sx:{mr:-1},children:e.jsx(D,{icon:kr})}):null,[r.error,r.edit,r.loading]);return e.jsxs(x,{sx:{display:"flex",gap:1.5,width:"100%",alignItems:{xs:"flex-start",md:"center"},flexDirection:{xs:"column",md:"row"}},children:[e.jsxs(Re,{sx:{borderRadius:1,"&.Mui-disabled":{backgroundColor:"grey.50"}},disabled:!r.edit||r.loading,size:"small",value:r.type,onChange:c=>{r.type=c.target.value},children:[e.jsx(ae,{value:"api",children:d("userCenter.webhook.url")}),e.jsx(ae,{value:"slack",children:d("userCenter.webhook.slack")})]}),e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:.5,width:"100%"},children:[e.jsx(Qe,{sx:{flex:1,".MuiInputBase-root":{borderRadius:1,"&.Mui-disabled":{backgroundColor:"grey.50"}}},disabled:!r.edit||r.loading,fullWidth:!0,size:"small",required:!0,value:r.url,onChange:c=>{r.url=c.target.value,f()},error:!!r.error,slotProps:{input:{endAdornment:e.jsx(Ze,{position:"end",children:v})}}}),e.jsx(x,{sx:{display:"flex",gap:.5},children:r.edit?e.jsxs(e.Fragment,{children:[e.jsx(N,{color:"success",onClick:C((...c)=>{o(...c),r.edit=!1}),sx:{borderRadius:1,border:"1px solid",borderColor:"grey.200"},children:e.jsx(D,{icon:dr})}),e.jsx(N,{color:"error",onClick:m,sx:{borderRadius:1,border:"1px solid",borderColor:"grey.200"},children:e.jsx(D,{icon:ur})})]}):e.jsxs(e.Fragment,{children:[e.jsx(N,{onClick:()=>{r.edit=!0},sx:{borderRadius:1,border:"1px solid",borderColor:"grey.200"},children:e.jsx(D,{icon:Sr})}),e.jsx(N,{color:"error",onClick:()=>{s({type:r.type,url:r.url})},sx:{borderRadius:1,border:"1px solid",borderColor:"grey.200"},children:e.jsx(D,{icon:Pr})})]})})]})]})}Se.propTypes={onTest:p.func,onDelete:p.func,onSave:p.func,onCancel:p.func,type:p.oneOf(["api","slack"]),url:p.string,edit:p.bool};function ie({title:t=void 0,description:s=void 0,value:o,onChange:n,isMobile:l}){const i=E(a=>{a.stopPropagation()});return e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(ke,{checked:o,size:"small",onChange:n}),e.jsxs(I,{component:"div",onClick:i,sx:{color:"text.primary",fontSize:14,display:"flex",flexWrap:l?"wrap":"nowrap",columnGap:1,flex:1,whiteSpace:l?"normal":"nowrap"},children:[t,s]})]})}ie.propTypes={title:p.string,description:p.node,value:p.bool.isRequired,onChange:p.func.isRequired,isMobile:p.bool.isRequired};function ft({user:t,isMobile:s}){const{t:o}=O(),n=H({showAdd:!1}),l=re(async()=>await $.user.getUserNotificationConfig(),{refreshDeps:[t],loadingDelay:300}),i=T(()=>({wallet:!0,email:!0,phone:!1,push:!0,...l?.data?.notifications||{}}),[l?.data?.notifications]),a=T(()=>l?.data?.webhooks||[],[l?.data?.webhooks]),d=E(async v=>{try{await $.user.saveUserNotificationConfig(v),_.success(o("userCenter.saveSuccess")),l.run()}catch(c){_.error(ee(c))}}),r=E(async(v,c)=>{await d({notifications:{[v]:c}})}),f=async v=>{try{await $.user.testNotificationWebhook(v),_.success(o("userCenter.webhookTested"))}catch(c){_.error(ee(c))}},m=E(async v=>{await d({webhooks:a.filter((c,g)=>g!==v)})}),h=E(async(v,c)=>{await d({webhooks:a.map((g,S)=>S===v?c:g)})}),C=E(async v=>{await d({webhooks:[...a,v]}),n.showAdd=!1});return l.error?e.jsx(Ot,{severity:"error",children:l.error.message}):l.loading||!l.data?e.jsx(x,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100px"},children:e.jsx(V,{})}):e.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:2},children:[e.jsxs(x,{sx:{display:"flex",flexDirection:"column",gap:1,alignItems:"start",".MuiFormControlLabel-root":{gap:1,m:0,flexDirection:{xs:"row-reverse",md:"row"},width:{xs:"100%",md:"unset"}},".MuiSwitch-track":{borderRadius:"100vw"},".MuiSwitch-thumb":{borderRadius:"100%"},".MuiSwitch-root.MuiSwitch-sizeSmall":{height:"20px",width:"36px",".MuiSwitch-thumb":{width:"16px",height:"16px"}}},children:[e.jsx(ie,{value:i.wallet,isMobile:s,title:o("userCenter.walletNotification"),onChange:v=>r("wallet",v.target.checked),description:$e(t)&&e.jsx(pr,{did:$e(t),showQrcode:!1,showAvatar:!s,copyable:!0,compact:!0,responsive:!0,startChars:s?2:6})}),e.jsx(ie,{value:i.email,isMobile:s,onChange:v=>r("email",v.target.checked),title:o("userCenter.emailNotification"),description:t?.email&&e.jsx(I,{component:"span",sx:{color:"text.secondary",fontSize:13},children:t?.email})}),e.jsx(ie,{isMobile:s,value:i.push,title:o("userCenter.pushNotification"),onChange:v=>r("push",v.target.checked)})]}),e.jsxs(Ie,{spacing:1.5,useFlexGap:!0,direction:"column",sx:{alignItems:"start"},children:[a.map((v,c)=>e.jsx(Se,{onTest:f,onDelete:()=>m(c),onSave:(...g)=>h(c,...g),type:v.type,url:v.url,edit:!1},`${c}_${v.url}`)),n.showAdd&&e.jsx(Se,{onTest:f,onCancel:()=>{n.showAdd=!1},onSave:(...v)=>C(...v),edit:!0},"add"),e.jsx(rt,{variant:"outlined",size:"small",sx:{color:"text.primary",borderColor:"divider","&:hover":{borderColor:"divider"},py:.5,borderRadius:1},startIcon:e.jsx(D,{icon:Rr}),onClick:()=>{n.showAdd=!0},children:o("userCenter.addWebhook")})]})]})}ft.propTypes={user:p.object.isRequired,isMobile:p.bool.isRequired};function Pe({children:t,...s}){const o=Q(),[n,l]=b.useState(!1),i=E(()=>{l(!n)});return b.useEffect(()=>{l(!1)},[o]),o?e.jsx(Dt,{onClickAway:()=>l(!1),children:e.jsx(X,{...s,disableFocusListener:!0,disableHoverListener:!0,disableTouchListener:!0,slotProps:{popper:{disablePortal:!0}},open:n,onClose:i,children:b.cloneElement(t,{onClick:i})})}):e.jsx(X,{...s,children:t})}Pe.propTypes={children:p.node.isRequired};function xt({item:t}){const s=ze(),{blocklet:o}=er(),{confirmApi:n,confirmHolder:l}=Ae(),i=H({loading:!1}),{t:a}=O(),{session:d}=b.use(xe),{bindOAuth:r,unbindOAuth:f,setBaseUrl:m,baseUrl:h}=d.useOAuth(),{disconnectPasskey:C,setTargetAppPid:v}=d.usePasskey(),c=T(()=>fr[t?.provider]||"unknown",[t?.provider]),g=E(y=>y?._bind?y.provider===M.WALLET&&y.did?a("userCenter.thirdPartyLogin.walletAccountCantRemove"):y.provider===M.PASSKEY&&s.arcSphere?a("userCenter.thirdPartyLogin.dontSupportRemoveinArcSphere"):y._mainProvider&&s.arcSphere?a("userCenter.thirdPartyLogin.mainProviderCantRemove"):"":""),S=E(async()=>{if(t?.provider===M.PASSKEY){await new Promise((y,z)=>{n.open({title:a("userCenter.thirdPartyLogin.disconnectPasskey",{name:c}),content:a("userCenter.thirdPartyLogin.disconnectPasskeyDescription",{name:c}),confirmButtonText:a("common.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:a("common.cancel"),onConfirm(L){C({session:d,connectedAccount:t}).then(y).catch(z),L()},onCancel:y})});return}try{i.loading=!0,await new Promise((y,z)=>{if(t?._bind)n.open({title:a("userCenter.thirdPartyLogin.confirmUnbind",{name:c}),content:a("userCenter.thirdPartyLogin.confirmUnbindDescription",{name:c}),confirmButtonText:a("common.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:a("common.cancel"),onConfirm(L){f({session:d,connectedAccount:{...Yt(t,["did","pk"]),showProvider:t.provider,provider:t._rawProvider}}).then(y).catch(z),L()},onCancel:y});else if(t.provider===M.WALLET)d.bindWallet({onSuccess:y,onCancel:z});else{const L=h,U=window?.blocklet;let j="/";const k=xr(U),B=hr(U);k&&B?.appPid&&d?.user?.sourceAppPid&&(j=B.appUrl),m(j),v(o?.appPid),r({session:d,oauthItem:{...t,provider:t._rawProvider}}).then(y).catch(z).finally(()=>{m(L),v()})}})}catch(y){console.error(`Failed to ${t?._bind?"unbind":"bind"} oauth account`,y)}finally{i.loading=!1}}),R=E(y=>y.provider===M.WALLET&&y.did?a("userCenter.thirdPartyLogin.walletAccount"):y._mainProvider?a("userCenter.thirdPartyLogin.mainAccount"):y?._bind?a("userCenter.thirdPartyLogin.disconnect"):a("userCenter.thirdPartyLogin.connect")),P=E(y=>y.provider===M.WALLET&&y.did||y.provider===M.PASSKEY&&(s.arcSphere||s.wallet)?!0:!!t._mainProvider,[s.arcSphere]);return e.jsxs(e.Fragment,{children:[e.jsxs(x,{sx:{borderRadius:1,border:"1px solid",borderColor:"divider",backgroundColor:"grey.50",display:"flex",alignItems:"center",py:1,px:1.5,gap:.75,fontSize:"14px",lineHeight:1,overflow:"hidden"},children:[e.jsx(tr,{provider:t?.provider,sx:{width:"1em",height:"1em",flexShrink:0,fontSize:16,filter:({palette:y})=>t?.provider===M.GITHUB&&y.mode==="dark"?"invert(1)":"none"}}),e.jsx(x,{sx:{flex:1,display:{xs:t.userInfo?.email||t.did?"none":"block",sm:"block"}},children:c}),t.userInfo?.email||t.did?e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:.5,overflow:"hidden"},children:[e.jsx(x,{sx:{flex:1,textOverflow:"ellipsis",overflow:"hidden",lineHeight:"normal"},children:t.userInfo?.email||t.did}),t.userInfo?.name?e.jsx(Pe,{title:e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(nt,{size:36,variant:"circle",shape:"circle",src:t.userInfo?.picture,did:t.did}),e.jsxs(x,{children:[e.jsx(I,{sx:{whiteSpace:"normal",wordBreak:"break-all",fontSize:"0.9rem"},children:t.userInfo?.name}),e.jsx(I,{sx:{whiteSpace:"normal",wordBreak:"break-all",fontSize:"0.9rem"},children:t.userInfo?.email})]})]}),children:e.jsx(x,{component:D,icon:rr,sx:{color:"text.secondary",fontSize:16,cursor:"pointer",flexShrink:0}})}):null]}):null]}),e.jsx(Pe,{title:g(t),placement:"auto",children:e.jsx(x,{children:e.jsx(rt,{variant:"outlined",size:"small",sx:y=>{const z=y.palette.error.main,L=y.palette.primary.main;return{color:t?._bind?z:L,borderColor:t?._bind?z:L,backgroundColor:"background.default","&:hover":{borderColor:t?._bind?z:L,backgroundColor:"action.hover"},py:.5,borderRadius:1,fontWeight:500,whiteSpace:"nowrap"}},fullWidth:!0,startIcon:i.loading?null:e.jsx(D,{icon:Ir}),onClick:S,disabled:P(t),loading:i.loading,children:R(t)})})}),l]})}xt.propTypes={item:p.shape({provider:p.string,did:p.string,pk:p.string,userInfo:p.object,id:p.string,_bind:p.bool,_rawProvider:p.string,_mainProvider:p.bool}).isRequired};function ht({user:t}){const{session:s}=b.use(xe),[o,n]=b.useState({}),{getOAuthConfigs:l}=s.useOAuth(),i=ze();ar(async()=>{const r=await l({sourceAppPid:t?.sourceAppPid});n(r)},[t?.sourceAppPid]);const a=T(()=>{const r=Object.keys(o).map(f=>({...o[f],provider:f})).filter(f=>f.enabled);return[{provider:M.WALLET,order:-1},...r,{provider:M.PASSKEY,order:1/0}]},[o]),d=T(()=>{const r=gr(t);let f=!1,m="",h=mr(t);const C=r.find(c=>c.provider===M.AUTH0);return C&&(C.id.startsWith("google-oauth2|")&&(r.some(c=>c.provider==="google")||(f=!0,m=M.GOOGLE,h===M.AUTH0&&(h=M.GOOGLE))),C.id.startsWith("appleid|")&&(r.some(c=>c.provider===M.APPLE)||(f=!0,m=M.APPLE,h===M.AUTH0&&(h=M.APPLE))),C.id.startsWith("github|")&&(r.some(c=>c.provider===M.GITHUB)||(f=!0,m=M.GITHUB,h===M.AUTH0&&(h=M.GITHUB)))),a.map(c=>{if(c.provider===M.AUTH0&&f)return null;const g=f&&c.provider===m?r.find(S=>S.provider===M.AUTH0):r.find(S=>S.provider===c.provider);return g?{...c,provider:c.provider,did:g.did,pk:g.pk,userInfo:g.userInfo,_bind:!0,_rawProvider:g.provider,_mainProvider:c.provider===h}:{...c,provider:c.provider,_rawProvider:c.provider,_mainProvider:c.provider===h}}).filter(c=>!(!c||c.provider===M.PASSKEY&&!c.did)).sort((c,g)=>c._mainProvider?-1:c?.order!==void 0&&g?.order!==void 0?c.order-g.order:c?.order!==void 0?-1:1)},[t?.connectedAccounts,a]);return e.jsxs(x,{sx:{gap:1,display:"grid",gridTemplateColumns:"1fr min-content"},children:[d.map(r=>e.jsx(xt,{item:r},r?.provider)),i.wallet||i.arcSphere?null:e.jsx(nr,{behavior:"only-new",action:"connect",createMode:"connect",createButtonText:"Add New Passkey",onSuccess:Y,onError:Y,dense:!0,sx:{px:1.5,py:1,gap:.75}})]})}ht.propTypes={user:p.object.isRequired};function gt({configList:t,onSave:s}){const[o,n]=b.useState(t),{t:l}=O(),i=E(async(a,d)=>{try{const r=await $.user.saveUserPrivacyConfig({[a]:typeof d=="string"?d:!d});n(o.map(f=>({...f,value:r?.[f.key]??f.value}))),_.success(l("userCenter.saveSuccess")),s("privacy")}catch(r){_.error(ee(r))}});return b.useEffect(()=>{n(t)},[t]),e.jsx(x,{sx:{display:"flex",flexDirection:"column",gap:1,alignItems:"start",".MuiFormControlLabel-root":{gap:1,m:0,flexDirection:{xs:"row-reverse",md:"row"},width:{xs:"100%",md:"unset"}},".MuiSwitch-track":{borderRadius:"100vw"},".MuiSwitch-thumb":{borderRadius:"100%"},".MuiSwitch-root.MuiSwitch-sizeSmall":{height:"20px",width:"36px",".MuiSwitch-thumb":{width:"16px",height:"16px"}}},children:o.map(a=>{if(a.isPrivate)return null;const d=!a.value||["all","follower-only"].includes(a.value);return e.jsxs(x,{children:[e.jsx(ke,{checked:d,labelProps:{label:e.jsx(I,{sx:{color:"text.primary",fontSize:14,display:"flex",flexFlow:"wrap",columnGap:1,flex:1},children:l("userCenter.toPublic",{name:a.name})})},size:"small",onChange:r=>{const{checked:f}=r.target;a.followersOnly?i(a.key,f?"all":"private"):i(a.key,f)}},a.key),a.followersOnly&&d&&e.jsx(x,{sx:{pl:3,pt:1},children:e.jsx(ke,{checked:a.value==="follower-only",labelProps:{label:e.jsx(I,{sx:{color:"text.primary",fontSize:14,display:"flex",flexFlow:"wrap",columnGap:1,flex:1},children:l("team.userFollowers.followersOnly")})},size:"small",onChange:r=>{const{checked:f}=r.target;i(a.key,f?"follower-only":"all")}})})]})})})}gt.propTypes={configList:p.arrayOf(p.shape({key:p.string.isRequired,name:p.string.isRequired,value:p.bool.isRequired,isPrivate:p.bool})).isRequired,onSave:p.func.isRequired};function mt({user:t,sessionUser:s}){const o=T(()=>(t?.passports||[])?.find(n=>n.name===s.role),[t?.passports,s?.role]);return e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(nt,{size:40,variant:"circle",shape:"circle",src:s.avatar,did:s.did,sx:{flexShrink:0}}),e.jsxs(x,{sx:{flex:1,overflow:"hidden"},children:[e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(X,{title:s.fullName,children:e.jsx(I,{sx:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",flex:1},children:s.fullName})}),e.jsx(Ce,{label:o?.title||o?.name||"Guest",size:"small",variant:"outlined",sx:{flexShrink:0,fontWeight:"bold",fontSize:"12px",color:"text.primary",borderColor:"grey.300",backgroundColor:"transparent",textTransform:"capitalize",pr:.5,pl:0,height:"auto"}})]}),e.jsx(X,{title:s.email,children:e.jsx(I,{variant:"body2",color:"grey",sx:{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:s.email})})]})]})}mt.propTypes={user:p.object.isRequired,sessionUser:p.shape({role:p.string,avatar:p.string,did:p.string,fullName:p.string,email:p.string}).isRequired};const dn=()=>Promise.resolve(""),Ye=t=>new we(t,{browser:[[/(ArcWallet)\/([\w\.]+)/i],[we.BROWSER.NAME,we.BROWSER.VERSION]]}).getResult(),Ve={display:"flex",justifyContent:"flex-end",textAlign:"right"},un=new or({concurrency:1}),Ee=b.memo(({userSession:t,isMobile:s=!1})=>{const o=H({loading:!0,ipRegion:""}),{t:n}=O();return b.useEffect(()=>{un.add(async()=>{try{o.ipRegion=await dn(t.lastLoginIp)}finally{o.loading=!1}})},[o,t.lastLoginIp]),e.jsx(x,{...s&&{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:1,flexWrap:"wrap"},children:o.ipRegion?e.jsxs(e.Fragment,{children:[e.jsx(I,{variant:"body2",children:o.ipRegion}),e.jsx(I,{variant:"body2",color:"grey",children:t.lastLoginIp||n("userCenter.unknown")})]}):e.jsxs(e.Fragment,{children:[e.jsx(I,{children:t.lastLoginIp||n("userCenter.unknown")}),o.loading?e.jsx(I,{variant:"body2",color:"grey",sx:{textAlign:"center"},children:e.jsx(V,{size:12,color:"inherit"})}):null]})})});Ee.propTypes={userSession:p.object.isRequired,isMobile:p.bool};Ee.defaultProps={isMobile:!1};function bt({user:t,showAction:s=!0,showUser:o=!0,getUserSessions:n,showOffline:l=!1}){const i=H({status:"online",page:1,pageSize:10}),a=H({online:0,expired:0,offline:0}),d=br(),{t:r}=O(),f=Q({key:"md"}),m=fe(j=>j.breakpoints.down("lg")),{confirmApi:h,confirmHolder:C}=Ae(),v=E(async()=>{const j=await n({page:i.page,pageSize:i.pageSize,status:i.status}),k=j?.paging?.total||0;return a[i.status]=k,{total:k,list:j?.list||[]}});Xe(async()=>{const j=await n({page:1,pageSize:1,status:"expired"});a.expired=j?.paging?.total||0;const k=await n({page:1,pageSize:1,status:"offline"});a.offline=k?.paging?.total||0});const c=re(v,{refreshDeps:[i.status,i.page,i.pageSize]}),g=T(()=>c.data?.list||[],[c.data?.list]),S=T(()=>{const{status:j}=i;return j==="online"?a[j]<=1:a[j]===0},[g,d]),R=T(()=>de({},f?Ve:{}),[f]),P=E(({visitorId:j})=>{h.open({title:r("userCenter.logoutThisSession"),content:r("userCenter.logoutThisSessionConfirm"),confirmButtonText:r("userCenter.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:r("userCenter.cancel"),onConfirm:async()=>{await $.user.logout({visitorId:j,includeFederated:!0});const{page:k=0}=i,{list:B=[]}=c.data||{},G=B.length||0;k>1&&G===1&&(i.page=Math.max(k-1,1)),c.refresh(),h.close()}})}),y=E(()=>{h.open({title:r("userCenter.logoutAllSession",{type:r(i.status)}),content:r("userCenter.logoutAllSessionConfirm",{type:r(i.status)}),confirmButtonText:r("userCenter.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:r("userCenter.cancel"),onConfirm:async()=>{await $.user.logout({status:i.status,visitorId:d,includeFederated:!0}),i.page=1,c.refresh(),h.close()}})}),z=[];s&&z.push(e.jsx(X,{title:r("userCenter.logoutAllTips",{type:r(i.status)}),children:e.jsx(q,{sx:{ml:.5},size:"small",variant:"contained",color:"error",onClick:y,disabled:S,children:r("userCenter.logoutAll",{type:r(i.status)})})},"logoutAll"));const L=T(()=>({search:!1,sort:!1,download:!1,filter:!1,print:!1,expandableRowsOnClick:!1,searchDebounceTime:600,page:i.page-1,rowsPerPage:i.pageSize,count:c.data?.total||0}),[c.data?.total,i.page,i.pageSize]),U=[{label:r("userCenter.platform"),name:"platform",options:{customBodyRenderLite:j=>{const k=g[j],B=Ye(k?.ua);return e.jsx(x,{sx:R,children:[B.os?.name,B.os?.version].filter(Boolean).join("/")||r("userCenter.unknown")})}}},{label:r("userCenter.deviceType"),name:"deviceType",options:{customBodyRenderLite:j=>{const k=g[j],B=Ye(k?.ua);return e.jsx(x,{sx:R,children:[B.browser?.name,B.browser?.version].filter(Boolean).join("/")||r("userCenter.unknown")})}}},{label:r("userCenter.walletOS"),name:"walletOS",options:{customBodyRenderLite:j=>{const k=g[j];return e.jsx(x,{sx:R,children:k.extra?.walletOS||r("userCenter.unknown")})}}},o&&{label:r("userCenter.user"),name:"user",options:{customBodyRenderLite:j=>{const k=g[j];return e.jsx(x,{sx:de({minWidth:150,maxWidth:250},f?Ve:{}),children:e.jsx(mt,{sessionUser:k.user,user:t})})}}},{label:r("userCenter.createdAt"),name:"createdAt",options:{customBodyRenderLite:j=>{const k=g[j];return e.jsx(x,{sx:R,children:k.createdAt?e.jsx(Ue,{value:k.createdAt,relativeRange:3*86400*1e3}):r("userCenter.unknown")})}}},!l&&{label:r("userCenter.updatedAt"),name:"updatedAt",options:{customBodyRenderLite:j=>{const k=g[j];return e.jsx(x,{sx:R,children:k.status==="expired"?r("userCenter.expired"):e.jsx(Ue,{value:k.updatedAt,relativeRange:3*86400*1e3})})}}},{label:r("userCenter.lastLoginIp"),name:"lastLoginIp",options:{customBodyRenderLite:j=>{const k=g[j];return e.jsx(Ee,{userSession:k,isMobile:f})}}},s&&{label:r("userCenter.actions"),name:"actions",options:{customBodyRenderLite:j=>{const k=g[j];return e.jsx(x,{sx:R,children:e.jsx(q,{sx:{whiteSpace:"nowrap",fontSize:"12px !important",lineHeight:"1.25",px:1},disabled:d===k.visitorId,variant:"outlined",size:"small",color:"error",onClick:()=>P({visitorId:k.visitorId}),children:k.status==="expired"?r("userCenter.remove"):d===k.visitorId?r("userCenter.currentSession"):r("userCenter.logout")})})}}}].filter(Boolean);return e.jsxs(x,{className:"pc-user-sessions",sx:{maxWidth:f?"unset":m?"calc(100vw - 300px)":"100%",...f&&{".pc-user-sessions-table > div:nth-child(2)":{border:"1px solid",borderColor:"divider",borderRadius:1}},".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableRow-root":{border:"unset","&:nth-child(even)":{backgroundColor:"grey.50","&:hover":{backgroundColor:j=>`${j.palette.grey[50]} !important`}}},".MuiTableRow-hover":{"&:hover":{backgroundColor:"inherit !important"}},".MuiTableCell-root":{paddingRight:"8px",paddingLeft:"8px",color:"text.secondary",...f&&{padding:"8px !important","&:first-child":{paddingTop:"20px!important"},"&:last-child":{paddingBottom:"20px!important"}}}},children:[C,e.jsx(yr,{count:c.data?.total||0,data:g,columns:U,customButtons:z,options:L,loading:c.loading,className:"pc-user-sessions-table",title:e.jsxs(Nt,{row:!0,sx:{lineHeight:1,ml:1},onChange:j=>{i.status=j.target.value},children:[e.jsx(J,{value:"online",control:e.jsx(ve,{size:"small",sx:{lineHeight:1,fontSize:0},checked:i.status==="online"}),label:e.jsxs(I,{sx:{display:"flex",alignItems:"center"},children:[r("userCenter.online"),e.jsxs(I,{component:"span",sx:{ml:.5,color:"text.secondary"},children:["(",a.online,")"]})]})}),e.jsx(J,{value:"expired",control:e.jsx(ve,{size:"small",sx:{lineHeight:1,fontSize:0},checked:i.status==="expired"}),label:e.jsxs(I,{sx:{display:"flex",alignItems:"center"},children:[r("userCenter.expired"),e.jsxs(I,{component:"span",sx:{ml:.5,color:"text.secondary"},children:["(",a.expired,")"]})]})}),l?e.jsx(J,{value:"offline",control:e.jsx(ve,{size:"small",sx:{lineHeight:1,fontSize:0},checked:i.status==="offline"}),label:e.jsxs(I,{sx:{display:"flex",alignItems:"center"},children:[r("userCenter.offline"),e.jsxs(I,{component:"span",sx:{ml:.5,color:"text.secondary"},children:["(",a.offline,")"]})]})}):null]}),onChange:j=>{i.page=j.page+1,i.pageSize=j.rowsPerPage}})]})}bt.propTypes={user:p.object.isRequired,showAction:p.bool,showUser:p.bool,showOffline:p.bool,getUserSessions:p.func.isRequired};function yt({onDestroySelf:t=void 0}){const{confirmHolder:s}=Ae(),{t:o}=O(),{session:n}=b.use(xe),l=E(async()=>{if(!t||typeof t!="function")return;const i=n.withSecondaryAuth(t,{extraParams:{removeUserDid:n?.user?.did,input:{user:{did:n?.user?.did},teamDid:window?.blocklet?.did}},operation:"destroySelf"});try{await i(),n.logout()}catch(a){_.error(a?.message||o("userCenter.destroyMyself.error"))}});return e.jsxs(e.Fragment,{children:[e.jsx(x,{children:e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:1,justifyContent:"space-between",flexWrap:"wrap"},children:[e.jsxs(x,{children:[e.jsx(I,{variant:"h6",sx:{fontSize:"0.875rem !important",fontWeight:"bold"},children:o("userCenter.dangerZone.deleteAccount")}),e.jsx(I,{variant:"caption",sx:{color:"text.secondary"},children:o("userCenter.dangerZone.deleteAccountDescription")})]}),e.jsx(q,{variant:"contained",color:"error",size:"small",onClick:l,children:o("userCenter.dangerZone.delete")})]})}),s]})}yt.propTypes={onDestroySelf:p.func};function pn(){const t=Q({key:"md"}),s=fe(l=>l.breakpoints.down("lg")),o={display:"flex",justifyContent:"flex-end",flexWrap:"wrap",textAlign:"right","&.expired-at > div":{maxWidth:160,justifyContent:"flex-end",flexWrap:"wrap"}},n=T(()=>de({},t?o:{}),[t]);return e.jsx(x,{id:"user-center-access-key-setting",sx:{maxWidth:t?"unset":s?"calc(100vw - 300px)":"100%",...t&&{".pc-access-key-table > div:nth-child(2)":{border:"1px solid",borderColor:"divider",borderRadius:1}},".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableRow-root":{border:"unset","&:nth-child(even)":{backgroundColor:"grey.50","&:hover":{backgroundColor:l=>`${l.palette.grey[50]} !important`}}},".MuiTableRow-hover":{"&:hover":{backgroundColor:"inherit !important"}},".MuiTableCell-root":{paddingRight:"8px",paddingLeft:"8px",color:"text.secondary",...t&&{padding:"8px !important","&:first-child":{paddingTop:"20px!important"},"&:last-child":{paddingBottom:"20px!important"}}}},children:e.jsx(zr,{isSelf:!0,columnSx:n})})}function vt({onDestroySelf:t=void 0,userCenterTabs:s=[]}){const{t:o}=O(),{user:n,session:l,isMyself:i,isOwner:a}=he(),r=ze().arcSphere,f=Q({key:"md"}),m=re(async()=>n&&i?await $.user.getUserPrivacyConfig({did:n.did}):null,{refreshDeps:[n,i],loadingDelay:300}),h=T(()=>s.map(c=>({key:c.value,name:c.label,value:c.protected,isPrivate:c.isPrivate,followersOnly:c.followersOnly})),[s]),C=E(async c=>c==="privacy"?(await m.runAsync(),m.data):(c==="profile"&&await l.refresh(),null));b.useEffect(()=>{const c=window.location.hash.slice(1);c&&document.getElementById(c)?.scrollIntoView({behavior:"smooth"})},[]);const v=T(()=>[r?void 0:{label:o("userCenter.commonSetting.title"),value:"common",content:e.jsx(pt,{user:n,onSave:C})},{label:o("userCenter.notificationManagement"),value:"notification",content:e.jsx(ft,{user:n,isMobile:f})},{label:o("userCenter.thirdPartyLogin.title"),value:"thirdPartyLogin",content:e.jsx(ht,{user:n})},{label:o("common.accessKeys"),value:"accessKeys",content:e.jsx(pn,{isSelf:!0})},{label:o("common.mcpServers"),value:"mcpServers",content:e.jsx(Mr,{})},{label:o("userCenter.privacyManagement"),value:"privacy",content:e.jsx(gt,{configList:h,onSave:C})},{label:o("userCenter.sessionManagement"),value:"session",content:e.jsx(bt,{user:n,showUser:!1,getUserSessions:c=>$.userSession.getMyLoginSessions({},c)})},!a&&t&&typeof t=="function"?{label:o("userCenter.dangerZone.title"),value:"dangerZone",content:e.jsx(yt,{onDestroySelf:t}),sx:{borderColor:"error.main"}}:null].filter(Boolean),[n,h,f,a,t]);return i?e.jsx(x,{className:"user-center-settings",sx:{display:"flex",flexDirection:"column",gap:2.5,minWidth:{md:500},"@media (min-width: 1200px) and (max-width: 1260px)":{maxWidth:750},"@media (min-width: 1100px) and (max-width: 1199px)":{maxWidth:650},"@media (min-width: 1000px) and (max-width: 1099px)":{maxWidth:600},"@media (max-width: 1049px)":{maxWidth:"100%"}},children:v.map(c=>c?e.jsxs(x,{id:c.value,sx:de({border:"1px solid",borderColor:"divider",borderRadius:1,p:2,"&:last-child":{mb:5}},c.sx),children:[e.jsx(I,{sx:{color:"text.primary",fontWeight:600},children:c.label}),e.jsx(x,{sx:{mt:2.5},children:c.content})]},c.value):null)}):null}vt.propTypes={onDestroySelf:p.func,userCenterTabs:p.array};const wt=b.createContext({}),{Provider:fn,Consumer:xo}=wt;function jt({children:t}){const[s]=b.useState(!1),{session:o}=b.use(xe),{user:n}=o,[l,i]=b.useState(),a=b.useMemo(()=>n?.didSpace?.endpoint,[n?.didSpace]);b.useEffect(()=>{i(n?.didSpace)},[n?.didSpace]);const d=async()=>{i(void 0)},r=h=>{},f=async h=>{i(h),await r(h.endpoint)},m=!!(a&&l);return e.jsx(fn,{value:{loading:s,spaceGateway:l,session:o,deleteSpaceGateway:d,updateSpaceGateway:f,storageEndpoint:a,settingStorageEndpoint:r,hasStorageEndpoint:m},children:t})}function Le(){return b.use(wt)}jt.propTypes={children:p.node.isRequired};function xn(t){const s=t.replace(/\/api\/space\/.+/,""),n=t.replace(/\/$/,"").split("/").at(-4);return ce(s,"space",n)}function Ct({session:t,spaceGateway:s,spaceStatus:o,refresh:n}){return e.jsxs(Ie,{direction:"row",spacing:1,children:[o===Lr.DISCONNECTED&&e.jsx(ue,{reconnect:!0,variant:"outlined",session:t,spaceDid:t.user?.didSpace?.did,spaceGatewayUrl:t.user?.didSpace?.url,connectScope:"user",onSuccess:async()=>{await n()},onError:l=>{console.error(l),_.error(ee(l))}}),e.jsx(N,{size:"small",LinkComponent:$t,href:xn(s.endpoint),target:"_blank",children:e.jsx(Ut,{})})]})}Ct.propTypes={session:p.object.isRequired,spaceGateway:p.object.isRequired,spaceStatus:p.string.isRequired,refresh:p.func.isRequired};function kt({spaceGateway:t=void 0}){const{t:s}=O(),{updateSpaceGateway:o,session:n}=Le(),l=Q(),i=({spaceGateway:a})=>o(a);return e.jsxs(x,{sx:{display:"flex",flexDirection:"column"},children:[e.jsxs(x,{sx:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",marginBottom:"12px"},children:[e.jsx(I,{sx:{fontSize:"16px",fontWeight:"bold"},children:s("userCenter.storage.spaces.connected.title")}),!l&&e.jsx(ue,{connectScope:"user",connectText:s("userCenter.storage.spaces.connected.switch"),session:n,onSuccess:i})]}),e.jsx(x,{children:t&&e.jsx(Br,{endpoint:t.endpoint,deps:[t],selected:!0,footer:!0,action:a=>e.jsx(Ct,{session:n,...a})},t.endpoint)}),l&&e.jsx(x,{sx:{display:"flex",alignItems:"center",justifyContent:"center",marginTop:2},children:e.jsx(ue,{connectScope:"user",connectText:s("userCenter.storage.spaces.connected.switch"),session:n,onSuccess:i})})]})}kt.propTypes={spaceGateway:p.object};function hn(){const{t}=O(),{updateSpaceGateway:s,session:o}=Le(),n=({spaceGateway:l})=>s(l);return e.jsxs(x,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(I,{sx:{fontSize:"16px",fontWeight:"bold"},children:t("userCenter.storage.spaces.connect.providerForStorage")}),e.jsx(Wr,{viewBox:"0 0 228 258",style:{width:"156px",height:"156px",margin:"16px 0"}}),e.jsx(x,{children:e.jsx(ue,{session:o,onSuccess:n})})]})}function gn(){const{spaceGateway:t,hasStorageEndpoint:s,loading:o}=Le(),{isMyself:n}=he();return n?o?e.jsx(Er,{relative:"parent",children:e.jsx(V,{})}):e.jsx(bn,{children:e.jsx(x,{sx:{maxWidth:"720px"},children:s?e.jsx(kt,{spaceGateway:t}):e.jsx(hn,{})})}):null}function mn(){return e.jsx(jt,{children:e.jsx(gn,{})})}const bn=te(x)`
|
|
122
|
-
height: 100%;
|
|
123
|
-
overflow-y: auto;
|
|
124
|
-
`;function yn(){const{user:t,isMyself:s,viewUser:o}=he(),{followUser:n,unfollowUser:l,followed:i}=Tr(),a=async(d,r)=>{await(r?l:n)(d)};return e.jsx(x,{children:e.jsx(Or,{teamDid:window?.blocklet?.did||"",user:s?t:o,onToggleFollow:a,followed:i})})}function ho(){const{api:t}=sr(),s=b.useRef(null),n=qt().tab,i=new URLSearchParams(window.location.search).get("embed")||window.sessionStorage?.getItem("embed"),a=ir(),d=T(()=>({...window.blocklet,meta:{did:window.blocklet.did,name:window.blocklet.did},children:window?.blocklet?.componentMountPoints.map(f=>({...f,meta:{...f,did:f.did,name:f.name||f.title||"",logo:"logo.png"}}))})),r=async f=>{const{input:m,sessionId:h}=f;try{await t.destroySelf({input:{...m,sessionId:h}})}catch(C){console.error("destroy myself error",C)}};return e.jsx(jr,{children:e.jsxs(Ar,{ref:s,embed:i==="1",currentTab:n?ce(Te.WELLKNOWN_SERVICE_PATH_PREFIX,"user",n):"",disableAutoRedirect:n==="settings",children:[n==="notifications"?e.jsx(tn,{blocklets:[d],context:a}):null,n==="nfts"?e.jsx(ln,{}):null,n==="settings"?e.jsx(vt,{onDestroySelf:r}):null,n==="did-spaces"?e.jsx(mn,{}):null,n==="user-followers"?e.jsx(yn,{}):null]})})}export{ho as default};
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import{g as Wt,r as v}from"./vendor-react-Dvs43sk9.js";import{j as e,ak as y,z as Z,b6 as me,be as Ke,y as V,am as ut,c_ as Bt,bm as Kt,at as ae,b1 as mt,W as h,T as ee,U as Ge,c$ as pt,b5 as qe,a5 as Me,Q as Fe,d0 as Je,aN as Ue,a6 as ft,D as ht,d1 as qt,ad as xt,d2 as Mt,d3 as Ut,c1 as st,n as Ht,x as $t,bb as Vt,M as it,cv as Gt,I as Jt,d4 as Yt}from"./vendor-mui-core-Bq_sfmbr.js";import{A as gt,J as Xt,C as Zt,e as le,F as Qt,a3 as je}from"./vendor-utils-DQK0pEML.js";import{T as te,H as M,D as ce,G as en,L as bt,al as tn,aK as nn,y as jt,$ as vt,ac as yt,aL as Oe,F as St,a6 as sn,ai as an}from"./vendor-ux-D0eHYGOw.js";import{aF as rn,Z as Ye,a8 as Ct,aZ as Rt,M as _e,c as _,ap as Q,p as on,aO as at}from"./index-Br7RGSFv.js";import{g as ye,b as $,a as se}from"./vendor-hooks-DLNZ8kxG.js";import{u as wt,C as Y}from"./index.esm-JPZAjt0x.js";import{i as He}from"./isURL-C56b9oXx.js";import{S as X}from"./section-4lLmF6fb.js";import{A as ln,a as cn,b as dn}from"./collapse-Cf8moIch.js";import{S as Se}from"./shorten-label-BYntTWDs.js";import{v as Tt}from"./index-CcGgdXu3.js";import{R as Nt,A as un,S as mn,a as pn,B as fn}from"./list-Dg6YcsMU.js";import{j as hn,c as xn,N as gn}from"./team-cktMvdm0.js";import{W as bn}from"./did-address-CPLUdwKY.js";import{p as It}from"./util-DgyQXNeO.js";import{D as jn,g as vn}from"./traffic-h0HcpbzT.js";import{B as Et}from"./bundle-avatar-bJGgXPJZ.js";import{u as yn}from"./use-mobile-D2h0sedv.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DNHIum0y.js";import"./required-CtPXGgxr.js";import"./server-logo-notext.svg-CKQB0tIp.js";import"./index-JrJd98Of.js";import"./session-Ba0-LWgc.js";import"./use-app-logo-CPHV51wY.js";import"./base32-DUdjIQpj.js";import"./useAsyncRetry-ODp5sGTA.js";import"./useAsync-CNAYLnLm.js";import"./iframe-Ce3kroAM.js";import"./index-BLonWJ__.js";import"./index-DBs9Ljax.js";import"./base-chart-o9AZYZ--.js";import"./index-DO9UDa6G.js";import"./vendor-mui-x-BbwECMfi.js";import"./AdapterDayjs-ffU9bx7e.js";var Te={exports:{}},Ne={exports:{}},Ie={exports:{}},rt;function Sn(){return rt||(rt=1,function(n,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=t;function t(r){return r==null}n.exports=s.default,n.exports.default=s.default}(Ie,Ie.exports)),Ie.exports}var ot;function Cn(){return ot||(ot=1,function(n,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=u;var t=o(rn()),r=o(Sn());function o(p){return p&&p.__esModule?p:{default:p}}var l=/^(?:[-+]?(?:0|[1-9][0-9]*))$/,b=/^[-+]?[0-9]+$/;function u(p,i){(0,t.default)(p),i=i||{};var N=i.allow_leading_zeroes===!1?l:b,I=!i.hasOwnProperty("min")||(0,r.default)(i.min)||p>=i.min,S=!i.hasOwnProperty("max")||(0,r.default)(i.max)||p<=i.max,j=!i.hasOwnProperty("lt")||(0,r.default)(i.lt)||p<i.lt,E=!i.hasOwnProperty("gt")||(0,r.default)(i.gt)||p>i.gt;return N.test(p)&&I&&S&&j&&E}n.exports=s.default,n.exports.default=s.default}(Ne,Ne.exports)),Ne.exports}var lt;function Rn(){return lt||(lt=1,function(n,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=o;var t=r(Cn());function r(l){return l&&l.__esModule?l:{default:l}}function o(l){return(0,t.default)(l,{allow_leading_zeroes:!1,min:0,max:65535})}n.exports=s.default,n.exports.default=s.default}(Te,Te.exports)),Te.exports}var wn=Rn();const Tn=Wt(wn),ze={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:"",companyName:"",companyLink:"",companyAddress:"",supportEmail:""};function Nn(){const{api:n}=Ye(),{blocklet:s}=Ct(),{t}=te(),{confirmApi:r,confirmHolder:o}=Rt(),l=s?.meta?.did,b=Object.assign({...ze},s?.settings?.notification?.email||{}),{handleSubmit:u,control:p,formState:i,watch:N,reset:I}=wt({defaultValues:gt(b,Object.keys(ze))}),S=ye({testReceiver:"",testReceiverError:""}),j=N("enabled"),E=$(async(a,T,k=!0)=>{try{const{blocklet:D}=await n.configNotification({input:{did:l,notification:JSON.stringify({email:a})}}),re=Object.assign({...ze},D?.settings?.notification?.email||{});I(re),k&&M.success(t("oauth.saveSuccess"))}catch(D){if(k)M.error(D.message||t("oauth.saveFailed"));else throw D}}),G=$(async(a,T,k)=>{try{i.isDirty&&await E(a,T,!1),await n.sendEmail({input:{did:l,receiver:k,email:JSON.stringify({body:"Your SMTP configuration is correct!",title:"Test email",type:"notification"})}}),M.success(t("notification.email.testSuccess"))}catch(D){M.error(D.message||t("notification.email.testfailed"))}}),z=$((a,T)=>{S.testReceiver="",S.testReceiverError="",r.open({title:t("notification.email.testSendEmail"),content:()=>e.jsx(y,{sx:{width:"300px"},children:e.jsx(Z,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:t("notification.email.inputTestReceiver"),value:S.testReceiver,onChange:k=>{S.testReceiver=k.target.value},error:!!S.testReceiverError,helperText:S.testReceiverError||" "})}),confirmButtonText:t("common.confirm"),cancelButtonText:t("common.cancel"),async onConfirm(k){const D=S.testReceiver?.trim();if(!D){S.testReceiverError=t("notification.email.receiverRequired");return}if(!_e(D)){S.testReceiverError=t("notification.email.receiverInvalid");return}S.testReceiverError="",await G(a,T,D),k()}})}),F=$(a=>{const T=a?.trim();return T?_e(T)?!0:t("notification.email.fromInvalid"):t("notification.email.fromRequired")}),B=$(a=>{const T=a?.trim();return T?He(T,{require_host:!1,protocols:[]})?!0:t("notification.email.hostInvalid"):t("notification.email.hostRequired")}),R=$(a=>a?Tn(a)?!0:t("notification.email.portInvalid"):t("notification.email.portRequired")),K=$(a=>a?.trim()?!0:t("notification.email.userRequired")),q=$(a=>a?.trim()?!0:t("notification.email.passwordRequired")),f=$(a=>a?.trim()&&!He(a,{protocols:["http","https"],require_protocol:!0})?t("notification.email.linkInvalid"):!0),w=$(a=>a?.trim()&&!_e(a)?t("notification.email.emailInvalid"):!0),C=$(()=>!0);return e.jsxs(y,{children:[e.jsxs(In,{component:"form",onSubmit:u(E),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(X,{title:t("notification.email.enable"),my:2.5,children:e.jsx(Y,{name:"enabled",control:p,render:({field:a})=>e.jsx(me,{control:e.jsx(Ke,{checked:a.value,...a})})})}),e.jsx(X,{title:t("notification.email.from"),children:e.jsx(Y,{name:"from",control:p,rules:{validate:j?F:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...a,size:"small",required:!0,label:t("notification.email.from"),error:!!i.errors[a.name],helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.host"),children:e.jsx(Y,{name:"host",control:p,rules:{validate:j?B:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:t("notification.email.host"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.port"),children:e.jsx(Y,{name:"port",control:p,rules:{validate:j?R:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...a,size:"small",required:!0,type:"number",error:!!i.errors[a.name],label:t("notification.email.port"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.user"),children:e.jsx(Y,{name:"user",control:p,rules:{validate:j?K:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:t("notification.email.user"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.password"),children:e.jsx(Y,{name:"password",control:p,rules:{validate:j?q:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...a,size:"small",required:!0,type:"password",error:!!i.errors[a.name],label:t("notification.email.password"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.secure"),children:e.jsx(Y,{name:"secure",control:p,rules:{validate:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(me,{control:e.jsx(Ke,{checked:a.value,...a,disabled:!j})})})})}),e.jsxs(ln,{children:[e.jsxs(cn,{expandIcon:e.jsx(Kt,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:[t("notification.email.signature"),e.jsx(ut,{title:t("notification.email.signatureTooltip"),children:e.jsx(Bt,{fontSize:"small",sx:{ml:1,cursor:"help"}})})]}),e.jsxs(dn,{children:[e.jsx(X,{title:t("notification.email.companyName"),children:e.jsx(Y,{name:"companyName",control:p,rules:{validate:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...a,size:"small",error:!!i.errors[a.name],label:t("notification.email.companyName"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.companyLink"),children:e.jsx(Y,{name:"companyLink",control:p,rules:{validate:j?f:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...a,size:"small",error:!!i.errors[a.name],label:t("notification.email.companyLink"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.companyAddress"),children:e.jsx(Y,{name:"companyAddress",control:p,rules:{validate:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...a,size:"small",error:!!i.errors[a.name],label:t("notification.email.companyAddress"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.supportEmail"),children:e.jsx(Y,{name:"supportEmail",control:p,rules:{validate:j?w:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...a,size:"small",type:"email",error:!!i.errors[a.name],label:t("notification.email.supportEmail"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})})]})]}),e.jsxs(y,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(ce,{variant:"outlined",color:"warning",onClick:u(z),disabled:!j,children:t("oauth.runTest")}),e.jsx(ce,{type:"submit",variant:"contained",disabled:!i.isDirty,children:t("oauth.save")})]})]}),o]})}const In=ae(mt)``,We={enabled:!1,endpoint:"",did:void 0,pushPath:void 0};function En(){const{api:n}=Ye(),{blocklet:s}=Ct(),{t}=te(),{confirmApi:r,confirmHolder:o}=Rt(),l=s?.meta?.did,b=Object.assign({...We},s?.settings?.notification?.pushKit||{}),{handleSubmit:u,control:p,formState:i,watch:N,reset:I}=wt({defaultValues:gt(b,Object.keys(We))}),S=ye({testReceiver:"",testReceiverError:""}),j=N("enabled"),E=$(async(R,K,q=!0)=>{try{const{blocklet:f}=await n.configNotification({input:{did:l,notification:JSON.stringify({pushKit:R})}}),w=Object.assign({...We},f?.settings?.notification?.pushKit||{});I(w),q&&M.success(t("oauth.saveSuccess"))}catch(f){if(q)M.error(f.message||t("oauth.saveFailed"));else throw f}}),G=$(async(R,K)=>{try{i.isDirty&&await E(R,K,!1);const q=(s?.configs||[]).find(C=>C.key==="BLOCKLET_APP_URL")?.value,f=Xt(Zt(q,_.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo"),{v:s?.meta?.version,t:new Date(s?.updatedAt||0).getTime()}),w={type:"passthrough",passthroughType:"messageStatus",data:{message:{title:"Test push-kit notification",body:"This is message from push-kit config test",sender:{did:s?.appDid,fullName:s?.meta?.title,avatar:f}}}};await n.sendPush({input:{did:l,receiver:S.testReceiver,notification:JSON.stringify(w)}}),M.success(t("notification.pushKit.testSuccess"))}catch(q){M.error(q.message||t("notification.pushKit.testfailed"))}}),z=$((R,K)=>{S.testReceiverError="",r.open({title:t("notification.pushKit.testSend"),content:()=>e.jsx(y,{sx:{width:"450px",maxWidth:"100%"},children:e.jsx(Z,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:t("notification.pushKit.inputTestReceiver"),value:S.testReceiver,onChange:q=>{S.testReceiver=q.target.value},error:!!S.testReceiverError,helperText:S.testReceiverError||" "})}),confirmButtonText:t("common.confirm"),cancelButtonText:t("common.cancel"),async onConfirm(q){if(!S.testReceiver?.trim()){S.testReceiverError=t("notification.pushKit.receiverRequired");return}S.testReceiverError="",await G(R,K),q()}})}),F=$(R=>{const K=R?.trim();return K?He(K)?!0:t("notification.pushKit.endpointInvalid"):t("notification.pushKit.endpointRequired")}),B=$(()=>!0);return e.jsxs(y,{children:[e.jsxs(An,{component:"form",onSubmit:u(E),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(X,{title:t("notification.pushKit.enable"),my:2.5,children:e.jsx(Y,{name:"enabled",control:p,render:({field:R})=>e.jsx(me,{control:e.jsx(Ke,{checked:R.value,...R})})})}),e.jsx(X,{title:t("notification.pushKit.endpoint"),children:e.jsx(Y,{name:"endpoint",control:p,rules:{validate:j?F:B},render:({field:R})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...R,size:"small",required:!0,label:t("notification.pushKit.endpoint"),error:!!i.errors[R.name],helperText:i.errors[R.name]?.message||" ",disabled:!j})})})}),e.jsxs(X,{title:t("notification.pushKit.customOptions"),children:[e.jsx(Y,{name:"did",control:p,render:({field:R})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...R,size:"small",label:t("notification.pushKit.did"),error:!!i.errors[R.name],helperText:i.errors[R.name]?.message||" ",disabled:!j})})}),e.jsx(Y,{name:"pushPath",control:p,render:({field:R})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...R,size:"small",label:t("notification.pushKit.pushPath"),error:!!i.errors[R.name],helperText:i.errors[R.name]?.message||" ",disabled:!j})})})]}),e.jsxs(y,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(ce,{variant:"outlined",color:"warning",onClick:u(z),disabled:!j,children:t("oauth.runTest")}),e.jsx(ce,{type:"submit",variant:"contained",disabled:!i.isDirty,children:t("oauth.save")})]})]}),o]})}const An=ae(mt)``,ct=[{label:e.jsx(y,{sx:{textAlign:"center",width:"100%"},children:"Email"}),value:"email"},{label:e.jsx(y,{sx:{textAlign:"center",width:"100%"},children:"Push Kit"}),value:"pushKit"}];function On(){const[n,s]=v.useState(ct[0].value),{locale:t}=v.useContext(en),r=se(()=>({email:e.jsx(Nn,{}),pushKit:e.jsx(En,{})}),[t]),o=v.useMemo(()=>({padding:"10px 0"}),[]);return e.jsxs(y,{children:[e.jsx(bt,{tabs:ct,current:n,onChange:s}),e.jsx(y,{style:o,children:r[n]})]})}const At=v.createContext({}),{Provider:kn,Consumer:Ws}=At;function Dn({children:n,blocklet:s=""}){const{api:t,inService:r,ws:{useSubscription:o}}=Ye(),[l,b]=v.useState([]),[u,p]=v.useState({total:0,pageSize:20,pageCount:0,page:1}),i=se(()=>s.meta?.did,[s]),[N,I]=v.useState([]),[S,j]=v.useState({}),E=se(()=>l.length?new Set(l.map(f=>f.id)):new Set,[l]),G=async({page:f=1,pageSize:w=20,...C}={})=>{if(!i)return[];try{const a={paging:{page:f,pageSize:w},...C,teamDid:i,dateRange:C.dateRange?[Q(C.dateRange[0]).toISOString(),Q(C.dateRange[1]).toISOString()]:void 0},{dids:T,...k}=a;let D="";T&&T.includes("system")&&(D="system");const re=T?T.filter(pe=>pe!=="system"):[],ue={...k,source:D,componentDids:re},oe=await t.getNotificationSendLog({input:ue});return j(ue),b(oe.list),p(oe.paging),oe.list}catch(a){return M.error(a.message),[]}},z=async()=>{const f=await t.getNotificationComponents({input:{teamDid:i}});I(f.componentDids)},F=v.useCallback(f=>{const w=s.children.find(C=>C.meta?.did===f);if(w)return w.ancestors=[s],w},[s]),B=async({notificationId:f,receivers:w,channels:C,...a})=>{await t.resendNotification({input:{teamDid:i,notificationId:f,receivers:w,channels:C.map(T=>T==="wallet"?_.NOTIFICATION_SEND_CHANNEL.WALLET:T==="pushKit"?_.NOTIFICATION_SEND_CHANNEL.PUSH:T),...a}})},R=v.useCallback(async f=>(await t.getUser({input:{teamDid:i,user:{did:f}}})).user,[t,i]),K=v.useCallback(async({page:f=1,pageSize:w=20,...C}={})=>{try{const a={paging:{page:f,pageSize:w},...C,userName:C.searchText||"",teamDid:i,dateRange:C.dateRange?[Q(C.dateRange[0]).toISOString(),Q(C.dateRange[1]).toISOString()]:void 0};return await t.getReceivers({input:a})}catch(a){throw M.error(a.message),a}},[t,i]);v.useEffect(()=>{i&&z()},[i]),o(_.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,f=>{E.has(f.notificationId)&&G(S)},[E,S]),o(_.EVENTS.NOTIFICATION_BLOCKLET_CREATE,f=>{E.has(f.id)||G(S)},[E,S]);const q={fetch:G,data:l,paging:u,blocklet:s,getComponent:F,resendNotification:B,getUser:R,componentDids:N,getReceivers:K,inService:r,teamDid:i};return e.jsx(kn,{value:{notificationRecords:q},children:n})}function Xe(){const{notificationRecords:n}=v.useContext(At);return n}Ce.propTypes={severity:h.oneOf(Object.values(["info","success","error","warning"])).isRequired};const Ln={info:"primary",success:"success",error:"error",warning:"warning"};function Ce({severity:n="info"}){return e.jsx(tn,{type:Ln[n],children:n})}const Pn=(n,s,t="")=>{if(!t||!s)return"";switch(t){case _.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return n("notification.sendStatus.reason.disabled",{channel:s});case _.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return n("notification.sendStatus.reason.unavailable",{channel:s});case _.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return n("notification.sendStatus.reason.notSent",{channel:s});case _.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return n("notification.sendStatus.reason.offline");default:return t}};function Ot(n,s,t={}){const{status:r,updatedAt:o,reason:l="",channel:b="wallet"}=t,u=o?n("notification.sendStatus.sentTime",{date:on(o,s)}):"",p=Pn(n,b,l);return r===_.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:n("notification.sendStatus.failed"),sentTime:u,reason:p}:r===_.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:n("notification.sendStatus.success"),sentTime:u}:{status:"pending",title:n("notification.sendStatus.pending"),reason:p,sentTime:u}}const $e={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Ve=["wallet","pushKit","email"],dt=["info","success","error","warning"],kt=n=>{const{settings:s}=n;return s?.notification?.email?.enabled},Dt=n=>{const{settings:s}=n;return s?.notification?.pushKit?.enabled},Fn=(n,s)=>{const t=le(s,"extra.notifications.email",!0);return{available:kt(n),enabled:t}},_n=(n,s)=>{const t=le(s,"extra.notifications.push",!0);return{available:Dt(n),enabled:t}},zn=n=>({enabled:le(n,"extra.notifications.wallet",!0)}),Wn=n=>({enabled:le(n,"extra.webhooks",[]).length>0}),Ee=(n=3)=>new Promise(s=>{setTimeout(()=>{s()},n*1e3)}),Bn=(n,s)=>s==="wallet"||s==="webhook"?[{channel:s,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:s}),fail:n("notification.sendStatus.reason.disabled",{channel:s})}]:s==="pushKit"||s==="email"?[{channel:s,type:"available",pass:n("notification.sendStatus.reason.available",{channel:s}),fail:n("notification.sendStatus.reason.unavailable",{channel:s})},{channel:s,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:s}),fail:n("notification.sendStatus.reason.disabled",{channel:s})}]:[],Ae=(n=[])=>{const s=Q().startOf("day");return n.filter(t=>Q(t.sendAt).isSame(s,"day")).length},Kn=(n,s="")=>{if(s&&Ve.includes(s)){const l=`${s}SendRecord`,b=le(n,l,[]);return Ae(b)}const t=le(n,"webhook",{}),r=Object.keys(t??{})??[];if(s&&r.includes(s)){const l=t[s]??[];return Ae(l)}const o={};return Ve.forEach(l=>{const b=`${l}SendRecord`,u=le(n,b,[]),p=Ae(u);o[l]=p}),r.length>0&&r.forEach(l=>{const b=t[l]??[],u=Ae(b);o[l]=u}),o},ke=(n,s,t)=>{if(!Array.isArray(n))throw new Error("Invalid filterList or index");return n[t].splice(s,1),n},De=(n,s)=>{if(!Array.isArray(s))throw new Error("filters must be an array");return s.length?!s.includes(n):!1},qn=n=>{switch(n){case _.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case _.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case _.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case _.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},Lt=()=>({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 de({config:n,enableTooltip:s=!0,showTitle:t=!1,children:r=null}){const{status:o,title:l="",sentTime:b="",reason:u=""}=n,p=[l,u].filter(Boolean).join(", ");return e.jsx(ut,{title:s?e.jsxs(e.Fragment,{children:[e.jsx(ee,{color:"inherit",sx:{fontSize:12},children:p}),e.jsx("span",{children:b})]}):null,arrow:!0,placement:"top",children:e.jsxs(y,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(y,{sx:{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx(y,{style:{opacity:.15},sx:{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:$e[o]}}),e.jsx(y,{sx:{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:$e[o]}})]}),e.jsx(ee,{color:"inherit",sx:{fontSize:12},children:t?l:r})]})})}de.propTypes={config:h.object.isRequired,enableTooltip:h.bool,showTitle:h.bool,children:h.node};Le.propTypes={list:h.array.isRequired,label:h.string.isRequired,onDelete:h.func};function Le({list:n,label:s,onDelete:t=()=>{}}){const{t:r,locale:o}=te();return e.jsxs(y,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsxs(ee,{children:[s,": "]}),n.map(l=>{const b=Ot(r,o,{status:l});return e.jsx(Ge,{size:"small",label:e.jsx(y,{sx:{display:"flex",alignItems:"center",gap:"4px"},children:e.jsx(de,{config:b,enableTooltip:!1,children:b.title})}),onDelete:u=>t(u,l)},l)})]})}Ze.propTypes={filterList:h.array.isRequired,onChange:h.func.isRequired,index:h.number.isRequired,column:h.object.isRequired,filterValues:h.array.isRequired,label:h.string.isRequired,renderLabel:h.func.isRequired};function Ze({filterList:n,onChange:s,index:t,column:r,filterValues:o,label:l,renderLabel:b}){return e.jsxs(V,{className:"filter-container",children:[e.jsx(pt,{component:"legend",children:l}),e.jsx(qe,{row:!0,children:o.map(u=>e.jsx(me,{control:e.jsx(Me,{checked:n[t].indexOf(u.value??u)>-1,onChange:p=>{const i=[...n];p.target.checked?i[t]=[...i[t],u.value??u]:i[t]=i[t].filter(N=>N!==(u.value??u)),s(i[t],t,r)},name:u.value??u}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:b(u)})},u.value??u))})]})}function Be(n){return e.jsx(Ze,{...n,renderLabel:s=>e.jsx(de,{enableTooltip:!1,config:{status:s.status},children:s.label})})}xe.propTypes={status:h.number.isRequired,updatedAt:h.string.isRequired,reason:h.string,channel:h.string,onResend:h.func};function xe({status:n,updatedAt:s,reason:t="",channel:r="wallet",onResend:o}){const{t:l,locale:b}=te(),u=Ot(l,b,{status:n,updatedAt:s,reason:t,channel:r});return e.jsxs(y,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(de,{config:u,showTitle:!0}),u.status!=="success"&&e.jsx(Fe,{className:"resend-btn",size:"small",startIcon:e.jsx(Je,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:o,children:l("notification.resend")})]})}Qe.propTypes={value:h.array.isRequired,onChange:h.func};function Qe({value:n,onChange:s}){const{locale:t}=te(),r=Q().toDate(),[o,l]=v.useState(null),b=v.useCallback(i=>{l(o?null:i.currentTarget)},[o]),u=!!o,p=v.useCallback(i=>{if(!i.startDate||!i.endDate){M.error("Please select a date range");return}if(Q(i.startDate).isAfter(i.endDate)||!Q(i.startDate).isValid()||!Q(i.endDate).isValid()){M.error("Invalid date range");return}s([i.startDate,i.endDate]),l(null)},[s]);return e.jsxs("div",{children:[e.jsx(ee,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},sx:{mb:0},children:e.jsxs(Fe,{onClick:b,variant:"outlined",size:"small",color:"inherit",children:[at(n[0],t)," - ",at(n[1],t)]})}),e.jsx(Ue,{open:u,anchorEl:o,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(jn,{open:!0,maxDate:r,initialDateRange:{startDate:n[0],endDate:n[1]},toggle:b,definedRanges:vn(r),onChange:p})})]})}et.propTypes={itemComponent:h.elementType.isRequired};function et({itemComponent:n,...s}){const{t}=te();return!s?.filterList?.filter(o=>o.length).length?null:e.jsxs(y,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsx("div",{className:"toolbar-filter-title",children:t("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(nn.TableFilterList,{...s,ItemComponent:n})})]})}function tt({label:n,onDelete:s,canDelete:t=()=>!0,...r}){const o=s&&typeof s=="function"?s:void 0;let l=!0;return t&&typeof t=="function"&&(l=t({label:n,...r})),e.jsx(Ge,{label:n,variant:"outlined",...o&&l?{onDelete:o}:{}})}tt.propTypes={label:h.string.isRequired,onDelete:h.func,canDelete:h.func};const Mn=[{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}];Pt.propTypes={loading:h.bool,onCancel:h.func,onConfirm:h.func};function Pt({loading:n=!1,onCancel:s=()=>{},onConfirm:t=()=>{}}){const{t:r}=te(),[o,l]=v.useState(Mn),[b,u]=v.useState(!0),p=(N,I)=>{I.checked=N.target.checked;const S=o.map(j=>({...j,checked:j.value===I.value?I.checked:j.checked}));l(S)},i=N=>{N.stopPropagation(),t({channels:o.filter(I=>I.checked).map(I=>I.value),isResendFailedOnly:b})};return e.jsxs(y,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(ee,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(y,{className:"choose-channel",children:e.jsxs(V,{component:"fieldset",variant:"standard",children:[e.jsx(pt,{component:"legend",children:r("notification.selectChannels")}),e.jsx(qe,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:o.map(N=>e.jsx(me,{control:e.jsx(Me,{checked:N.checked,onChange:I=>p(I,N),name:N.value}),label:N.label},N.value))})]})}),e.jsx(y,{className:"resend-config-footer",children:e.jsx(qe,{children:e.jsx(me,{control:e.jsx(Me,{checked:b,onChange:N=>u(N.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(y,{className:"resend-config-footer-tip",sx:{display:"flex",justifyContent:"flex-end",gap:1},children:[e.jsx(Fe,{onClick:N=>{N.stopPropagation(),s()},color:"inherit",children:r("common.cancel")}),e.jsxs(Fe,{onClick:i,color:"primary",disabled:n,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[n&&e.jsx(ft,{size:16}),r("common.confirm")]})]})]})}Ft.propTypes={notificationId:h.string.isRequired,handleResend:h.func,resending:h.bool};function Ft({notificationId:n,handleResend:s,resending:t=!1}){const{t:r,locale:o}=te(),l=ht(),b=v.useMemo(()=>jt(l,Lt()),[l]),{getReceivers:u,inService:p,teamDid:i,getUser:N,blocklet:I}=Xe(),[S,j]=v.useState(!1),[E,G]=v.useState([]),z=ye({anchorEl:null,position:null}),F=ye({anchorEl:null,position:null}),[B,R]=v.useState(null),[K,q]=v.useState({total:0,pageSize:10,pageCount:0,page:1}),[f,w]=v.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[Q().subtract(1,"month").startOf("day").toDate(),Q().endOf("day").toDate()]}),[C,a]=v.useState([]),T=[{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"}],k=async()=>{if(!S&&n)try{j(!0);const c=await u({notificationId:n,...f}),d=c.list.map(m=>({...m,receiverUser:{...m.receiverUser,avatar:It(m.receiverUser.avatar,i,p)}}));G(d),q(c.paging),j(!1)}catch(c){M.error(c.message),j(!1)}};v.useEffect(()=>{k()},[f]);const D=c=>{c.stopPropagation();const d=c.currentTarget;F.anchorEl=d;const m=d.getBoundingClientRect();F.position={top:m.top+window.scrollY,left:m.left+window.scrollX}},re=c=>c.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(ce,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(Je,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:D,children:r("notification.resend")})}):null,ue={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:K.page-1,rowsPerPage:K.pageSize,count:K.total,searchText:f.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:C,onRowSelectionChange:(c,d)=>{a(d.map(m=>m.dataIndex))},customToolbarSelect:re},oe=({page:c,rowsPerPage:d,searchText:m,filterList:O})=>{const[,U=[],ne=[],J=[]]=O;f.pageSize!==d?w(H=>({...H,pageSize:d,page:1})):f.page!==c+1?w(H=>({...H,page:c+1})):f.searchText!==m?w(H=>({...H,searchText:m,page:1})):je(U,f.walletSendStatus)?je(ne,f.pushKitSendStatus)?je(J,f.emailSendStatus)||w(H=>({...H,emailSendStatus:J,page:1})):w(H=>({...H,pushKitSendStatus:ne,page:1})):w(H=>({...H,walletSendStatus:U,page:1}))},pe=v.useCallback(async(c,d)=>{if(!d)return!1;const m=await N(d);return m?c==="wallet"?zn(m):c==="email"?Fn(I,m):c==="pushKit"?_n(I,m):c==="webhook"?Wn(m):!0:!1},[N,I]),Re=v.useCallback(c=>Bn(r,c),[r]),fe=()=>{z.anchorEl=null,z.position=null,R(null)},he=()=>{F.anchorEl=null,F.position=null},g=async(c,d,m=!0,O="")=>{if(!(!d.length||!c.length))try{s(c,d,m,O),F.anchorEl||(await Ee(.5),fe())}catch(U){console.error("handleResend error",{error:U})}},x=async({channels:c,isResendFailedOnly:d})=>{const m=C.map(O=>E[O].receiver);await g(c,m,d),await Ee(.5),he(),a([])},A=async(c,d=[],m=!0)=>{try{await g(["webhook"],[c.receiver],m,d)}catch(O){M.error(O.response?O.response.statusText:O.message)}},L=async(c,d,m,O=[],U=!0)=>{if(c.stopPropagation(),Kn(d,m)>=4){M.warning(r("notification.resendLimit"));return}if(!Ve.includes(m)){await A(d,O,U);return}if(c){const J=c.currentTarget,H=J.getBoundingClientRect();z.anchorEl=J,z.position={top:H.top+window.scrollY,left:H.left+window.scrollX}}R({channel:m});try{const J=await pe(m,d.receiver);await Ee(1),R({channel:m,result:J}),(typeof J=="boolean"&&J||Qt(J)&&Object.values(J).every(H=>!!H))&&(await s([m],[d.receiver],U),F.anchorEl||(await Ee(.5),fe()))}catch(J){M.error(J.message)}},W=c=>{w(d=>({...d,dateRange:c,page:1}))},P=(c,d,m,O)=>{c.stopPropagation();const U=m.filter(ne=>ne!==d);w(ne=>({...ne,[O]:U,page:1}))},ie=se(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:c=>{const{receiverUser:d,receiver:m}=E[c];return d?e.jsxs(y,{"data-cy":`member-name-${d.fullName}`,sx:{display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start"},children:[e.jsx(vt,{src:`${d.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:m,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(Se,{children:d.fullName})]},m):e.jsx(bn,{size:14,responsive:!1,compact:!0,copyable:!1,did:m})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:f.walletSendStatus??[],customFilterListOptions:{render:c=>e.jsx(Le,{list:c,label:"Wallet",onDelete:(d,m)=>{d.stopPropagation(),P(d,m,ie[1].options.filterList,"walletSendStatus")}}),update:ke},filterOptions:{names:T,fullWidth:!0,logic:De,display:(c,d,m,O)=>e.jsx(Be,{label:"Wallet",filterList:c,onChange:d,index:m,column:O,filterValues:T})},customBodyRenderLite:c=>{const{walletSendStatus:d,walletSendAt:m,walletSendFailedReason:O}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:O,channel:"wallet",onResend:U=>L(U,E[c],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{pushKitSendStatus:d,pushKitSendAt:m,pushKitSendFailedReason:O}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:O,channel:"pushkit",onResend:U=>L(U,E[c],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:f.pushKitSendStatus??[],customFilterListOptions:{render:c=>e.jsx(Le,{list:c,label:"Push Kit",onDelete:(d,m)=>{d.stopPropagation(),P(d,m,ie[2].options.filterList,"pushKitSendStatus")}}),update:ke},filterOptions:{names:T,fullWidth:!0,logic:De,display:(c,d,m,O)=>e.jsx(Be,{label:"Push Kit",filterList:c,onChange:d,index:m,column:O,filterValues:T})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{emailSendStatus:d,emailSendAt:m,emailSendFailedReason:O}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:O,channel:"email",onResend:U=>L(U,E[c],"email",[],!1)})},filter:!0,filterType:"custom",filterList:f.emailSendStatus??[],customFilterListOptions:{render:c=>e.jsx(Le,{list:c,label:"Email",onDelete:(d,m)=>{d.stopPropagation(),P(d,m,ie[3].options.filterList,"emailSendStatus")}}),update:ke},filterOptions:{names:T,fullWidth:!0,logic:De,display:(c,d,m,O)=>e.jsx(Be,{label:"Email",filterList:c,onChange:d,index:m,column:O,filterValues:T})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{webhook:d}=E[c];if(!d)return null;const m=Object.entries(d)[0];if(!m)return null;const[O,U]=m,ne=U[0];return e.jsx(y,{sx:{display:"flex",flexDirection:"column",gap:1},children:e.jsxs(y,{className:"webhook-item",sx:{fontSize:12},children:[e.jsx(Se,{maxLength:30,children:O},O),e.jsx(xe,{status:ne.status,updatedAt:ne.sendAt,reason:ne.failedReason,channel:"webhook",onResend:J=>L(J,E[c],"webhook",[O],!1)})]},O)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:c=>{const{createdAt:d}=E[c];return e.jsx(Nt,{value:d,locale:o,shouldUpdate:!0})}}}],[E,o,f,r]),we=[e.jsx(Qe,{value:f.dateRange,onChange:W},"date-picker"),e.jsx(ce,{variant:"contained",size:"small",color:"primary",loading:S,startIcon:e.jsx(qt,{}),onClick:()=>k(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(y,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(Hn,{children:e.jsxs(xt,{theme:b,children:[e.jsx(yt,{className:"receivers-table",locale:o,loading:S,columns:ie,data:E,onChange:oe,options:ue,customButtons:we,components:{TableFilterList:c=>e.jsx(et,{...c,itemComponent:d=>e.jsx(tt,{...d,canDelete:()=>!1})})}}),z.anchorEl&&e.jsx(Ue,{open:!!z.anchorEl,anchorReference:"anchorPosition",anchorPosition:z.position,onClose:fe,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs($n,{children:[e.jsxs(ee,{variant:"body1",component:"div",className:"check-title",children:[B?.channel," Checking"]}),e.jsx(y,{sx:{display:"flex",flexDirection:"column",gap:"4px"},children:Re(B?.channel).map(c=>{const{type:d,pass:m,fail:O}=c;return!B?.result||B?.result?.[d]?e.jsxs(ee,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:B?.result?.[d]?Oe.success.main:"inherit"},children:[B?.result?e.jsx(Mt,{}):e.jsx(ft,{size:12,sx:{color:Oe.primary.main}}),e.jsx("span",{children:m})]},d):e.jsxs(ee,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:Oe.error.main},children:[e.jsx(Ut,{}),e.jsx("span",{children:O})]},d)})})]})}),F.anchorEl&&e.jsx(Ue,{open:!!F.anchorEl,anchorReference:"anchorPosition",anchorPosition:F.position,onClose:he,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(Pt,{loading:t,onCancel:he,onConfirm:x})})]})})})}const Un=v.memo(Ft),Hn=ae.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
|
-
`,$n=ae.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
|
-
`,ve=n=>n>=1e6?`${(n/1e6).toFixed(1)}M`:n>=1e3?`${(n/1e3).toFixed(1)}K`:n;function Vn(n){const{wallet:s,push:t,email:r,webhook:o}=n;return[{name:"Wallet",value:e.jsx(ge,{item:s})},{name:"Push",value:e.jsx(ge,{item:t})},{name:"Email",value:e.jsx(ge,{item:r})},...o.total>0?[{name:"Webhook",value:e.jsx(ge,{item:o,isWebhook:!0})}]:[]]}function Gn(n,s,t){const{wallet:r,push:o,email:l,webhook:b}=n;return[{name:"Wallet",value:e.jsx(be,{loading:t,channel:_.NOTIFICATION_SEND_CHANNEL.WALLET,item:r,onResend:s})},{name:"Push",value:e.jsx(be,{loading:t,channel:_.NOTIFICATION_SEND_CHANNEL.PUSH,item:o,onResend:s})},{name:"Email",value:e.jsx(be,{loading:t,channel:_.NOTIFICATION_SEND_CHANNEL.EMAIL,item:l,onResend:s})},...b.total>0?[{name:"Webhook",value:e.jsx(be,{loading:t,channel:_.NOTIFICATION_SEND_CHANNEL.WEBHOOK,item:b,isWebhook:!0,onResend:s})}]:[]]}nt.propTypes={statistics:h.object.isRequired,onResend:h.func,mode:h.oneOf(["simple","detail"]),resending:h.bool};ge.propTypes={item:h.object.isRequired,isWebhook:h.bool};function ge({item:n,isWebhook:s=!1}){const{t}=te(),r=s?n.success.length:n.success,o=n.total,l=r===o?"success":"failed";return e.jsx(y,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:2},children:e.jsx(y,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsxs(de,{config:{status:l},enableTooltip:!1,children:[ve(r)," / ",ve(o)," ",t("notification.sendStatus.success")]})})})}be.propTypes={item:h.object.isRequired,isWebhook:h.bool,channel:h.string,onResend:h.func,loading:h.bool};function be({channel:n=_.NOTIFICATION_SEND_CHANNEL.WALLET,item:s,isWebhook:t=!1,onResend:r=()=>{},loading:o=!1}){const{t:l}=te(),{success:b,failed:u,pending:p}=s,i=qn(n),N=t?b.length:b,I=t?u.length:u,S=t?p.length:p,j=async F=>{F.stopPropagation();const B=t?[...new Set([...b,...u].map(R=>R))]:[];await r([n],[],!0,B)},E=N+I,G=E>0?N/E*100:0,z=E>0?I/E*100:0;return e.jsxs(Jn,{successRatio:G,failedRatio:z,children:[e.jsxs(ee,{variant:"h6",children:[i," (",s.total,")"]}),e.jsxs(ee,{variant:"body1",sx:{mb:2},children:[e.jsx("span",{style:{color:$e.success,fontWeight:600,fontSize:24},children:ve(N)}),e.jsx("small",{style:{paddingLeft:4},children:l("notification.sendStatus.success")})]}),e.jsxs(y,{className:"unsent-area",children:[e.jsxs(y,{children:[e.jsxs(de,{config:{status:"failed"},enableTooltip:!1,children:[ve(I)," ",l("notification.sendStatus.failed")]}),e.jsxs(de,{config:{status:"pending"},enableTooltip:!1,children:[ve(S)," ",l("notification.sendStatus.pending")]})]}),I>0&&e.jsx(y,{className:"resend-btn",children:e.jsx(ce,{size:"small",color:"primary",loading:o,variant:"contained",startIcon:e.jsx(Je,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:j,children:l("notification.resend")})})]})]})}function nt({statistics:n,mode:s="simple",onResend:t=()=>{},resending:r=!1}){const o=se(()=>s==="simple"?Vn(n):Gn(n,t,r),[n,s]);return s==="simple"?e.jsx("div",{children:o.map(l=>e.jsx(Tt,{style:{alignItems:"flex-start",marginBottom:s==="simple"?0:16},valueComponent:"div",nameWidth:100,name:l.name,children:l.value},l.name))}):e.jsx(st,{container:!0,spacing:2,children:o.map(l=>e.jsx(st,{size:{md:4,sm:6,xs:12},children:l.value},l.name))})}const Jn=ae(y)`
|
|
31
|
-
display: flex;
|
|
32
|
-
flex-direction: column;
|
|
33
|
-
align-items: flex-start;
|
|
34
|
-
padding: 16px;
|
|
35
|
-
border-radius: 8px;
|
|
36
|
-
background: ${({successRatio:n,failedRatio:s,theme:t})=>n===0&&s===0?t.palette.grey[300]:`linear-gradient(to right, ${Ht(t.palette.success.light,.4)} ${n}%, ${t.palette.grey[100]} ${n}%)`};
|
|
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
|
-
`;_t.propTypes={notification:h.object.isRequired,onCancel:h.func,blocklet:h.object.isRequired,tab:h.string};function _t({notification:n,onCancel:s=()=>{},blocklet:t,tab:r="info"}){const{t:o,locale:l}=te(),{getComponent:b,resendNotification:u}=Xe(),[p,i]=v.useState(!1),N=se(()=>b(n.componentDid)||t,[t,n.componentDid]),I=ye({tab:r||"info"}),S=v.useCallback(async(f,w,C=!0,a=[])=>{if(!f.length||!n.id)return;const T=w.length>0?w:n?.receivers?.map(D=>D.receiver);if(!T.length)return;let k=[...f];if(k.includes(_.NOTIFICATION_SEND_CHANNEL.PUSH)&&!Dt(t)&&(M.warning(o("notification.sendStatus.reason.unavailable",{channel:"Push Kit"})),k=k.filter(D=>D!==_.NOTIFICATION_SEND_CHANNEL.PUSH)),k.includes(_.NOTIFICATION_SEND_CHANNEL.EMAIL)&&!kt(t)&&(M.warning(o("notification.sendStatus.reason.unavailable",{channel:"Email"})),k=k.filter(D=>D!==_.NOTIFICATION_SEND_CHANNEL.EMAIL)),!!k.length)try{i(!0),await u({notificationId:n.id,receivers:T,channels:k,resendFailedOnly:C,...k.includes("webhook")&&a.length?{webhookUrls:a}:{}}),M.success("Message has been sent!")}catch(D){console.error("handleResend error",{error:D}),M.error(D.response?D.response.statusText:D.message)}finally{i(!1)}},[t,n.id,n?.receivers,u,o]),j=se(()=>hn(n),[n]),E=se(()=>xn(n),[n]),G=se(()=>j?n?.actorInfo:[],[n]),z=se(()=>t?.did||t?.meta?.did||"",[t]);function F(){return[{name:o("notification.from"),value:j&&E?e.jsx(un,{actors:G,teamDid:z,size:32,showName:!0}):e.jsx(mn,{size:32,blocklet:N,showName:!0,hideDot:!0})},{name:o("notification.notificationTitle"),value:e.jsx(Se,{maxLength:50,children:n.title})},{name:o("notification.body"),value:j?e.jsx(pn,{notification:n,blocklet:t}):e.jsx(gn,{notification:n,rows:0})},{name:o("notification.severity"),value:e.jsx(Ce,{severity:n.severity})},{name:o("notification.createdAt"),value:e.jsx(sn,{value:n.createdAt,locale:l,shouldUpdate:!0,type:"all"})}].map(w=>e.jsx(Tt,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:120,name:w.name,children:w.value},w.name))}const B={info:{label:o("common.basicInfo"),value:"info",component:F},receivers:{label:o("notification.receiver"),value:"receivers"},statistics:{label:o("notification.statistics"),value:"statistics"}},R=Object.values(B).map(({label:f,value:w})=>({label:f,value:w})),K=B[I.tab]||B.info,q=f=>{I.tab=f};return e.jsx(St,{title:o("notification.notificationDetails"),fullWidth:!0,maxWidth:"lg",onClose:()=>{I.tab="info",s()},open:!0,actionsPosition:"left",sx:{".ux-dialog_header":{paddingBottom:0},".MuiDialogContent-root":{paddingTop:0}},children:e.jsxs(Xn,{children:[e.jsx(y,{className:"tabs",sx:{mx:3},children:e.jsx(bt,{tabs:R,current:I.tab,onChange:q,scrollButtons:"auto"})}),e.jsxs("div",{className:"body",children:[I.tab==="receivers"&&e.jsx(Un,{notificationId:n.id,resending:p,handleResend:S}),I.tab==="statistics"&&e.jsx(nt,{statistics:n.statistics,mode:"detail",resending:p,onResend:S}),I.tab==="info"&&e.jsx(K.component,{})]})]})})}const Yn=v.memo(_t),Xn=ae.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: ${Oe.text.disabled};
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
`;Pe.propTypes={blocklet:h.object,label:h.string};const Zn=ae.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 Pe({blocklet:n=null,label:s=""}){return e.jsx(Zn,{children:n?e.jsxs(e.Fragment,{children:[e.jsx(Et,{size:24,blocklet:n,ancestors:n.ancestors}),e.jsx("span",{className:"name",children:n.title||n.meta?.title})]}):e.jsx("span",{className:"name",children:s})})}zt.propTypes={list:h.array.isRequired,label:h.string.isRequired,onDelete:h.func};function zt({list:n,label:s,onDelete:t=()=>{}}){return e.jsxs(y,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsxs(ee,{children:[s,": "]}),n.map(r=>e.jsx(Ge,{size:"small",label:e.jsx(y,{sx:{display:"flex",alignItems:"center",gap:"4px"},children:e.jsx(Ce,{severity:r})}),onDelete:o=>t(o,r)},r))]})}function Qn(n){return e.jsx(Ze,{...n,renderLabel:s=>e.jsx(Ce,{severity:s})})}function es({customTableButtons:n}){const{t:s,locale:t}=te(),r=ht(),o=v.useMemo(()=>jt(r,Lt()),[r]),[l,b]=v.useState(!1),{data:u,paging:p,blocklet:i,fetch:N,getComponent:I,componentDids:S,inService:j,teamDid:E}=Xe(),G=v.useRef(null),[z,F]=v.useState(null),[B,R]=v.useState("info"),K=yn(),[q,f]=v.useState(!1),w=`notification-records-${i.meta?.did}`,C=an(w),[a,T]=v.useState({pageSize:C.rowsPerPage||10,page:C.page?C.page+1:1,dids:C.dids||[],dateRange:C.dateRange||[Q().subtract(1,"month").startOf("day").toDate(),Q().endOf("day").toDate()]}),k=se(()=>{if(!i.children||!i.children.length)return[];const g=[];return i.children.forEach(x=>{const A=x.did||x.meta?.did;S.includes(A)&&(x.ancestors=[i],g.push(x))}),g},[S,i]),D=async g=>{try{b(!0),await N(g),b(!1)}finally{b(!1)}};v.useEffect(()=>{D(a)},[a]),v.useEffect(()=>{const g=u.find(x=>x.id===z?.id);z&&g&&F({...g})},[u]);const re=(g,x,A,L)=>{g.stopPropagation();const W=A.filter(P=>P!==x);T(P=>({...P,[L]:W,page:1}))},ue=({page:g,rowsPerPage:x,filterList:A})=>{const[L=[],,,,W=[]]=A;a.pageSize!==x?T(P=>({...P,pageSize:x,page:1})):a.page!==g+1?T(P=>({...P,page:g+1})):je(a.dids,L)?je(a.severities,W)||T(P=>({...P,severities:W,page:1})):T(P=>({...P,dids:L,page:1}))},oe=v.useCallback(()=>{F(null),R("info")},[]),pe=v.useCallback(()=>{N(a)},[N,a]),Re=[{label:s("notification.from"),name:"sender",width:400,options:{filter:!0,filterType:"custom",customFilterListOptions:{render:g=>g.map((x,A)=>{if(x==="system")return e.jsx("span",{children:s("notification.system")},`system-${A}`);const L=k.find(W=>(W.did||W.meta?.did)===x);return e.jsx(Pe,{blocklet:L,label:L?.title||L?.meta?.title},x)}),update:(g,x,A)=>(g[A].splice(x,1),g)},filterOptions:{names:k,logic:(g,x)=>x.length?!x.includes(g):!1,display:(g,x,A,L)=>e.jsxs(V,{style:{width:"380px"},children:[e.jsx($t,{id:"demo-simple-select-label",style:{background:"#ffffff"},children:"Sender"}),e.jsxs(Vt,{multiple:!0,value:g[A],renderValue:W=>e.jsx(y,{style:{overflow:"hidden",textOverflow:"ellipsis"},sx:{display:"flex",gap:1,alignItems:"center"},children:W.map(P=>{if(P==="system")return e.jsx("span",{children:s("notification.system")},P);const ie=k.find(we=>(we.did||we.meta?.did)===P);return e.jsx(Pe,{blocklet:ie,label:ie?.title||ie?.meta?.title},P)})}),onChange:W=>{g[A]=W.target.value,x(g[A],A,L)},children:[e.jsx(it,{value:"system",children:s("notification.system")}),k.map(W=>{const P=W.did||W.meta?.did;return e.jsx(it,{value:P,children:e.jsx(Pe,{blocklet:W,label:W.title||W.meta?.title})},P)})]})]})},customBodyRenderLite:g=>{const x=u[g],A=I(x.componentDid);return e.jsxs(y,{sx:{display:"flex",alignItems:"center",gap:1},children:[A?e.jsx(Et,{size:32,blocklet:A,ancestors:A.ancestors??[]}):e.jsx(fn,{blocklet:i,size:32}),e.jsx(Se,{maxLength:50,children:A?.meta?.title||i?.meta?.title})]})}}},{label:s("notification.receiver"),name:"receivers",width:300,options:{filter:!1,customBodyRenderLite:g=>{const x=u[g],{receivers:A}=x;return e.jsx(Gt,{total:A.length,renderSurplus:L=>L<100?e.jsxs("span",{children:["+",L]}):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:L=>{L.stopPropagation(),F(x),R("receivers")},children:A.map(L=>{const{receiverUser:W}=L,P=It(W.avatar,E,j);return e.jsx(vt,{alt:W.fullName,src:`${P}?imageFilter=resize&w=48&h=48`,size:32,did:L.receiver,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}},L.receiver)})})}}},{label:s("notification.statistics"),name:"statistics",width:400,options:{filter:!1,customBodyRenderLite:g=>{const x=u[g];return e.jsx(y,{onClick:A=>{A.stopPropagation(),F(x),R("statistics")},children:e.jsx(nt,{statistics:x.statistics})})}}},{label:s("notification.notificationPreview"),name:"data",options:{filter:!1,customBodyRenderLite:g=>{const x=u[g];return e.jsx(Se,{maxLength:50,children:x.title})}}},{label:s("notification.severity"),name:"severity",width:200,options:{setCellProps:()=>({className:"severity-cell"}),customBodyRenderLite:g=>{const x=u[g];return e.jsx(Ce,{severity:x.severity})},filter:!0,filterType:"custom",filterList:a.severities??[],customFilterListOptions:{render:g=>e.jsx(zt,{list:g,label:s("notification.severity"),onDelete:(x,A)=>{x.stopPropagation(),re(x,A,Re[4].options.filterList,"severities")}}),update:ke},filterOptions:{names:dt,fullWidth:!0,logic:De,display:(g,x,A,L)=>e.jsx(Qn,{label:s("notification.severity"),filterList:g,onChange:x,index:A,column:L,filterValues:dt})}}},{label:s("common.createdAt"),name:"createdAt",width:300,options:{filter:!1,customBodyRenderLite:g=>{const{createdAt:x}=u[g];return e.jsx(Nt,{value:x,locale:t,shouldUpdate:!0})}}}],fe=g=>{T(x=>({...x,dateRange:g,page:1}))},he=[e.jsxs(y,{sx:{display:"flex",alignItems:"center",gap:1.5},children:[e.jsx(Jt,{onClick:()=>f(!0),sx:{p:K?0:void 0},children:e.jsx(Yt,{})},"settings"),K?e.jsx(ee,{children:s("common.setting")}):null]}),...n||[]];return e.jsxs(y,{ref:G,sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:[e.jsx(ts,{children:e.jsx(xt,{theme:o,children:e.jsx(yt,{className:"main-table",verticalKeyWidth:100,loading:l,locale:t,columns:Re,data:u,durable:w,onChange:ue,options:{sort:!1,download:!1,print:!1,search:!1,expandableRowsOnClick:!0,page:p.page-1,rowsPerPage:p.pageSize,count:p.total,...C,onRowClick:(g,{dataIndex:x})=>{F(u[x])}},customPreButtons:[e.jsx(Qe,{value:a.dateRange,onChange:fe})],customButtons:he,components:{TableFilterList:g=>e.jsx(et,{...g,itemComponent:x=>e.jsx(tt,{...x,canDelete:A=>A?.columnNames?.[A?.index||0]?.name==="sender"})})}})})}),z&&e.jsx(Yn,{refresh:pe,onCancel:oe,notification:z,blocklet:i,tab:B}),e.jsx(St,{title:`${s("common.notification")} ${s("common.setting")}`,fullWidth:!0,maxWidth:"md",open:q,onClose:()=>f(!1),PaperProps:{style:{minHeight:"500px"}},children:e.jsx(y,{sx:{mt:"-16px",overflowY:"hidden"},children:e.jsx(On,{})})})]})}const ts=ae.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
|
-
`;ns.propTypes={blocklet:h.object.isRequired,customTableButtons:h.array};function ns({blocklet:n={},customTableButtons:s=[]}){return e.jsx(Dn,{blocklet:n,children:e.jsx(es,{customTableButtons:s})})}export{ns as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as o}from"./vendor-mui-core-Bq_sfmbr.js";import"./vendor-react-Dvs43sk9.js";import{S as t}from"./studio-1TB86ZrO.js";import"./vendor-ux-D0eHYGOw.js";import"./vendor-utils-DQK0pEML.js";import"./vendor-hooks-DLNZ8kxG.js";import"./lottie-web-4koyQiv_.js";import"./index-BC_z-zsl.js";import"./index-Br7RGSFv.js";import"./vendor-arcblock-DNHIum0y.js";function f(){return o.jsx(t,{children:"Coming soon..."})}export{f as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{z as e,A as s}from"./vendor-ux-D0eHYGOw.js";const c=e("blocklet-services");s("blocklet-services");export{c as d};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as r}from"./vendor-mui-core-Bq_sfmbr.js";import{_ as o}from"./user-center-CNEk-tbg.js";import{H as i}from"./index-Br7RGSFv.js";import{T as e}from"./vendor-ux-D0eHYGOw.js";import"./vendor-react-Dvs43sk9.js";import"./vendor-hooks-DLNZ8kxG.js";import"./vendor-utils-DQK0pEML.js";import"./index-CipehFwZ.js";import"./arrow-down.svg-CeA5tsyp.js";import"./user-sessions-vBiV3ZpR.js";import"./index-ejiOKw1E.js";import"./index-CcYh_TwI.js";import"./vendor-arcblock-DNHIum0y.js";import"./index-O6p0L2t4.js";import"./index-DRYJ0xIl.js";import"./index-BojVbZw0.js";import"./index-C14bbQSS.js";import"./lottie-web-4koyQiv_.js";function H(){const{t}=e();return r.jsxs(r.Fragment,{children:[r.jsx(i,{children:r.jsx("title",{children:t("pageTitle.userCenter")})}),r.jsx(o,{onlyProfile:!0,currentTab:"",disableAutoRedirect:!0})]})}export{H as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as o}from"./index-Br7RGSFv.js";const e=o();export{e as b};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import{r as j}from"./vendor-react-Dvs43sk9.js";import{k as O,n as z,o as W,b as K}from"./vendor-hooks-DLNZ8kxG.js";import{j as o,ak as n,Q as v,n as T,s as S,ar as m,W as i}from"./vendor-mui-core-Bq_sfmbr.js";import{T as k,O as Q}from"./vendor-ux-D0eHYGOw.js";import{B as V,o as Z,l as G}from"./index-JrJd98Of.js";import{J as H}from"./vendor-utils-DQK0pEML.js";import{Z as E,c as J}from"./index-Br7RGSFv.js";import{u as X}from"./session-Ba0-LWgc.js";import{u as Y}from"./use-mobile-D2h0sedv.js";const B=20,C={currentTab:i.string.isRequired},F={user:i.object.isRequired,column:i.number};function ee(){return o.jsxs(n,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:[o.jsxs(n,{sx:{display:"flex",alignItems:"center",gap:2,mb:1},children:[o.jsx(m,{variant:"circular",width:48,height:48}),o.jsxs(n,{sx:{flex:1},children:[o.jsx(m,{variant:"text",width:"60%",height:20}),o.jsx(m,{variant:"text",width:"80%",height:16})]})]}),o.jsx(m,{variant:"text",width:"40%",height:14})]})}function R({currentTab:e}){const{t:l}=k(),r=l(e==="following"?"team.userFollowers.emptyFollowing":"team.userFollowers.emptyFollowers");return o.jsx(Q,{children:r})}R.propTypes=C;function D({user:e,teamDid:l,currentTab:r,column:a=2,onToggleFollow:c=void 0,refresh:s=()=>{},followed:p=!1,showSocialActions:h=!0}){const{t:f,locale:x}=k(),{api:g}=E(),{session:w}=X(),u=j.useRef(null),[M]=z(u),A=Y({key:"md"}),{data:U,loading:L,loadMore:y,loadingMore:_}=W(async t=>{if(!e?.did)return{list:[],total:0};const d=t?Math.ceil(t.list.length/B)+1:1,$=await(r==="following"?g.getUserFollowing:g.getUserFollowers)({input:{teamDid:l,userDid:e.did,type:r,paging:{page:d,pageSize:B}}});return{list:$?.data||[],total:$?.paging?.total||0}},{reloadDeps:[r,e?.did,p],isNoMore:t=>t?.list.length?t.list.length>=t?.total:!0}),{list:b=[],total:q=0}=U||{},I=b.length<q,P=K(t=>{if(!t?.did)return;const d=H(J.WELLKNOWN_BLOCKLET_USER_PATH,{did:t.did,locale:x});window.open(d,"_blank")});return j.useEffect(()=>{M&&y()},[M,y]),L?o.jsx(n,{sx:{py:2,display:"grid",gridTemplateColumns:{xs:"1fr",sm:`repeat(${a}, 1fr)`},gap:2},children:Array.from({length:6},(t,d)=>`skeleton-${r}-${d}`).map(t=>o.jsx(ee,{},t))}):b.length===0?o.jsx(R,{currentTab:r}):o.jsxs(n,{children:[o.jsx(n,{className:"user-list",sx:{px:A?0:1,py:2,display:"grid",gridTemplateColumns:{md:"1fr",lg:`repeat(${a}, 1fr)`},gap:2},children:b.map(t=>{const d=r==="following"?t.userDid:t.followerDid;return o.jsx(n,{className:"user-item",children:o.jsx(V,{user:t.user,showDid:!0,cardType:G.CARD,infoType:Z.INFO,session:w,showSocialActions:h,onAvatarClick:P})},d)})}),I?o.jsx(n,{sx:{display:"flex",justifyContent:"center",mt:2},children:o.jsx(v,{variant:"text",color:"primary",onClick:y,ref:u,children:f(_?"common.loading":"webhookEndpoint.loadMore")})}):null]})}D.propTypes={...C,...F,onToggleFollow:i.func,followed:i.bool};function N({data:e,currentTab:l,onTabChange:r}){const{t:a}=k(),c=[{label:a("team.userFollowers.following"),value:"following",count:e?.following||0},{label:a("team.userFollowers.followers"),value:"followers",count:e?.followers||0}];return o.jsx(n,{children:c.map(s=>o.jsxs(te,{className:l===s.value?"active":"",onClick:()=>r(s.value),children:[s.label,s.count>0&&o.jsxs("span",{className:"count",style:{marginLeft:4},children:["(",s.count>99?"99+":s.count,")"]})]},s.value))})}N.propTypes={...C,...F,onTabChange:i.func.isRequired};function oe({user:e,teamDid:l,column:r=2,onToggleFollow:a=void 0,followed:c=!1,showSocialActions:s=!0}){const[p,h]=j.useState("following"),{api:f}=E(),{data:x,refresh:g}=O(async()=>e?.did?(await f.getUserFollowStats({input:{teamDid:l,userDids:[e.did]}}))?.data?.[e.did]||{following:0,followers:0}:{following:0,followers:0},{refreshDeps:[e?.did,c]}),w=u=>{h(u)};return o.jsxs(n,{children:[o.jsx(N,{data:x,user:e,currentTab:p,onTabChange:w}),o.jsx(D,{column:r,user:e,onToggleFollow:a,currentTab:p,teamDid:l,followed:c,refresh:g,showSocialActions:s},p)]})}oe.propTypes={...F,teamDid:i.string.isRequired,followed:i.bool,onToggleFollow:i.func};const te=S(v)`
|
|
2
|
-
&.MuiButtonBase-root {
|
|
3
|
-
border-radius: 9999px;
|
|
4
|
-
margin-right: 2px;
|
|
5
|
-
padding: 5px 12px;
|
|
6
|
-
line-height: 22px;
|
|
7
|
-
font-size: 13px;
|
|
8
|
-
background-color: ${({theme:e})=>e.palette.background.default};
|
|
9
|
-
color: ${({theme:e})=>e.palette.text.primary};
|
|
10
|
-
font-weight: 400;
|
|
11
|
-
border: 1px solid ${({theme:e})=>e.palette.divider} !important;
|
|
12
|
-
}
|
|
13
|
-
&.active.MuiButtonBase-root,
|
|
14
|
-
&.active.MuiButtonBase-root:hover {
|
|
15
|
-
color: ${({theme:e})=>e.palette.primary.main};
|
|
16
|
-
font-weight: 600;
|
|
17
|
-
background-color: ${({theme:e})=>T(e.palette.primary.main,.1)};
|
|
18
|
-
border: 1px solid ${({theme:e})=>T(e.palette.primary.main,.24)} !important;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
&.MuiButtonBase-root:hover {
|
|
22
|
-
background-color: rgba(0, 0, 0, 0.04);
|
|
23
|
-
}
|
|
24
|
-
`;S(v)`
|
|
25
|
-
color: ${({theme:e})=>e.palette.text.primary};
|
|
26
|
-
font-weight: 500;
|
|
27
|
-
border-color: ${({theme:e})=>e.palette.grey[300]};
|
|
28
|
-
line-height: 1.5;
|
|
29
|
-
&:hover {
|
|
30
|
-
background-color: ${({theme:e})=>T(e.palette.primary.main,.1)};
|
|
31
|
-
}
|
|
32
|
-
`;export{oe as U};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e,U as i}from"./vendor-ux-D0eHYGOw.js";import{ah as _,ai as a}from"./index-Br7RGSFv.js";import{j as r}from"./vendor-mui-core-Bq_sfmbr.js";const u={en:_(a),ar:()=>e(()=>import("./ar-CPI6kJBB.js"),[]).then(t=>_(t.default)),de:()=>e(()=>import("./de-DXdF82Jr.js"),[]).then(t=>_(t.default)),es:()=>e(()=>import("./es-Cdb297yS.js"),[]).then(t=>_(t.default)),fr:()=>e(()=>import("./fr-CQValz_y.js"),[]).then(t=>_(t.default)),hi:()=>e(()=>import("./hi-CAensap9.js"),[]).then(t=>_(t.default)),id:()=>e(()=>import("./id-6AFgcYKj.js"),[]).then(t=>_(t.default)),ja:()=>e(()=>import("./ja-D59y1sZ9.js"),[]).then(t=>_(t.default)),ko:()=>e(()=>import("./ko-DlSyClni.js"),[]).then(t=>_(t.default)),pt:()=>e(()=>import("./pt-C_3CX1PR.js"),[]).then(t=>_(t.default)),ru:()=>e(()=>import("./ru-FBGLUlo5.js"),[]).then(t=>_(t.default)),th:()=>e(()=>import("./th-DmSMYMH5.js"),[]).then(t=>_(t.default)),vi:()=>e(()=>import("./vi-CjDg6MoB.js"),[]).then(t=>_(t.default)),"zh-TW":()=>e(()=>import("./zh-tw-DaxtX1HY.js"),[]).then(t=>_(t.default)),zh:()=>e(()=>import("./zh-DaR6QxjC.js"),[]).then(t=>_(t.default))};function f(t){return function(o){return r.jsx(i,{translations:u,children:r.jsx(t,{...o})})}}export{f as w};
|