@abtnode/blocklet-services 1.16.47-beta-20250729-133234-77359596 → 1.16.47-beta-20250730-070104-87a128a5
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/libs/auth/adapters/twitter.js +1 -1
- package/api/routes/oauth/client.js +9 -2
- package/dist/assets/{access-control-DYSDECUw.js → access-control-FYs8JoGO.js} +1 -1
- package/dist/assets/{add-component-core-ofLBd0tu.js → add-component-core-BB6rCC8n.js} +1 -1
- package/dist/assets/{add-resource-BJEI6PbV.js → add-resource-BlKrIrw0.js} +1 -1
- package/dist/assets/{addon-yoa0x6-0.js → addon-g3Lz4kfk.js} +1 -1
- package/dist/assets/{advanced-C40fcsMj.js → advanced-DyVpf_DB.js} +1 -1
- package/dist/assets/{aigne-CO_-YbPk.js → aigne-B2kmHT_s.js} +1 -1
- package/dist/assets/{appearance-ChoNlV7r.js → appearance-D0WJqn3Y.js} +1 -1
- package/dist/assets/{arrow-down.svg-CW9W9wI1.js → arrow-down.svg-CH8Xzna_.js} +1 -1
- package/dist/assets/{audit-logs-DjxskWcd.js → audit-logs-BLZ_FXya.js} +1 -1
- package/dist/assets/{authorize-u1RPtGlb.js → authorize-DqbV7Yj5.js} +1 -1
- package/dist/assets/{branding-Da8E_HdC.js → branding-B_9Ik1Ul.js} +1 -1
- package/dist/assets/{branding-M86FUBw6.js → branding-CbIhan7S.js} +2 -2
- package/dist/assets/{bundle-avatar-JsO8Rdzw.js → bundle-avatar-DzIGEDbC.js} +1 -1
- package/dist/assets/{complete-D_rU8GhU.js → complete-Cx5YFdNr.js} +1 -1
- package/dist/assets/{component-CYmSwtxC.js → component-99-uAXc0.js} +3 -3
- package/dist/assets/{config-Bel7KIi4.js → config-B4lheVsX.js} +1 -1
- package/dist/assets/{config-BICnV2kA.js → config-Dr0r0k-g.js} +1 -1
- package/dist/assets/{config-navigation-D8OXRCt9.js → config-navigation-ToPhdOjg.js} +3 -3
- package/dist/assets/{config-space-ODrN5Rt0.js → config-space-CT21iR_2.js} +1 -1
- package/dist/assets/config-yxcrU66X.js +26 -0
- package/dist/assets/{confirm-CXK9v894.js → confirm-5e46DDlz.js} +1 -1
- package/dist/assets/{connect-yrGsuleV.js → connect-BHDDk939.js} +1 -1
- package/dist/assets/{connect-ig-5oJbW.js → connect-hooMfIaO.js} +1 -1
- package/dist/assets/{connect-to-BpYFEl7i.js → connect-to-DfxSuVNx.js} +1 -1
- package/dist/assets/{dashboard-VE3KX6Hk.js → dashboard-DaKd1daE.js} +3 -3
- package/dist/assets/{delete-confirm-CpZStjie.js → delete-confirm-Bim07gVu.js} +1 -1
- package/dist/assets/{domain-DbJ3kJI3.js → domain-D_RRXHNv.js} +1 -1
- package/dist/assets/{domain-action-card-2vqk_Ni_.js → domain-action-card-BTosQrln.js} +1 -1
- package/dist/assets/{domains-BsCL1ViY.js → domains-BV1O_rDN.js} +1 -1
- package/dist/assets/{email-D_7GvtZA.js → email-BCDbiSlJ.js} +1 -1
- package/dist/assets/engine-BVHpout7.js +1 -0
- package/dist/assets/{exchange-passport-BGTYcBca.js → exchange-passport-DIp9EJVY.js} +1 -1
- package/dist/assets/{form-CjYT8hk5.js → form-BVnHvgNl.js} +1 -1
- package/dist/assets/{fuel-CBt1g8zp.js → fuel-Fh-ifxfq.js} +1 -1
- package/dist/assets/{gen-access-key-DPNQGDvj.js → gen-access-key-BZufQ91-.js} +1 -1
- package/dist/assets/{gen-simple-access-key-Ctn_w0mo.js → gen-simple-access-key-DlPE_0y2.js} +1 -1
- package/dist/assets/{get-safe-url-oiWXWYvc.js → get-safe-url-D9ZX2qFm.js} +1 -1
- package/dist/assets/{home-USnWZhK5.js → home-B6em2u64.js} +1 -1
- package/dist/assets/{iframe-Ci5Ay1y2.js → iframe-Dl-5xRyx.js} +1 -1
- package/dist/assets/{index-PcQgNtUn.js → index-1-P2gWGZ.js} +1 -1
- package/dist/assets/{index-Bgm1cW2N.js → index-467tNKTx.js} +1 -1
- package/dist/assets/{index-DHLC0F8S.js → index-7fdKVdEw.js} +1 -1
- package/dist/assets/{index-cdAwhti6.js → index-B6RoOcNF.js} +1 -1
- package/dist/assets/{index-CoPcipTj.js → index-B88jr6sm.js} +1 -1
- package/dist/assets/{index-CwdidKu0.js → index-B_JPa3k-.js} +1 -1
- package/dist/assets/{index-Bz6T9WJi.js → index-BituGg_i.js} +1 -1
- package/dist/assets/{index-NhYP56dI.js → index-CC1_0xzr.js} +4 -4
- package/dist/assets/{index-Bg6_NsC_.js → index-Ca2q4nT6.js} +1 -1
- package/dist/assets/{index-FrAYP-A_.js → index-D6YhMyoB.js} +4 -4
- package/dist/assets/{index-DAg_a68C.js → index-D6ZAoKh5.js} +1 -1
- package/dist/assets/{index-Bnhg3YZe.js → index-DIeXMLLs.js} +1 -1
- package/dist/assets/{index-MJKS-RJU.js → index-DTuL5S3g.js} +1 -1
- package/dist/assets/{index-B8KTykXs.js → index-DZFL6rrK.js} +1 -1
- package/dist/assets/{index-BdKTdgAu.js → index-DiW2Y89J.js} +1 -1
- package/dist/assets/{index-CE07Exux.js → index-DmgU5YEy.js} +1 -1
- package/dist/assets/{index-D9r0lvN6.js → index-DraljbB7.js} +1 -1
- package/dist/assets/{index-CZiEDWpM.js → index-DscHS5BG.js} +1 -1
- package/dist/assets/{index-BkSX50ri.js → index-Eagwj9HU.js} +1 -1
- package/dist/assets/{index-D_g21v0z.js → index-W7Vsgxmq.js} +3 -3
- package/dist/assets/{index-Bga8wqEa.js → index-YhHgNT9f.js} +1 -1
- package/dist/assets/{index-IMquU8ZG.js → index-ckUPtmoF.js} +1 -1
- package/dist/assets/{index-CGHTnzaK.js → index-h4nZrNlX.js} +1 -1
- package/dist/assets/{index-BwxOZ_PS.js → index-pvfQRiIz.js} +1 -1
- package/dist/assets/{invitation-DRsYGsRz.js → invitation-ygFxiD0p.js} +1 -1
- package/dist/assets/{invite-NVVbFYlq.js → invite-DMpU1WKR.js} +1 -1
- package/dist/assets/{isURL-BKM8U6hZ.js → isURL-CTW__dzu.js} +1 -1
- package/dist/assets/{issue-passport-7Rfhc8hs.js → issue-passport-CH_GIDha.js} +1 -1
- package/dist/assets/{item-DMRC_0Pl.js → item-BpwJ2QYy.js} +1 -1
- package/dist/assets/{landing-page-Dc4hRNuW.js → landing-page-Cd61UT7Z.js} +1 -1
- package/dist/assets/{layout-BGLUR5z_.js → layout-Bf7XRYSR.js} +1 -1
- package/dist/assets/{list-X2F1RKzQ.js → list-A-6ZKqgn.js} +1 -1
- package/dist/assets/{list-DgH58u4D.js → list-BHhWPWs4.js} +2 -2
- package/dist/assets/{localization-sp8DBpxc.js → localization-D1S2pks-.js} +1 -1
- package/dist/assets/{log-EgLjQcxJ.js → log-ryKQFCdM.js} +1 -1
- package/dist/assets/{login-BrQzzFXX.js → login-CYXIFDX8.js} +1 -1
- package/dist/assets/{login-oauth-callback-DaVwf7V2.js → login-oauth-callback-DAKrg2Ne.js} +1 -1
- package/dist/assets/{logo-uploader-DgSolZrp.js → logo-uploader-DDncXmM_.js} +2 -2
- package/dist/assets/{lost-passport-DEW2BulR.js → lost-passport-DEoDgh2I.js} +1 -1
- package/dist/assets/{open-window-CcbW4k1o.js → open-window-eYnS4Amh.js} +1 -1
- package/dist/assets/{over-due-invoice-payment-Ba3rEZjM.js → over-due-invoice-payment-CnaSUbBp.js} +1 -1
- package/dist/assets/{overview-CS6bfsq0.js → overview-BbhCPjub.js} +1 -1
- package/dist/assets/{passport-item-BniPqqnO.js → passport-item-CPGYYOeu.js} +1 -1
- package/dist/assets/{permission-w0BesrB_.js → permission-B0EjzZOA.js} +1 -1
- package/dist/assets/{preferences-YUKuGDai.js → preferences-CoP65AxI.js} +1 -1
- package/dist/assets/{profile-embed-D8T7nOel.js → profile-embed-CdAkuRfH.js} +1 -1
- package/dist/assets/{publish-resource-DAqbWOIX.js → publish-resource-O6nixlJ9.js} +1 -1
- package/dist/assets/{runtime-CYnDo-HU.js → runtime-lAc0mbn0.js} +1 -1
- package/dist/assets/sdk-CiRRFKs0.js +1 -0
- package/dist/assets/{security-DLgKehuW.js → security-DzpCKO8Z.js} +1 -1
- package/dist/assets/{session-Ci_4G0CP.js → session-fyUi2EvV.js} +1 -1
- package/dist/assets/{setup-Cq1C8BeD.js → setup-BtNJlN-g.js} +3 -3
- package/dist/assets/{spaces-C1LV9UvU.js → spaces-Ci_JwPPC.js} +1 -1
- package/dist/assets/{start-CaaDhsmK.js → start-CvpuRdlI.js} +1 -1
- package/dist/assets/{status-BeqBWyAi.js → status-BYn5dcxB.js} +1 -1
- package/dist/assets/{step-actions-C8wc4rOR.js → step-actions-vNi6kxQk.js} +1 -1
- package/dist/assets/{studio-C-1N3D23.js → studio-CU2xUA6B.js} +1 -1
- package/dist/assets/{team-CD3vKVPJ.js → team-Bxi69lmr.js} +1 -1
- package/dist/assets/{traffic-h7MLT42d.js → traffic-5kSM9zFo.js} +1 -1
- package/dist/assets/{transfer-BgDlNRZV.js → transfer-1mPm3DHh.js} +1 -1
- package/dist/assets/{unsubscribe-DmHvwVjR.js → unsubscribe-BHRGSL9f.js} +1 -1
- package/dist/assets/{use-promise-window-open-ecxT8x1I.js → use-promise-window-open-DzOXAig9.js} +1 -1
- package/dist/assets/{user-center-Cveaoeez.js → user-center-D7U8E_9U.js} +3 -3
- package/dist/assets/{user-sessions-D9ZCFiu3.js → user-sessions-CFuRw6Kk.js} +1 -1
- package/dist/assets/{util-Bgqx2flh.js → util-CxrGdmDd.js} +1 -1
- package/dist/assets/{util-CJadXi8V.js → util-DhFzZqQY.js} +1 -1
- package/dist/assets/{wrap-locale-B4B-XHcF.js → wrap-locale-CnZSJgmv.js} +1 -1
- package/dist/assets/{zh-DOMhcyY9.js → zh-IccOJN0P.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/service-worker.js +1 -1
- package/package.json +23 -23
- package/dist/assets/config-Dh0hZZiY.js +0 -26
- package/dist/assets/engine-Ch-5kOUZ.js +0 -1
- package/dist/assets/sdk-DAF46Tln.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CgdhTqWX.js","assets/vendor-react-Dvs43sk9.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{T as M,c as q,_ as w,H as C,e as Q,f as J}from"./vendor-ux-CUBj5GXM.js";import{j as t,b1 as f,b0 as X,b2 as Z,T as b,Q as T,a$ as ee,ak as B,z as $,a6 as te,at as se}from"./vendor-mui-core-CcrDM-5l.js";import{r as i,u as ne}from"./vendor-react-Dvs43sk9.js";import{H as g}from"./vendor-utils-BOkrEpKO.js";import{a as ie,F as h,e as O,c as j,H as oe,G as re}from"./index-
|
|
2
|
+
import{T as M,c as q,_ as w,H as C,e as Q,f as J}from"./vendor-ux-CUBj5GXM.js";import{j as t,b1 as f,b0 as X,b2 as Z,T as b,Q as T,a$ as ee,ak as B,z as $,a6 as te,at as se}from"./vendor-mui-core-CcrDM-5l.js";import{r as i,u as ne}from"./vendor-react-Dvs43sk9.js";import{H as g}from"./vendor-utils-BOkrEpKO.js";import{a as ie,F as h,e as O,c as j,H as oe,G as re}from"./index-D6YhMyoB.js";import{l as ae}from"./vendor-arcblock-BnbwP1kf.js";import{K as ce}from"./landing-page-Cd61UT7Z.js";import{f as _}from"./index-DBs9Ljax.js";import{g as D}from"./get-safe-url-D9ZX2qFm.js";import"./vendor-hooks-DTeIFVkk.js";import"./lottie-web-4koyQiv_.js";const le=se.form`
|
|
3
3
|
display: flex;
|
|
4
4
|
flex-direction: column;
|
|
5
5
|
align-items: center;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{W as e}from"./index-D6YhMyoB.js";var i=e();export{i as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,a6 as P,ak as E}from"./vendor-mui-core-CcrDM-5l.js";import{r as T,i as k}from"./vendor-react-Dvs43sk9.js";import{o as j}from"./vendor-arcblock-BnbwP1kf.js";import{T as C,H as d,p as S}from"./vendor-ux-CUBj5GXM.js";import{v as W,c as v,S as I,s as R,b as U}from"./index-
|
|
1
|
+
import{j as e,a6 as P,ak as E}from"./vendor-mui-core-CcrDM-5l.js";import{r as T,i as k}from"./vendor-react-Dvs43sk9.js";import{o as j}from"./vendor-arcblock-BnbwP1kf.js";import{T as C,H as d,p as S}from"./vendor-ux-CUBj5GXM.js";import{v as W,c as v,S as I,s as R,b as U}from"./index-D6YhMyoB.js";import{K as b}from"./landing-page-Cd61UT7Z.js";import{w as L}from"./wrap-locale-CnZSJgmv.js";import{g as N}from"./get-safe-url-D9ZX2qFm.js";import"./vendor-utils-BOkrEpKO.js";import"./vendor-hooks-DTeIFVkk.js";import"./lottie-web-4koyQiv_.js";function _({SessionContext:n,webWalletUrl:a,onSuccess:o}){const{api:t,session:i}=T.useContext(n),{t:s,locale:h}=C(),f=k(),{searchParams:p}=new URL(window.location.href),l=p.get("redirect"),g=async(r,w)=>{o(r,w),await i.refresh(),d.success(s("exchangePassport.success")),setTimeout(()=>{if(l){const c=decodeURIComponent(l);c.startsWith(v.WELLKNOWN_SERVICE_PATH_PREFIX)?f(c,{replace:!0}):window.location.href=N(c)}else window.location.href=window.env.pathPrefix||window.env.apiPrefix||"/"},3e3)},u=r=>{d.error(r.message)},m={},x=p.get("componentId");return x&&(m.componentId=x),i.loading?e.jsx(j,{children:e.jsx(P,{})}):e.jsx(b,{did:window?.blocklet?.appPid||window?.env?.appPid,children:e.jsx(E,{sx:{maxWidth:"100%",height:"100%"},children:e.jsx(W,{popup:!0,open:!0,className:"connect",action:"exchange-passport",checkFn:t.get,checkTimeout:10*60*1e3,webWalletUrl:a,onSuccess:g,onError:u,locale:h,messages:{title:s("exchangePassport.dialog.title"),scan:s("exchangePassport.dialog.scan"),confirm:s("exchangePassport.dialog.confirm"),success:s("exchangePassport.dialog.success")},extraParams:m,extraContent:null,hideCloseButton:!0})})})}const B=L(_);function z(){const n=S(),a=(o,t)=>{o.sessionToken&&(R(t(o.sessionToken)),U(t(o.refreshToken)))};return e.jsx(B,{SessionContext:I,webWalletUrl:n,onSuccess:a})}export{z as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{D as w,j as o,a6 as v,T as B,bo as S}from"./vendor-mui-core-CcrDM-5l.js";import{o as T}from"./vendor-arcblock-BnbwP1kf.js";import{T as k,a as M}from"./vendor-ux-CUBj5GXM.js";import{r as _}from"./vendor-react-Dvs43sk9.js";import{l as P}from"./vendor-hooks-DTeIFVkk.js";import{Y as F,L as D}from"./index-
|
|
1
|
+
import{D as w,j as o,a6 as v,T as B,bo as S}from"./vendor-mui-core-CcrDM-5l.js";import{o as T}from"./vendor-arcblock-BnbwP1kf.js";import{T as k,a as M}from"./vendor-ux-CUBj5GXM.js";import{r as _}from"./vendor-react-Dvs43sk9.js";import{l as P}from"./vendor-hooks-DTeIFVkk.js";import{Y as F,L as D}from"./index-D6YhMyoB.js";import"./vendor-utils-BOkrEpKO.js";import"./lottie-web-4koyQiv_.js";const{Elements:I,PaymentElement:R,useElements:z,useStripe:N,loadStripe:L,LinkAuthenticationElement:O}=globalThis.__STRIPE_COMPONENTS__,W=S("div")`
|
|
2
2
|
width: 100%;
|
|
3
3
|
opacity: 0;
|
|
4
4
|
transition: opacity 300ms ease;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e,ak as s,a6 as w,a$ as B,bc as N,at as v,W as d}from"./vendor-mui-core-CcrDM-5l.js";import{r as l}from"./vendor-react-Dvs43sk9.js";import{C as I}from"./vendor-utils-BOkrEpKO.js";import{b as $}from"./vendor-ux-CUBj5GXM.js";import{m as L,a as E,v as z}from"./index-
|
|
1
|
+
import{j as e,ak as s,a6 as w,a$ as B,bc as N,at as v,W as d}from"./vendor-mui-core-CcrDM-5l.js";import{r as l}from"./vendor-react-Dvs43sk9.js";import{C as I}from"./vendor-utils-BOkrEpKO.js";import{b as $}from"./vendor-ux-CUBj5GXM.js";import{m as L,a as E,v as z}from"./index-D6YhMyoB.js";import{W as A}from"./did-address-DrmEnz9K.js";import{a as D}from"./page-header-1pVKKoSa.js";import{S as F}from"./layout-Bf7XRYSR.js";import{S as P}from"./step-actions-vNi6kxQk.js";import{S as m}from"./button-CPgviFPs.js";import"./vendor-hooks-DTeIFVkk.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-BnbwP1kf.js";import"./content-layout--aahhgT-.js";import"./use-mobile-BC9t6zmM.js";function R({onNext:n=()=>{},onPrevious:x=()=>{}}){const{locale:u,t}=l.useContext($),{blocklet:a,gas:c,tokenInfo:f,actions:h}=L(),{api:j}=E(),[y,o]=l.useState(!1),{need:p="",current:g="",owe:r=99999,deficiency:b,symbol:k="",endpoint:i}=c||{},{origin:C="/"}=i?new URL(i):{};l.useEffect(()=>{const W=setInterval(()=>{h.refreshFuel()},2e3);return()=>{clearInterval(W)}},[]);const S=()=>{o(!1)};return c?e.jsxs(T,{children:[e.jsx("div",{className:"header",children:e.jsx(D,{title:t("setup.fuel.title"),onClickBack:x})}),e.jsxs(s,{className:"qr-body",children:[e.jsxs(s,{className:"tip",sx:{mb:6},children:[t("setup.fuel.tipStart").replace("slot",""),e.jsx("span",{className:"amount",children:`${p} ${k}`}),t("setup.fuel.tipEnd")]}),e.jsx(s,{sx:{fontSize:16,fontWeight:"fontWeightBold",mb:.5},children:t("setup.fuel.addressTitle")}),e.jsxs(s,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(A,{className:"address",did:a.appDid}),e.jsx(B,{style:{lineHeight:1},target:"_blank",href:I(C,"/explorer/accounts/",a.appDid),underline:"hover",children:e.jsx(N,{className:"icon-launch"})})]}),e.jsx(s,{sx:{my:2},children:e.jsx(m,{color:"primary",onClick:()=>o(!0),disabled:!r,children:t("setup.fuel.fuelApp")})}),e.jsx(z,{popup:!0,open:y,action:"fuel",checkFn:j.get,checkTimeout:10*60*1e3,onSuccess:S,onClose:()=>o(!1),locale:u,messages:{title:t("setup.connect.title"),scan:t("setup.connect.scan"),confirm:t("setup.connect.confirm"),success:t("setup.connect.success")},extraParams:{amount:b,...f,endpoint:i}}),e.jsxs(s,{sx:{display:"flex",color:"text.secondary"},children:[e.jsxs(s,{sx:{display:"flex"},children:[e.jsxs(s,{children:[t("setup.fuel.need"),":"]}),e.jsx(s,{sx:{ml:.5,color:"primary.main",fontWeight:"fontWeightBold"},children:p})]}),e.jsxs(s,{sx:{display:"flex",ml:3},children:[e.jsxs(s,{children:[t("setup.fuel.current"),":"]}),e.jsx(s,{sx:{ml:.5,color:r>0?"error.main":"primary.main",fontWeight:"fontWeightBold"},children:g})]})]})]}),e.jsx(P,{mt:8,children:e.jsx(m,{disabled:r>0,onClick:()=>n(),children:t("setup.next")})})]}):e.jsx(s,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:"100%"},children:e.jsx(w,{})})}R.propTypes={onNext:d.func,onPrevious:d.func};const T=v(F)`
|
|
2
2
|
.qr-body {
|
|
3
3
|
width: 580px;
|
|
4
4
|
${n=>n.theme.breakpoints.down("md")} {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{D as E,j as e,Q as S,b3 as P,b0 as R,ak as r,T as c,a6 as _}from"./vendor-mui-core-CcrDM-5l.js";import{a as N,M as I,c as L,t as p,N as W,O as A}from"./index-
|
|
1
|
+
import{D as E,j as e,Q as S,b3 as P,b0 as R,ak as r,T as c,a6 as _}from"./vendor-mui-core-CcrDM-5l.js";import{a as N,M as I,c as L,t as p,N as W,O as A}from"./index-D6YhMyoB.js";import{o as D}from"./vendor-arcblock-BnbwP1kf.js";import{b as M}from"./vendor-ux-CUBj5GXM.js";import{g as T,b as w}from"./vendor-hooks-DTeIFVkk.js";import{i as U,r as i,u as z}from"./vendor-react-Dvs43sk9.js";import{K as a}from"./landing-page-Cd61UT7Z.js";import{C as F}from"./vendor-utils-BOkrEpKO.js";import{u as K}from"./use-window-close-CleYtwbz.js";import"./lottie-web-4koyQiv_.js";function $(){const m=U(),l=i.useRef(null),{t:s,locale:d}=i.useContext(M),{api:x,connectApi:f}=N(),[h]=z(),j=E(),b=K(),n=T({ready:!1,success:!1,error:null,invalidSession:!1}),k=()=>{try{const t=new URL(window.location.href);if(t.hash.includes("invalid")){n.invalidSession=!0;return}const u=t.searchParams.get("__connect_url__"),v=W(u);if(!A(v))throw new Error("No token");n.ready=!0}catch{n.invalidSession=!0,m("#invalid",{replace:!0})}};i.useLayoutEffect(()=>k(),[]);const C=w(t=>{n.error=t.message,window.opener?.postMessage({type:"connect-endpoint-message",error:n.error},"*"),m("#invalid",{replace:!0})}),g=w(()=>{window.opener?.postMessage({type:"connect-endpoint-message",success:!0},"*"),n.success=!0}),o=h.get("source")||"Generate Access Key";i.useEffect(()=>{l.current&&n.ready&&f.open({locale:d,containerEl:l.current,action:"gen-access-key",extraParams:{remark:o},checkFn:x.get,saveConnect:!1,forceConnected:!1,className:"connect",popup:!1,baseUrl:window.location.origin,prefix:F(window.location.origin,L.WELLKNOWN_SERVICE_PATH_PREFIX,I),messages:{title:s("connectCli.title"),scan:s("connectCli.scan"),confirm:s("auth.confirm"),success:s("connectCli.success")},onSuccess:g,onError:C},{locale:d})},[f,n.ready,x,C,g,d,s,o]);const y=e.jsx(S,{variant:"outlined",color:"primary",size:"small",startIcon:e.jsx(P,{}),href:"/",style:{borderRadius:4},children:s("connectCli.home")});if(n.invalidSession)return e.jsx(a,{did:window.blocklet?.appPid,standalone:!0,children:e.jsx(p,{style:{backgroundColor:"transparent"},status:"error",title:s("connectCli.invalidSession"),description:s("connectCli.invalidSessionDesc"),extra:y})},"invalid");if(n.error){const t=n.error,u=y;return e.jsx(a,{did:window.blocklet?.appPid,standalone:!0,children:e.jsx(p,{style:{backgroundColor:"transparent"},status:"error",title:s("connectCli.connectionError"),description:t,extra:u})},"error")}return n.success?(h.has("closeOnSuccess")&&b(),e.jsx(a,{did:window.blocklet?.appPid,standalone:!0,children:e.jsx(p,{style:{backgroundColor:"transparent"},status:"info",icon:e.jsx(R,{style:{color:j.palette.success.main,fontSize:72}}),title:s("connectCli.success",{source:o}),description:s("connectCli.successDesc",{source:o})})},"success")):n.ready?e.jsx(a,{did:window.blocklet?.appPid,standalone:!0,children:e.jsxs(r,{sx:{maxWidth:"100%",height:"100%"},children:[e.jsxs(r,{sx:{mb:5},children:[e.jsx(c,{variant:"h4",component:"h1",sx:{mb:1,fontWeight:"bold",textAlign:"center"},children:s("connectCli.tips.title")}),e.jsxs(r,{sx:{display:"flex",flexDirection:"column",gap:1,alignItems:"center"},children:[e.jsx(c,{sx:{color:"text.secondary"},children:s("connectCli.tips.item1")}),e.jsx(c,{sx:{color:"text.secondary"},children:s("connectCli.tips.item2")}),e.jsx(c,{sx:{color:"text.secondary"},children:s("connectCli.tips.item3")})]})]}),e.jsx(r,{sx:{display:"inline-block"},ref:l})]})},"ready"):e.jsx(D,{children:e.jsx(_,{})})}export{$ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,ak as s,T as y,a6 as L,b1 as $,Q as U,a$ as G,aX as E,bM as R}from"./vendor-mui-core-CcrDM-5l.js";import{r as u,i as J,u as Q}from"./vendor-react-Dvs43sk9.js";import{I as V,a as X,e as Y,N as M,c as Z,ai as ee}from"./index-
|
|
1
|
+
import{j as e,ak as s,T as y,a6 as L,b1 as $,Q as U,a$ as G,aX as E,bM as R}from"./vendor-mui-core-CcrDM-5l.js";import{r as u,i as J,u as Q}from"./vendor-react-Dvs43sk9.js";import{I as V,a as X,e as Y,N as M,c as Z,ai as ee}from"./index-D6YhMyoB.js";import{n as A,C as P}from"./vendor-utils-BOkrEpKO.js";import{g as D,b as d,o as ne}from"./vendor-hooks-DTeIFVkk.js";import{M as W,T as K,A as oe,o as B}from"./vendor-ux-CUBj5GXM.js";import{o as se}from"./vendor-arcblock-BnbwP1kf.js";import{K as te}from"./landing-page-Cd61UT7Z.js";import{B as re,a as ie,l as ae}from"./index-Ca2q4nT6.js";import{u as ce}from"./use-window-close-CleYtwbz.js";import"./lottie-web-4koyQiv_.js";function le({requestAppInfo:r,currentAppInfo:o}){return e.jsxs(s,{sx:{textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",gap:2},children:[e.jsxs(s,{sx:{display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx(W,{src:o.appLogo,alt:"Server",width:48,height:48,useProxyFallback:!0}),e.jsxs(s,{sx:{mx:2,display:"flex",alignItems:"center","& .dot":{width:8,height:8,borderRadius:"50%",bgcolor:"divider",mx:.5}},children:[e.jsx(s,{className:"dot"}),e.jsx(s,{className:"dot"}),e.jsx(s,{className:"dot"})]}),e.jsx(W,{src:r.appLogo,alt:r.appName,width:48,height:48,useProxyFallback:!0})]}),e.jsxs(y,{sx:{mb:1,fontSize:"1.2rem"},children:["Authorize"," ",e.jsx(s,{component:"span",sx:{color:"primary.main"},children:r.appName})]})]})}const de={en:{notThis:"Not you?",useAnother:"Use another account",authorize:"Authorize",connect:"Connect",cancel:"Cancel"},zh:{notThis:"不是这个?",useAnother:"使用其他账户",authorize:"授权",connect:"Connect",cancel:"取消"}};function pe({session:r,requestAppInfo:o,currentAppInfo:t,children:C=null,userInfo:v=void 0,hideSwitchConnect:_=!1,hideAuthorize:a=!1,hideCancel:c=!1,notThisText:N=void 0,authorizeText:f=void 0,connectText:g=void 0,cancelText:k=void 0,useAnotherText:z=void 0,slotProps:p=void 0,onConnect:h=A,onAuthorize:T=A,onSwitchConnect:S=A,onCancel:m=A,ref:b}){const n=D({loading:!1}),{locale:l="en"}=K()||{},i=d((O,H={})=>oe(de,O,l,"en",H)),j=d(()=>{n.loading=!1}),I=d(()=>{n.loading=!0,h?.(j)}),x=d(()=>{n.loading=!0,S?.(j)}),q=d(()=>{n.loading=!0,T?.(j)}),F=d(()=>{m?.()});if(u.useImperativeHandle(b,()=>({closeLoading:j})),r.loading||!r.initialized)return e.jsx(se,{children:e.jsx(L,{})});const w=v??r?.user;return e.jsx(te,{did:window.blocklet?.appPid,standalone:!0,children:e.jsx(s,{...p?.root,sx:B({width:420,maxWidth:"100%"},p?.root?.sx),children:e.jsx(V,{hideCloseButton:!0,...p?.didConnectContainer,children:e.jsxs(s,{...p?.contentContainer,sx:B({display:"flex",flexDirection:"column",gap:1.5,p:{xs:2,lg:3,xl:4},pt:{xs:3,xl:4},bgcolor:"background.paper"},p?.contentContainer?.sx),children:[e.jsx(le,{requestAppInfo:o,currentAppInfo:t}),w?e.jsxs(e.Fragment,{children:[e.jsx(re,{user:w,showDid:!0,cardType:ae.Detailed,infoType:ie.Minimal}),e.jsx(s,{})]}):null,C,e.jsx(s,{sx:{border:"1px solid",borderColor:"divider",borderRadius:2,overflow:"hidden",my:1}}),e.jsxs($,{direction:"row",spacing:2,children:[c?null:e.jsx(U,{color:"inherit",variant:"outlined",size:"large",fullWidth:!0,onClick:F,sx:{color:"grey.500"},children:k||i("cancel")}),w&&!a?e.jsxs(U,{variant:"contained",size:"large",fullWidth:!0,onClick:q,disabled:n.loading,children:[n.loading?e.jsx(L,{size:20,sx:{mr:1}}):null,f||i("authorize")]}):e.jsxs(U,{variant:"contained",size:"large",fullWidth:!0,disabled:n.loading,onClick:I,children:[n.loading?e.jsx(L,{size:20,sx:{mr:1}}):null,g||i("connect")]})]}),_||!w?null:e.jsx(s,{sx:{textAlign:"center"},children:e.jsxs(y,{variant:"body2",sx:{display:"flex",alignItems:"center",justifyContent:"center",gap:1},children:[N||i("notThis")," ",e.jsx(G,{underline:"hover",onClick:x,sx:{cursor:"pointer"},children:z||i("useAnother")})]})})]})})})})}const ue=P(window.location.origin,Z.WELLKNOWN_BLOCKLET_USER_PATH,"settings#user-center-access-key-setting");function _e(){const r=u.useRef(null),{session:o}=X(),t=D({ready:!1,success:!1,error:null,invalidSession:!1,token:null}),[C,v]=ne("currentUserInfo",{defaultValue:null}),_=J(),{t:a}=K(),[c]=Q(),N=ce(),[,f]=u.useState(!0),[g,k]=u.useState({appName:c.get("cli")?c.get("appName")??a("aigne.cli"):"",appLogo:c.get("cli")?c.get("appLogo"):""}),z=async()=>{f(!0);try{const n=c.get("__url__"),l=n?M(n):null;if(!l){f(!1);return}const i="__blocklet__.js?type=json",I=new URL(l).origin,{data:x}=await ee.get(P(I,i));k({appName:x?.appName,appUrl:x?.appUrl,appLogo:P(x?.appUrl,x?.appLogo)})}catch(n){console.error(n)}finally{f(!1)}},p=()=>{z(),o.user&&v(o.user);try{const n=new URL(window.location.href);if(n.hash.includes("invalid")){t.invalidSession=!0;return}const l=n.searchParams.get("__token__"),i=l?M(l):null;if(!i)throw new Error("No token");t.token=i,t.ready=!0}catch(n){t.invalidSession=!0,t.error=n.message,window.opener?.postMessage({type:"connect-aigne-message",error:n.message},"*"),_("#invalid",{replace:!0})}};u.useLayoutEffect(()=>p(),[]);const h=window.blocklet,T=c.get("source")||"Generate Access Key",S=d(async n=>{try{await Y.post("/access-key/authorize",{source:T,sid:t.token}),window.opener?.postMessage({type:"connect-aigne-message",success:!0},"*"),c.has("closeOnSuccess")&&N()}catch(l){console.error(l)}finally{n()}}),m=d(()=>{o.login()}),b=d(()=>{window.close()});return u.useEffect(()=>{o.initialized&&(o.user||m())},[o?.user,o?.initialized,m]),u.useEffect(()=>{o.open||r.current?.closeLoading?.()},[o.open]),e.jsx(pe,{ref:r,session:o,requestAppInfo:g,currentAppInfo:h,userInfo:C,onAuthorize:S,onConnect:m,onSwitchConnect:o.switchDid,onCancel:b,hideAuthorize:!!t.error,authorizeText:a("common.approve"),slotProps:{root:{sx:{width:500}}},children:t.error?e.jsxs(E,{severity:"error",children:[e.jsx(R,{children:a("aigne.notAuthorized")}),t.error]}):e.jsxs(E,{severity:"info",children:[e.jsx(R,{children:a("aigne.connectTo",{appName:h.appName})}),e.jsx(y,{component:"li",variant:"body2",children:a("aigne.accessTips.tips1",{appName:g.appName,accessAppName:h.appName})}),e.jsx(y,{component:"li",variant:"body2",children:a("aigne.accessTips.tips2",{appName:g.appName})}),e.jsx(y,{component:"li",variant:"body2",sx:{"& a":{color:"inherit",textDecoration:"underline"}},dangerouslySetInnerHTML:{__html:a("aigne.accessTips.tips3",{url:ue,accessAppName:h.appName})}})]})})}export{_e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{K as t}from"./index-
|
|
1
|
+
import{K as t}from"./index-D6YhMyoB.js";import{H as e}from"./vendor-ux-CUBj5GXM.js";function c(...o){try{return t(...o)}catch(r){throw e.error("Invalid redirect url"),console.error("Invalid redirect url",r),r}}export{c as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as o,b1 as n}from"./vendor-mui-core-CcrDM-5l.js";import{L as r}from"./vendor-react-Dvs43sk9.js";import{n as i}from"./vendor-ux-CUBj5GXM.js";import{c as t}from"./index-
|
|
1
|
+
import{j as o,b1 as n}from"./vendor-mui-core-CcrDM-5l.js";import{L as r}from"./vendor-react-Dvs43sk9.js";import{n as i}from"./vendor-ux-CUBj5GXM.js";import{c as t}from"./index-D6YhMyoB.js";import{S as e}from"./studio-CU2xUA6B.js";import"./vendor-utils-BOkrEpKO.js";import"./vendor-hooks-DTeIFVkk.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-BnbwP1kf.js";import"./index-B88jr6sm.js";function L(){return o.jsx(e,{children:o.jsxs(n,{direction:"row",spacing:2,sx:{m:4},children:[o.jsx(i,{component:r,to:`${t.WELLKNOWN_SERVICE_PATH_PREFIX}/studio/preferences`,size:"large",color:"primary",variant:"outlined",children:"Preference Builder"}),o.jsx(i,{component:r,to:`${t.WELLKNOWN_SERVICE_PATH_PREFIX}/studio/branding`,size:"large",color:"primary",variant:"outlined",children:"Branding Images"}),o.jsx(i,{component:r,to:`${t.WELLKNOWN_SERVICE_PATH_PREFIX}/studio/localization`,size:"large",color:"primary",variant:"outlined",children:"Localization"})]})})}export{L as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as E}from"./vendor-react-Dvs43sk9.js";import{V as L}from"./index-
|
|
1
|
+
import{a as E}from"./vendor-react-Dvs43sk9.js";import{V as L}from"./index-D6YhMyoB.js";const V=({url:r,allowFullScreen:o,position:a,display:i,height:u,width:y,overflow:c,styles:f,onLoad:p,onMouseOver:m,onMouseOut:w,scrolling:b,id:d,frameBorder:n,ariaHidden:O,sandbox:s,allow:j,className:g,title:h,ariaLabel:k,ariaLabelledby:P,name:v,target:A,loading:F,importance:I,referrerpolicy:M,allowpaymentrequest:S,src:q,key:x})=>{const t=L({src:q||r,target:A||null,style:{position:a||null,display:i||"initial",overflow:c||null},scrolling:b||null,allowpaymentrequest:S||null,importance:I||null,sandbox:s&&[...s].join(" ")||null,loading:F||null,styles:f||null,name:v||null,className:g||null,allowFullScreen:"allowFullScreen",referrerpolicy:M||null,title:h||null,allow:j||null,id:d||null,"aria-labelledby":P||null,"aria-hidden":O||null,"aria-label":k||null,width:y||null,height:u||null,onLoad:p||null,onMouseOver:m||null,onMouseOut:w||null,key:x||"iframe"});let l=Object.create(null);for(let e of Object.keys(t))t[e]!=null&&(l[e]=t[e]);for(let e of Object.keys(l.style))l.style[e]==null&&delete l.style[e];if(l.styles)for(let e of Object.keys(l.styles))l.styles.hasOwnProperty(e)&&(l.style[e]=l.styles[e]),Object.keys(l.styles).pop()==e&&delete l.styles;if(o)if("allow"in l){const e=l.allow.replace("fullscreen","");l.allow=`fullscreen ${e.trim()}`.trim()}else l.allow="fullscreen";return n>=0&&(l.style.hasOwnProperty("border")||(l.style.border=n)),E.createElement("iframe",Object.assign({},l))};export{V as I};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{W as o,j as n,ak as f,f as y,bf as I,av as j,D as S,a8 as W}from"./vendor-mui-core-CcrDM-5l.js";import{r as v}from"./vendor-react-Dvs43sk9.js";import{m as k,Z,T as A,C as B}from"./vendor-ux-CUBj5GXM.js";import{aM as L,aW as Y,aX as T,aY as H,aZ as V,k as X,a_ as G,a8 as J,a$ as N,b0 as K}from"./index-
|
|
1
|
+
import{W as o,j as n,ak as f,f as y,bf as I,av as j,D as S,a8 as W}from"./vendor-mui-core-CcrDM-5l.js";import{r as v}from"./vendor-react-Dvs43sk9.js";import{m as k,Z,T as A,C as B}from"./vendor-ux-CUBj5GXM.js";import{aM as L,aW as Y,aX as T,aY as H,aZ as V,k as X,a_ as G,a8 as J,a$ as N,b0 as K}from"./index-D6YhMyoB.js";import{Y as P,I as Q,Z as U}from"./vendor-utils-BOkrEpKO.js";import{a as ee}from"./vendor-hooks-DTeIFVkk.js";function z({name:e="",logo:t="",description:i="",...p}){if(!e&&!t&&!i)return null;const c=v.isValidElement(t)?t:n.jsx("img",{src:t,alt:e});return n.jsxs(ne,{...p,children:[n.jsxs("div",{children:[t&&n.jsx(f,{component:"a",href:"/",className:"footer-brand-logo",children:c}),e&&n.jsx("div",{className:"footer-brand-name",children:e})]}),i&&n.jsx("div",{className:"footer-brand-desc",children:i})]})}z.propTypes={name:o.node,logo:o.node,description:o.string};const ne=k("div")`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
font-size: 14px;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as e,y as kt,bb as ke,M as ae,ak as x,Q as q,W as u,J as xe,c0 as St,I as O,aN as Pt,T as I,aj as Rt,b5 as ze,P as Le,b6 as Z,a5 as Be,z as Qe,A as Ve,cm as It,bf as Tt,U as we,dk as At,dl as Mt,at as ee,dm as Et,a6 as V,n as le,D as zt,dn as Lt,ar as We,b1 as Se,dp as Bt,as as Wt,aX as Dt,am as J,bp as Nt,bq as ye,a$ as Ot,d7 as $t}from"./vendor-mui-core-CcrDM-5l.js";import{r as y,a as Ft,u as Ut,j as _t}from"./vendor-react-Dvs43sk9.js";import{a as qt,D as Ht,bA as Gt,c as Pe,d as Kt,T as Qt,bB as Vt,aN as Re,Q as fe,b8 as Yt,bC as Zt,_ as Jt,aP as Xt,$ as er,bD as tr,H as rr}from"./index-FrAYP-A_.js";import{t as Ye,Z as nr,a8 as or,R as De,D as sr,C as ce,n as Q,A as ir}from"./vendor-utils-BOkrEpKO.js";import{b as Ie,I as N,T as D,aw as ar,G as Ze,ax as lr,H as _,ay as cr,az as dr,aA as Ne,e as ur,n as Je,c as Te,aB as pr,aC as M,x as xr,v as fr,$ as Xe,aD as hr,aE as gr,u as mr,o as de,B as Oe,J as br}from"./vendor-ux-CUBj5GXM.js";import{a as T,h as et,k as te,g as H,b as z,j as yr}from"./vendor-hooks-DTeIFVkk.js";import{l as tt}from"./arrow-down.svg-CW9W9wI1.js";import{N as vr}from"./list-X2F1RKzQ.js";import{d as jr}from"./search-4YYphs0l.js";import{B as $e}from"./bundle-avatar-JsO8Rdzw.js";import{j as Fe,T as wr}from"./team-CD3vKVPJ.js";import{b as Cr,d as kr,a as Sr,c as Pr,e as Rr,f as Ir,W as Tr}from"./user-center-Cveaoeez.js";import{N as rt,U as nt}from"./index-MJKS-RJU.js";import{u as re}from"./use-mobile-BC9t6zmM.js";import Ar from"./index-CE07Exux.js";import{f as X}from"./index-DBs9Ljax.js";import{u as ot}from"./index-CkuzlAat.js";import{U as ve}from"./user-sessions-D9ZCFiu3.js";import Mr from"./index-DAg_a68C.js";import{o as Er}from"./vendor-arcblock-BnbwP1kf.js";import{c as zr,b as ue,a as Lr,S as Br}from"./index-IMquU8ZG.js";import"./index-D8gGAVdB.js";import"./index-BojVbZw0.js";import"./lottie-web-4koyQiv_.js";import"./server-logo-notext.svg-CKQB0tIp.js";import"./index-Bg6_NsC_.js";import"./util-CJadXi8V.js";import"./base32-B9yl211y.js";import"./session-Ci_4G0CP.js";import"./isURL-BKM8U6hZ.js";import"./index-PcQgNtUn.js";import"./api-Rnh95Dt4.js";import"./table-tips-3_n5uR-X.js";import"./use-mobile-B9FM-UBY.js";import"./passport-item-BniPqqnO.js";import"./did-address-DrmEnz9K.js";import"./index-DHLC0F8S.js";import"./vendor-mui-x-BVRWKjdg.js";import"./AdapterDayjs-BEkLDdDJ.js";import"./confirm-CXK9v894.js";import"./click-to-copy-C43vd7DG.js";import"./delete-confirm-CpZStjie.js";import"./permission-w0BesrB_.js";import"./actions-DvIZNF27.js";import"./index-DRYJ0xIl.js";function Wr(){let t=new Map;function s({root:n,rootMargin:o,threshold:i}){let a=t.get(n);a||(a=new Map,t.set(n,a));let c=JSON.stringify({rootMargin:o,threshold:i}),p=a.get(c);if(!p){let r=new Map;p={observer:new IntersectionObserver(f=>{f.forEach(m=>{r.get(m.target)?.(m)})},{root:n,rootMargin:o,threshold:i}),entryCallbacks:r},a.set(c,p)}return{observe:(r,f)=>{p.entryCallbacks.set(r,f),p.observer.observe(r)},unobserve:r=>{p.entryCallbacks.delete(r),p.observer.unobserve(r)}}}return{getObserver:s}}var Dr="0px",Nr=[0],Or=Wr();function $r(t){let s=t?.rootMargin??Dr,n=t?.threshold??Nr,o=y.useRef(null),i=y.useRef(null),a=y.useRef(null),[c,p]=y.useState(),r=y.useCallback(()=>{let C=o.current;if(!C){p(void 0);return}let v=Or.getObserver({root:i.current,rootMargin:s,threshold:n});v.observe(C,l=>{p(l)}),a.current=v},[s,n]),f=y.useCallback(()=>{let C=a.current,v=o.current;v&&C?.unobserve(v),a.current=null},[]),m=y.useCallback(C=>{f(),o.current=C,r()},[r,f]),h=y.useCallback(C=>{f(),i.current=C,r()},[r,f]);return[m,{entry:c,rootRef:h}]}var Fr=$r;function Ur(t){let[s,n]=Fr(t),o=!!n.entry?.isIntersecting,[i,a]=y.useState(o);return o&&!i&&a(!0),[s,{...n,isVisible:o,wasEverVisible:i}]}var _r=Ur,qr=100;function Hr({loading:t,hasNextPage:s,onLoadMore:n,rootMargin:o,disabled:i,delayInMs:a=qr}){let c=y.useRef(n),[p,{rootRef:r,isVisible:f}]=_r({rootMargin:o});y.useEffect(()=>{c.current=n},[n]);let m=!i&&!t&&f&&s;return y.useEffect(()=>{if(m){let h=setTimeout(()=>{c.current()},a);return()=>{clearTimeout(h)}}},[m,a]),[p,{rootRef:r}]}var Gr=Hr;const je={info:"#3B82F6",success:"#10B981",warning:"#F59E0B",error:"#EF4444"};pe.propTypes={severity:u.oneOf(["info","success","warning","error",""]).isRequired,size:u.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}st.propTypes={theme:u.string,type:u.oneOf(["button","line","select"]),onSelectType:u.func,extra:u.node,loading:u.bool,currentTab:u.oneOf(["info","success","warning","error",""])};function st({theme:t="dark",type:s="button",onSelectType:n,extra:o=void 0,currentTab:i="",loading:a=!1,...c}){const{t:p}=y.useContext(Ie),r=[{label:p("notification.allSeverity"),value:""},{label:p("notification.severityType.info"),value:"info"},{label:p("notification.severityType.success"),value:"success"},{label:p("notification.severityType.warning"),value:"warning"},{label:p("notification.severityType.error"),value:"error"}],f=g=>{(g!==i||!a)&&n(g)},m=y.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:a,onClick:()=>f(g.value),className:`profile-button ${S?"active":""}`,...c,children:g.label},g.value||R),C=(g,S,R)=>e.jsx(q,{variant:"text",disabled:a,onClick:()=>f(g.value),className:`profile-line-button ${S?"active":""}`,...c,children:g.label},g.value||R),v=()=>r?.map((g,S)=>{const R=i===g?.value;return s==="line"?e.jsx(y.Fragment,{children:C(g,R,S)},g.value||S):e.jsx(y.Fragment,{children:h(g,R,S)},g.value||S)}),l=g=>{const{value:S}=g.target;f(S==="all"?"":S)};return s==="select"?e.jsx(kt,{sx:{maxWidth:300},children:e.jsx(ke,{value:i||"all",onChange:l,size:"small",label:"Severity",IconComponent:g=>e.jsx(tt,{...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()}),o]})}it.propTypes={paging:u.objectOf(u.any).isRequired,loading:u.bool.isRequired,onChange:u.func.isRequired};function it({loading:t,paging:s,onChange:n}){const{t:o}=y.useContext(Ie),i=xe(r=>r.breakpoints.down("md"));if(s.pageCount<=0||i)return null;const a=(r,f)=>{n({page:f+1})},c=r=>{const f=Number(r.target.value);n({page:1,pageSize:f})},p=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(St,{component:"div",disabled:t,count:s.total,page:p,rowsPerPageOptions:[10,20,50,100],labelRowsPerPage:o("pagination.rowsPerPage"),labelDisplayedRows:({from:r,to:f,count:m})=>`${r}–${f} / ${m!==-1?m:`${o()}more than ${f}`}`,rowsPerPage:s.pageSize,onPageChange:a,onRowsPerPageChange:c})})}const Kr=y.memo(it),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"/>'},Ue=6,_e={"& .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}},Vr={border:"1px solid",borderColor:"divider",borderRadius:1,overflow:"hidden",backgroundColor:"background.paper",backgroundImage:"none",transition:"all 0.2s ease-in-out"},qe=()=>({...Vr,width:"calc(50% - 8px)"});at.propTypes={loading:u.bool,type:u.oneOf(["server","service"]),onFilterChange:u.func,blockletMap:u.object,filterType:u.oneOf(["component","entity"]),selectedId:u.array,severity:u.array,enableMarkAllAsRead:u.bool,unReadCount:u.number,onReadFilterChange:u.func,currentReadFilter:u.string};function at({onFilterChange:t=()=>{},loading:s=!1,type:n="service",blockletMap:o={},filterType:i="component",selectedId:a=[],severity:c=[],enableMarkAllAsRead:p=!0,unReadCount:r=0,onReadFilterChange:f=()=>{},currentReadFilter:m="all"}){const{t:h}=y.useContext(Ie),[C,v]=y.useState(null),l=!!C,[g,S]=y.useState(a),[R,P]=y.useState(c),[b,E]=y.useState(!1),[L,F]=y.useState(""),[w,k]=y.useState([]);y.useEffect(()=>{S(a),P(c)},[a,c]);const B=[{label:h("notification.filterType.all"),value:"all"},{label:h("notification.filterType.unread"),value:"unread"}],G=d=>{(d!==m||!s)&&f(d)},Y=[{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=d=>{v(d.currentTarget),F(""),E(!1)},he=()=>{v(null)},oe=d=>{const j=g.includes(d)?g.filter(A=>A!==d):[...g,d];S(j),t({id:j,severity:R})},se=d=>{const j=R.includes(d)?R.filter(A=>A!==d):[...R,d];P(j),t({severity:j,id:g})},ge=d=>{F(d.target.value)},me=()=>{E(!b)},K=Ft.useMemo(()=>{if(!o.size)return[];const d=[];return i==="component"&&d.push({label:h("notification.system"),id:"system"}),Array.from(o).forEach(([,j])=>{const A=j.did||j.meta?.did,W=j.title||j.meta?.title||"",U=j.appPid||j.appDid;(i==="component"&&U!==A||i==="entity"&&U===A)&&d.push({label:W,id:A,blocklet:j,ancestors:j.ancestors})}),d},[o,i,h]);y.useEffect(()=>{if(L.trim()==="")k(K);else{const d=L.toLowerCase(),j=K.filter(A=>A.label.toLowerCase().includes(d));k(j)}},[L,K]);const be=L.trim()!==""||b?w:w.slice(0,Ue);return e.jsxs(x,{children:[e.jsxs(x,{sx:{display:"flex",justifyContent:p?"space-between":"flex-end",alignItems:"flex-start",flexWrap:"wrap",gap:1},children:[p&&e.jsx(x,{sx:{display:"flex",gap:1.5},children:B.map(d=>e.jsxs(q,{disabled:s,onClick:()=>G(d.value),className:`profile-button ${m===d.value?"active":""}`,sx:{...n==="service"&&m===d.value?{color:"secondary.main"}:{},color:"red",fontWeight:m===d.value?"bold":"normal"},children:[d.label,d.value==="unread"&&r>0&&` (${r})`]},d.value))}),e.jsxs(x,{sx:{display:"flex",justifyContent:"flex-end",gap:2},children:[e.jsx(O,{size:"small",onClick:ne,disabled:s,sx:{minWidth:"auto",borderRadius:1,border:"1px solid",borderColor:"divider","&:hover":{backgroundColor:"action.hover"}},children:e.jsx(N,{icon:Qr,hFlip:!0})}),e.jsx(Pt,{open:l,anchorEl:C,onClose:he,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(Rt,{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(ze,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:2,flex:1},children:Y.map(d=>e.jsx(Le,{elevation:0,sx:qe(R.includes(d.value)),children:e.jsx(Z,{sx:{margin:0,padding:.5,width:"100%","& .MuiFormControlLabel-label":{display:"flex",alignItems:"center",gap:1,fontSize:"0.875rem"},..._e},control:e.jsx(Be,{checked:R.includes(d.value),onChange:()=>se(d.value),disabled:s,size:"small"}),label:e.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:.5},children:[e.jsx(pe,{severity:d.value}),d.label]})})},d.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:ge,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(Ve,{position:"start",sx:{marginRight:"2px"},children:e.jsx(N,{icon:jr})})}}})})]}),e.jsx(ze,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:2},children:be.map(d=>e.jsx(Le,{elevation:0,sx:qe(g.includes(d.id)),children:e.jsx(Z,{sx:{margin:0,padding:.5,width:"100%","& .MuiFormControlLabel-label":{fontSize:"0.875rem",width:"calc(100% - 36px)"},..._e},control:e.jsx(Be,{checked:g.includes(d.id),onChange:()=>oe(d.id),disabled:s,size:"small"}),label:e.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:.5,minWidth:0,width:"100%"},children:[d.blocklet&&e.jsx($e,{size:20,blocklet:d.blocklet,ancestors:d.ancestors,style:{borderRadius:4,flexShrink:0}}),e.jsx(I,{noWrap:!0,variant:"body2",component:"span",title:d.label,sx:{flex:1,overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%"},children:d.label})]})})},d.id))}),w.length>Ue&&L.trim()===""&&e.jsx(q,{fullWidth:!0,size:"small",onClick:me,sx:{mt:1},endIcon:b?e.jsx(It,{}):e.jsx(Tt,{})})]})]})})]})]}),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(d=>{const j=Y.find(A=>A.value===d);return e.jsx(we,{label:e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx(pe,{severity:d}),j?j.label:d]}),onDelete:()=>se(d),size:"small",variant:"outlined",sx:{borderRadius:2,color:"text.secondary",borderColor:"divider","& .MuiChip-label":{display:"flex",alignItems:"center"}}},`severity-${d}`)}),g.map(d=>{const j=K.find(A=>A.id===d);return e.jsx(we,{label:e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:.5},children:[j?.blocklet&&e.jsx($e,{size:16,blocklet:j.blocklet,ancestors:j.ancestors,style:{borderRadius:4,flexShrink:0}}),j?j.label:d]}),variant:"outlined",onDelete:()=>oe(d),size:"small",sx:{borderRadius:2,color:"text.secondary",borderColor:"divider","& .MuiChip-label":{display:"flex",alignItems:"center"}}},`component-${d}`)})]}):null]})}const Yr=ee(Et)`
|
|
1
|
+
import{j as e,y as kt,bb as ke,M as ae,ak as x,Q as q,W as u,J as xe,c0 as St,I as O,aN as Pt,T as I,aj as Rt,b5 as ze,P as Le,b6 as Z,a5 as Be,z as Qe,A as Ve,cm as It,bf as Tt,U as we,dk as At,dl as Mt,at as ee,dm as Et,a6 as V,n as le,D as zt,dn as Lt,ar as We,b1 as Se,dp as Bt,as as Wt,aX as Dt,am as J,bp as Nt,bq as ye,a$ as Ot,d7 as $t}from"./vendor-mui-core-CcrDM-5l.js";import{r as y,a as Ft,u as Ut,j as _t}from"./vendor-react-Dvs43sk9.js";import{a as qt,D as Ht,bA as Gt,c as Pe,d as Kt,T as Qt,bB as Vt,aN as Re,Q as fe,b8 as Yt,bC as Zt,_ as Jt,aP as Xt,$ as er,bD as tr,H as rr}from"./index-D6YhMyoB.js";import{t as Ye,Z as nr,a8 as or,R as De,D as sr,C as ce,n as Q,A as ir}from"./vendor-utils-BOkrEpKO.js";import{b as Ie,I as N,T as D,aw as ar,G as Ze,ax as lr,H as _,ay as cr,az as dr,aA as Ne,e as ur,n as Je,c as Te,aB as pr,aC as M,x as xr,v as fr,$ as Xe,aD as hr,aE as gr,u as mr,o as de,B as Oe,J as br}from"./vendor-ux-CUBj5GXM.js";import{a as T,h as et,k as te,g as H,b as z,j as yr}from"./vendor-hooks-DTeIFVkk.js";import{l as tt}from"./arrow-down.svg-CH8Xzna_.js";import{N as vr}from"./list-A-6ZKqgn.js";import{d as jr}from"./search-4YYphs0l.js";import{B as $e}from"./bundle-avatar-DzIGEDbC.js";import{j as Fe,T as wr}from"./team-Bxi69lmr.js";import{b as Cr,d as kr,a as Sr,c as Pr,e as Rr,f as Ir,W as Tr}from"./user-center-D7U8E_9U.js";import{N as rt,U as nt}from"./index-DTuL5S3g.js";import{u as re}from"./use-mobile-BC9t6zmM.js";import Ar from"./index-DmgU5YEy.js";import{f as X}from"./index-DBs9Ljax.js";import{u as ot}from"./index-CkuzlAat.js";import{U as ve}from"./user-sessions-CFuRw6Kk.js";import Mr from"./index-D6ZAoKh5.js";import{o as Er}from"./vendor-arcblock-BnbwP1kf.js";import{c as zr,b as ue,a as Lr,S as Br}from"./index-ckUPtmoF.js";import"./index-D8gGAVdB.js";import"./index-BojVbZw0.js";import"./lottie-web-4koyQiv_.js";import"./server-logo-notext.svg-CKQB0tIp.js";import"./index-Ca2q4nT6.js";import"./util-DhFzZqQY.js";import"./base32-B9yl211y.js";import"./session-fyUi2EvV.js";import"./isURL-CTW__dzu.js";import"./index-1-P2gWGZ.js";import"./api-Rnh95Dt4.js";import"./table-tips-3_n5uR-X.js";import"./use-mobile-B9FM-UBY.js";import"./passport-item-CPGYYOeu.js";import"./did-address-DrmEnz9K.js";import"./index-7fdKVdEw.js";import"./vendor-mui-x-BVRWKjdg.js";import"./AdapterDayjs-BEkLDdDJ.js";import"./confirm-5e46DDlz.js";import"./click-to-copy-C43vd7DG.js";import"./delete-confirm-Bim07gVu.js";import"./permission-B0EjzZOA.js";import"./actions-DvIZNF27.js";import"./index-DRYJ0xIl.js";function Wr(){let t=new Map;function s({root:n,rootMargin:o,threshold:i}){let a=t.get(n);a||(a=new Map,t.set(n,a));let c=JSON.stringify({rootMargin:o,threshold:i}),p=a.get(c);if(!p){let r=new Map;p={observer:new IntersectionObserver(f=>{f.forEach(m=>{r.get(m.target)?.(m)})},{root:n,rootMargin:o,threshold:i}),entryCallbacks:r},a.set(c,p)}return{observe:(r,f)=>{p.entryCallbacks.set(r,f),p.observer.observe(r)},unobserve:r=>{p.entryCallbacks.delete(r),p.observer.unobserve(r)}}}return{getObserver:s}}var Dr="0px",Nr=[0],Or=Wr();function $r(t){let s=t?.rootMargin??Dr,n=t?.threshold??Nr,o=y.useRef(null),i=y.useRef(null),a=y.useRef(null),[c,p]=y.useState(),r=y.useCallback(()=>{let C=o.current;if(!C){p(void 0);return}let v=Or.getObserver({root:i.current,rootMargin:s,threshold:n});v.observe(C,l=>{p(l)}),a.current=v},[s,n]),f=y.useCallback(()=>{let C=a.current,v=o.current;v&&C?.unobserve(v),a.current=null},[]),m=y.useCallback(C=>{f(),o.current=C,r()},[r,f]),h=y.useCallback(C=>{f(),i.current=C,r()},[r,f]);return[m,{entry:c,rootRef:h}]}var Fr=$r;function Ur(t){let[s,n]=Fr(t),o=!!n.entry?.isIntersecting,[i,a]=y.useState(o);return o&&!i&&a(!0),[s,{...n,isVisible:o,wasEverVisible:i}]}var _r=Ur,qr=100;function Hr({loading:t,hasNextPage:s,onLoadMore:n,rootMargin:o,disabled:i,delayInMs:a=qr}){let c=y.useRef(n),[p,{rootRef:r,isVisible:f}]=_r({rootMargin:o});y.useEffect(()=>{c.current=n},[n]);let m=!i&&!t&&f&&s;return y.useEffect(()=>{if(m){let h=setTimeout(()=>{c.current()},a);return()=>{clearTimeout(h)}}},[m,a]),[p,{rootRef:r}]}var Gr=Hr;const je={info:"#3B82F6",success:"#10B981",warning:"#F59E0B",error:"#EF4444"};pe.propTypes={severity:u.oneOf(["info","success","warning","error",""]).isRequired,size:u.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}st.propTypes={theme:u.string,type:u.oneOf(["button","line","select"]),onSelectType:u.func,extra:u.node,loading:u.bool,currentTab:u.oneOf(["info","success","warning","error",""])};function st({theme:t="dark",type:s="button",onSelectType:n,extra:o=void 0,currentTab:i="",loading:a=!1,...c}){const{t:p}=y.useContext(Ie),r=[{label:p("notification.allSeverity"),value:""},{label:p("notification.severityType.info"),value:"info"},{label:p("notification.severityType.success"),value:"success"},{label:p("notification.severityType.warning"),value:"warning"},{label:p("notification.severityType.error"),value:"error"}],f=g=>{(g!==i||!a)&&n(g)},m=y.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:a,onClick:()=>f(g.value),className:`profile-button ${S?"active":""}`,...c,children:g.label},g.value||R),C=(g,S,R)=>e.jsx(q,{variant:"text",disabled:a,onClick:()=>f(g.value),className:`profile-line-button ${S?"active":""}`,...c,children:g.label},g.value||R),v=()=>r?.map((g,S)=>{const R=i===g?.value;return s==="line"?e.jsx(y.Fragment,{children:C(g,R,S)},g.value||S):e.jsx(y.Fragment,{children:h(g,R,S)},g.value||S)}),l=g=>{const{value:S}=g.target;f(S==="all"?"":S)};return s==="select"?e.jsx(kt,{sx:{maxWidth:300},children:e.jsx(ke,{value:i||"all",onChange:l,size:"small",label:"Severity",IconComponent:g=>e.jsx(tt,{...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()}),o]})}it.propTypes={paging:u.objectOf(u.any).isRequired,loading:u.bool.isRequired,onChange:u.func.isRequired};function it({loading:t,paging:s,onChange:n}){const{t:o}=y.useContext(Ie),i=xe(r=>r.breakpoints.down("md"));if(s.pageCount<=0||i)return null;const a=(r,f)=>{n({page:f+1})},c=r=>{const f=Number(r.target.value);n({page:1,pageSize:f})},p=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(St,{component:"div",disabled:t,count:s.total,page:p,rowsPerPageOptions:[10,20,50,100],labelRowsPerPage:o("pagination.rowsPerPage"),labelDisplayedRows:({from:r,to:f,count:m})=>`${r}–${f} / ${m!==-1?m:`${o()}more than ${f}`}`,rowsPerPage:s.pageSize,onPageChange:a,onRowsPerPageChange:c})})}const Kr=y.memo(it),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"/>'},Ue=6,_e={"& .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}},Vr={border:"1px solid",borderColor:"divider",borderRadius:1,overflow:"hidden",backgroundColor:"background.paper",backgroundImage:"none",transition:"all 0.2s ease-in-out"},qe=()=>({...Vr,width:"calc(50% - 8px)"});at.propTypes={loading:u.bool,type:u.oneOf(["server","service"]),onFilterChange:u.func,blockletMap:u.object,filterType:u.oneOf(["component","entity"]),selectedId:u.array,severity:u.array,enableMarkAllAsRead:u.bool,unReadCount:u.number,onReadFilterChange:u.func,currentReadFilter:u.string};function at({onFilterChange:t=()=>{},loading:s=!1,type:n="service",blockletMap:o={},filterType:i="component",selectedId:a=[],severity:c=[],enableMarkAllAsRead:p=!0,unReadCount:r=0,onReadFilterChange:f=()=>{},currentReadFilter:m="all"}){const{t:h}=y.useContext(Ie),[C,v]=y.useState(null),l=!!C,[g,S]=y.useState(a),[R,P]=y.useState(c),[b,E]=y.useState(!1),[L,F]=y.useState(""),[w,k]=y.useState([]);y.useEffect(()=>{S(a),P(c)},[a,c]);const B=[{label:h("notification.filterType.all"),value:"all"},{label:h("notification.filterType.unread"),value:"unread"}],G=d=>{(d!==m||!s)&&f(d)},Y=[{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=d=>{v(d.currentTarget),F(""),E(!1)},he=()=>{v(null)},oe=d=>{const j=g.includes(d)?g.filter(A=>A!==d):[...g,d];S(j),t({id:j,severity:R})},se=d=>{const j=R.includes(d)?R.filter(A=>A!==d):[...R,d];P(j),t({severity:j,id:g})},ge=d=>{F(d.target.value)},me=()=>{E(!b)},K=Ft.useMemo(()=>{if(!o.size)return[];const d=[];return i==="component"&&d.push({label:h("notification.system"),id:"system"}),Array.from(o).forEach(([,j])=>{const A=j.did||j.meta?.did,W=j.title||j.meta?.title||"",U=j.appPid||j.appDid;(i==="component"&&U!==A||i==="entity"&&U===A)&&d.push({label:W,id:A,blocklet:j,ancestors:j.ancestors})}),d},[o,i,h]);y.useEffect(()=>{if(L.trim()==="")k(K);else{const d=L.toLowerCase(),j=K.filter(A=>A.label.toLowerCase().includes(d));k(j)}},[L,K]);const be=L.trim()!==""||b?w:w.slice(0,Ue);return e.jsxs(x,{children:[e.jsxs(x,{sx:{display:"flex",justifyContent:p?"space-between":"flex-end",alignItems:"flex-start",flexWrap:"wrap",gap:1},children:[p&&e.jsx(x,{sx:{display:"flex",gap:1.5},children:B.map(d=>e.jsxs(q,{disabled:s,onClick:()=>G(d.value),className:`profile-button ${m===d.value?"active":""}`,sx:{...n==="service"&&m===d.value?{color:"secondary.main"}:{},color:"red",fontWeight:m===d.value?"bold":"normal"},children:[d.label,d.value==="unread"&&r>0&&` (${r})`]},d.value))}),e.jsxs(x,{sx:{display:"flex",justifyContent:"flex-end",gap:2},children:[e.jsx(O,{size:"small",onClick:ne,disabled:s,sx:{minWidth:"auto",borderRadius:1,border:"1px solid",borderColor:"divider","&:hover":{backgroundColor:"action.hover"}},children:e.jsx(N,{icon:Qr,hFlip:!0})}),e.jsx(Pt,{open:l,anchorEl:C,onClose:he,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(Rt,{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(ze,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:2,flex:1},children:Y.map(d=>e.jsx(Le,{elevation:0,sx:qe(R.includes(d.value)),children:e.jsx(Z,{sx:{margin:0,padding:.5,width:"100%","& .MuiFormControlLabel-label":{display:"flex",alignItems:"center",gap:1,fontSize:"0.875rem"},..._e},control:e.jsx(Be,{checked:R.includes(d.value),onChange:()=>se(d.value),disabled:s,size:"small"}),label:e.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:.5},children:[e.jsx(pe,{severity:d.value}),d.label]})})},d.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:ge,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(Ve,{position:"start",sx:{marginRight:"2px"},children:e.jsx(N,{icon:jr})})}}})})]}),e.jsx(ze,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:2},children:be.map(d=>e.jsx(Le,{elevation:0,sx:qe(g.includes(d.id)),children:e.jsx(Z,{sx:{margin:0,padding:.5,width:"100%","& .MuiFormControlLabel-label":{fontSize:"0.875rem",width:"calc(100% - 36px)"},..._e},control:e.jsx(Be,{checked:g.includes(d.id),onChange:()=>oe(d.id),disabled:s,size:"small"}),label:e.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:.5,minWidth:0,width:"100%"},children:[d.blocklet&&e.jsx($e,{size:20,blocklet:d.blocklet,ancestors:d.ancestors,style:{borderRadius:4,flexShrink:0}}),e.jsx(I,{noWrap:!0,variant:"body2",component:"span",title:d.label,sx:{flex:1,overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%"},children:d.label})]})})},d.id))}),w.length>Ue&&L.trim()===""&&e.jsx(q,{fullWidth:!0,size:"small",onClick:me,sx:{mt:1},endIcon:b?e.jsx(It,{}):e.jsx(Tt,{})})]})]})})]})]}),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(d=>{const j=Y.find(A=>A.value===d);return e.jsx(we,{label:e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx(pe,{severity:d}),j?j.label:d]}),onDelete:()=>se(d),size:"small",variant:"outlined",sx:{borderRadius:2,color:"text.secondary",borderColor:"divider","& .MuiChip-label":{display:"flex",alignItems:"center"}}},`severity-${d}`)}),g.map(d=>{const j=K.find(A=>A.id===d);return e.jsx(we,{label:e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:.5},children:[j?.blocklet&&e.jsx($e,{size:16,blocklet:j.blocklet,ancestors:j.ancestors,style:{borderRadius:4,flexShrink:0}}),j?j.label:d]}),variant:"outlined",onDelete:()=>oe(d),size:"small",sx:{borderRadius:2,color:"text.secondary",borderColor:"divider","& .MuiChip-label":{display:"flex",alignItems:"center"}}},`component-${d}`)})]}):null]})}const Yr=ee(Et)`
|
|
2
2
|
position: fixed;
|
|
3
3
|
bottom: 20px;
|
|
4
4
|
right: 20px;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as h}from"./vendor-react-Dvs43sk9.js";import{j as a,y as x,F as j,W as e,z as S,M,ak as b}from"./vendor-mui-core-CcrDM-5l.js";import{ad as s}from"./index-
|
|
1
|
+
import{r as h}from"./vendor-react-Dvs43sk9.js";import{j as a,y as x,F as j,W as e,z as S,M,ak as b}from"./vendor-mui-core-CcrDM-5l.js";import{ad as s}from"./index-D6YhMyoB.js";import{T as v}from"./vendor-ux-CUBj5GXM.js";import{l as w}from"./arrow-down.svg-CH8Xzna_.js";import{a as H}from"./vendor-hooks-DTeIFVkk.js";import{L as _,D as y}from"./vendor-mui-x-BVRWKjdg.js";import{A}from"./AdapterDayjs-BEkLDdDJ.js";function Y({value:r=null,onChange:i,error:l=!1,helperText:u="",label:t="",timezone:n=""}){const f=n?s().tz(n):s(),p=H(()=>{let m=s();return r&&(m=n?s(r).tz(n):s(r)),m.format("YYYY-MM-DD[T]HH:mm")},[r,n]),D=m=>{const T=n?s(m).tz(n).format("YYYY-MM-DD HH:mm:00"):s(m).format("YYYY-MM-DD HH:mm:00");i(new Date(T))};return a.jsx(_,{dateAdapter:A,children:a.jsxs(x,{fullWidth:!0,error:l,children:[a.jsx(y,{label:t,minDateTime:f,value:s(p),onChange:D,slotProps:{textField:{error:l,helperText:l?u:""}},format:"YYYY-MM-DD HH:mm"}),u&&a.jsx(j,{children:u})]})})}Y.propTypes={value:e.oneOfType([e.string,e.instanceOf(Date)]),onChange:e.func.isRequired,error:e.bool,helperText:e.string,label:e.string,timezone:e.string};function C(r){return a.jsx(w,{...r,width:20,height:20})}const c={MINUTES_30:30*60*1e3,HOUR_1:60*60*1e3,HOURS_3:3*60*60*1e3,DAY_1:24*60*60*1e3,DAYS_7:7*24*60*60*1e3,DAYS_30:30*24*60*60*1e3};function E({placeholder:r="",value:i="",onChange:l,timezone:u=""}){const{t}=v(),[n,f]=h.useState(i||""),[p,D]=h.useState(null),m=h.useMemo(()=>[{value:new Date(Date.now()+c.MINUTES_30),label:`30 ${t("common.minutes")}`},{value:new Date(Date.now()+c.HOUR_1),label:`1 ${t("common.hour")}`},{value:new Date(Date.now()+c.HOURS_3),label:`3 ${t("common.hours")}`},{value:new Date(Date.now()+c.DAY_1),label:`1 ${t("common.day")}`},{value:new Date(Date.now()+c.DAYS_7),label:`7 ${t("common.days")}`},{value:new Date(Date.now()+c.DAYS_30),label:`30 ${t("common.days")}`},{value:"custom",label:t("common.custom")}],[t]),T=o=>{if(f(o),o==="custom"){const d=s().toDate();D(d),l(d)}else l(o)},g=o=>{D(o),l(o)};return h.useEffect(()=>{i&&(m.find(d=>s(d.value).isSame(i))||(f("custom"),D(i)))},[]),a.jsxs(a.Fragment,{children:[a.jsx(x,{fullWidth:!0,children:a.jsx(S,{select:!0,value:n,label:r||t("team.passport.passportExpireTime"),onChange:o=>T(o.target.value),variant:"outlined",slotProps:{select:{IconComponent:C}},children:m.map(o=>a.jsx(M,{value:o.value,children:o.label},o.value))})}),n==="custom"&&a.jsx(b,{children:a.jsx(Y,{value:p,onChange:g,label:t("team.passport.customExpireTime"),timezone:u,error:!p,helperText:p?void 0:t("team.passport.customExpireTime")})})]})}E.propTypes={value:e.oneOfType([e.string,e.instanceOf(Date)]),onChange:e.func.isRequired,timezone:e.string,placeholder:e.string};export{E as T};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as Wt,r as v}from"./vendor-react-Dvs43sk9.js";import{j as e,ak as y,z as X,b6 as me,be as Ke,y as V,am as ut,df as Bt,bm as Kt,at as ae,b1 as mt,W as h,T as ee,U as Ge,dg as pt,b5 as qe,a5 as Me,Q as Fe,cQ as Je,aN as Ue,a6 as ft,D as ht,a8 as xt,dh as qt,ad as gt,di as Mt,dj as Ut,c1 as st,n as Ht,x as $t,bb as Vt,M as it,cz as Gt,I as Jt,cU as Yt}from"./vendor-mui-core-CcrDM-5l.js";import{A as bt,J as Qt,C as Xt,e as le,F as Zt,a4 as je}from"./vendor-utils-BOkrEpKO.js";import{T as te,H as M,n as ce,b as en,h as jt,a0 as tn,au as nn,$ as vt,J as yt,av as ke,a as St,B as sn,W as an}from"./vendor-ux-CUBj5GXM.js";import{az as rn,U as Ye,a1 as Ct,aN as Rt,G as _e,c as _,ad as Z,p as on,aK as at}from"./index-FrAYP-A_.js";import{g as ye,b as $,a as se}from"./vendor-hooks-DTeIFVkk.js";import{u as wt,C as Y}from"./index.esm-JPZAjt0x.js";import{i as He}from"./isURL-BKM8U6hZ.js";import{S as Q}from"./section-DLNNkzJC.js";import{A as ln,a as cn,b as dn}from"./collapse-B0wJmKRl.js";import{S as Se}from"./shorten-label-C8Cay9FW.js";import{v as Tt}from"./index-DEDOywis.js";import{R as Nt,A as un,S as mn,a as pn,B as fn}from"./list-X2F1RKzQ.js";import{k as hn,d as xn,N as gn}from"./team-CD3vKVPJ.js";import{W as bn}from"./did-address-DrmEnz9K.js";import{p as It}from"./util-CJadXi8V.js";import{D as jn,g as vn}from"./traffic-h7MLT42d.js";import{B as Et}from"./bundle-avatar-JsO8Rdzw.js";import{u as yn}from"./use-mobile-B9FM-UBY.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-BnbwP1kf.js";import"./required-qTx6pgJa.js";import"./server-logo-notext.svg-CKQB0tIp.js";import"./index-Bg6_NsC_.js";import"./session-Ci_4G0CP.js";import"./base32-B9yl211y.js";import"./dot-BaR-8Dj-.js";import"./useAsync-BdgUavMa.js";import"./iframe-Ci5Ay1y2.js";import"./index-CiFQnBvO.js";import"./index-DBs9Ljax.js";import"./base-chart-Dhrxq8mT.js";import"./index-DLDRrQJH.js";import"./vendor-mui-x-BVRWKjdg.js";import"./AdapterDayjs-BEkLDdDJ.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:bt(b,Object.keys(ze))}),S=ye({testReceiver:"",testReceiverError:""}),j=N("enabled"),E=$(async(a,T,O=!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),O&&M.success(t("oauth.saveSuccess"))}catch(D){if(O)M.error(D.message||t("oauth.saveFailed"));else throw D}}),G=$(async(a,T,O)=>{try{i.isDirty&&await E(a,T,!1),await n.sendEmail({input:{did:l,receiver:O,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(X,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:t("notification.email.inputTestReceiver"),value:S.testReceiver,onChange:O=>{S.testReceiver=O.target.value},error:!!S.testReceiverError,helperText:S.testReceiverError||" "})}),confirmButtonText:t("common.confirm"),cancelButtonText:t("common.cancel"),async onConfirm(O){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),O()}})}),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(Q,{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(Q,{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(X,{...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(Q,{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(X,{...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(Q,{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(X,{...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(Q,{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(X,{...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(Q,{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(X,{...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(Q,{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(Q,{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(X,{...a,size:"small",error:!!i.errors[a.name],label:t("notification.email.companyName"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(Q,{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(X,{...a,size:"small",error:!!i.errors[a.name],label:t("notification.email.companyLink"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(Q,{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(X,{...a,size:"small",error:!!i.errors[a.name],label:t("notification.email.companyAddress"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(Q,{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(X,{...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:bt(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=Qt(Xt(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(X,{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(Q,{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(Q,{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(X,{...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(Q,{title:t("notification.pushKit.customOptions"),children:[e.jsx(Y,{name:"did",control:p,render:({field:R})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...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(X,{...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 kn(){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(jt,{tabs:ct,current:n,onChange:s}),e.jsx(y,{style:o,children:r[n]})]})}const At=v.createContext({}),{Provider:On,Consumer:zs}=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?[Z(C.dateRange[0]).toISOString(),Z(C.dateRange[1]).toISOString()]:void 0},{dids:T,...O}=a;let D="";T&&T.includes("system")&&(D="system");const re=T?T.filter(pe=>pe!=="system"):[],ue={...O,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?[Z(C.dateRange[0]).toISOString(),Z(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(On,{value:{notificationRecords:q},children:n})}function Qe(){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 kt(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"],Ot=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:Ot(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=Z().startOf("day");return n.filter(t=>Z(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},Oe=(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=kt(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)})]})}Xe.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 Xe({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(Xe,{...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=kt(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")})]})}Ze.propTypes={value:h.array.isRequired,onChange:h.func};function Ze({value:n,onChange:s}){const{locale:t}=te(),r=Z().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(Z(i.startDate).isAfter(i.endDate)||!Z(i.startDate).isValid()||!Z(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(()=>xt(l,Lt()),[l]),{getReceivers:u,inService:p,teamDid:i,getUser:N,blocklet:I}=Qe(),[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:[Z().subtract(1,"month").startOf("day").toDate(),Z().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"}],O=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(()=>{O()},[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:k})=>{const[,U=[],ne=[],J=[]]=k;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,k="")=>{if(!(!d.length||!c.length))try{s(c,d,m,k),F.anchorEl||(await Ee(.5),fe())}catch(U){console.error("handleResend error",{error:U})}},x=async({channels:c,isResendFailedOnly:d})=>{const m=C.map(k=>E[k].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(k){M.error(k.response?k.response.statusText:k.message)}},L=async(c,d,m,k=[],U=!0)=>{if(c.stopPropagation(),Kn(d,m)>=4){M.warning(r("notification.resendLimit"));return}if(!Ve.includes(m)){await A(d,k,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||Zt(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,k)=>{c.stopPropagation();const U=m.filter(ne=>ne!==d);w(ne=>({...ne,[k]: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:Oe},filterOptions:{names:T,fullWidth:!0,logic:De,display:(c,d,m,k)=>e.jsx(Be,{label:"Wallet",filterList:c,onChange:d,index:m,column:k,filterValues:T})},customBodyRenderLite:c=>{const{walletSendStatus:d,walletSendAt:m,walletSendFailedReason:k}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:k,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:k}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:k,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:Oe},filterOptions:{names:T,fullWidth:!0,logic:De,display:(c,d,m,k)=>e.jsx(Be,{label:"Push Kit",filterList:c,onChange:d,index:m,column:k,filterValues:T})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{emailSendStatus:d,emailSendAt:m,emailSendFailedReason:k}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:k,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:Oe},filterOptions:{names:T,fullWidth:!0,logic:De,display:(c,d,m,k)=>e.jsx(Be,{label:"Email",filterList:c,onChange:d,index:m,column:k,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[k,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:k},k),e.jsx(xe,{status:ne.status,updatedAt:ne.sendAt,reason:ne.failedReason,channel:"webhook",onResend:J=>L(J,E[c],"webhook",[k],!1)})]},k)})}}},{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(Ze,{value:f.dateRange,onChange:W},"date-picker"),e.jsx(ce,{variant:"contained",size:"small",color:"primary",loading:S,startIcon:e.jsx(qt,{}),onClick:()=>O(),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(gt,{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:k}=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]?ke.success.main:"inherit"},children:[B?.result?e.jsx(Mt,{}):e.jsx(ft,{size:12,sx:{color:ke.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:ke.error.main},children:[e.jsx(Ut,{}),e.jsx("span",{children:k})]},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`
|
|
1
|
+
import{g as Wt,r as v}from"./vendor-react-Dvs43sk9.js";import{j as e,ak as y,z as X,b6 as me,be as Ke,y as V,am as ut,df as Bt,bm as Kt,at as ae,b1 as mt,W as h,T as ee,U as Ge,dg as pt,b5 as qe,a5 as Me,Q as Fe,cQ as Je,aN as Ue,a6 as ft,D as ht,a8 as xt,dh as qt,ad as gt,di as Mt,dj as Ut,c1 as st,n as Ht,x as $t,bb as Vt,M as it,cz as Gt,I as Jt,cU as Yt}from"./vendor-mui-core-CcrDM-5l.js";import{A as bt,J as Qt,C as Xt,e as le,F as Zt,a4 as je}from"./vendor-utils-BOkrEpKO.js";import{T as te,H as M,n as ce,b as en,h as jt,a0 as tn,au as nn,$ as vt,J as yt,av as ke,a as St,B as sn,W as an}from"./vendor-ux-CUBj5GXM.js";import{az as rn,U as Ye,a1 as Ct,aN as Rt,G as _e,c as _,ad as Z,p as on,aK as at}from"./index-D6YhMyoB.js";import{g as ye,b as $,a as se}from"./vendor-hooks-DTeIFVkk.js";import{u as wt,C as Y}from"./index.esm-JPZAjt0x.js";import{i as He}from"./isURL-CTW__dzu.js";import{S as Q}from"./section-DLNNkzJC.js";import{A as ln,a as cn,b as dn}from"./collapse-B0wJmKRl.js";import{S as Se}from"./shorten-label-C8Cay9FW.js";import{v as Tt}from"./index-DEDOywis.js";import{R as Nt,A as un,S as mn,a as pn,B as fn}from"./list-A-6ZKqgn.js";import{k as hn,d as xn,N as gn}from"./team-Bxi69lmr.js";import{W as bn}from"./did-address-DrmEnz9K.js";import{p as It}from"./util-DhFzZqQY.js";import{D as jn,g as vn}from"./traffic-5kSM9zFo.js";import{B as Et}from"./bundle-avatar-DzIGEDbC.js";import{u as yn}from"./use-mobile-B9FM-UBY.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-BnbwP1kf.js";import"./required-qTx6pgJa.js";import"./server-logo-notext.svg-CKQB0tIp.js";import"./index-Ca2q4nT6.js";import"./session-fyUi2EvV.js";import"./base32-B9yl211y.js";import"./dot-BaR-8Dj-.js";import"./useAsync-BdgUavMa.js";import"./iframe-Dl-5xRyx.js";import"./index-CiFQnBvO.js";import"./index-DBs9Ljax.js";import"./base-chart-Dhrxq8mT.js";import"./index-DLDRrQJH.js";import"./vendor-mui-x-BVRWKjdg.js";import"./AdapterDayjs-BEkLDdDJ.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:bt(b,Object.keys(ze))}),S=ye({testReceiver:"",testReceiverError:""}),j=N("enabled"),E=$(async(a,T,O=!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),O&&M.success(t("oauth.saveSuccess"))}catch(D){if(O)M.error(D.message||t("oauth.saveFailed"));else throw D}}),G=$(async(a,T,O)=>{try{i.isDirty&&await E(a,T,!1),await n.sendEmail({input:{did:l,receiver:O,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(X,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:t("notification.email.inputTestReceiver"),value:S.testReceiver,onChange:O=>{S.testReceiver=O.target.value},error:!!S.testReceiverError,helperText:S.testReceiverError||" "})}),confirmButtonText:t("common.confirm"),cancelButtonText:t("common.cancel"),async onConfirm(O){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),O()}})}),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(Q,{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(Q,{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(X,{...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(Q,{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(X,{...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(Q,{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(X,{...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(Q,{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(X,{...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(Q,{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(X,{...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(Q,{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(Q,{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(X,{...a,size:"small",error:!!i.errors[a.name],label:t("notification.email.companyName"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(Q,{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(X,{...a,size:"small",error:!!i.errors[a.name],label:t("notification.email.companyLink"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(Q,{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(X,{...a,size:"small",error:!!i.errors[a.name],label:t("notification.email.companyAddress"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(Q,{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(X,{...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:bt(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=Qt(Xt(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(X,{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(Q,{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(Q,{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(X,{...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(Q,{title:t("notification.pushKit.customOptions"),children:[e.jsx(Y,{name:"did",control:p,render:({field:R})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...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(X,{...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 kn(){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(jt,{tabs:ct,current:n,onChange:s}),e.jsx(y,{style:o,children:r[n]})]})}const At=v.createContext({}),{Provider:On,Consumer:zs}=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?[Z(C.dateRange[0]).toISOString(),Z(C.dateRange[1]).toISOString()]:void 0},{dids:T,...O}=a;let D="";T&&T.includes("system")&&(D="system");const re=T?T.filter(pe=>pe!=="system"):[],ue={...O,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?[Z(C.dateRange[0]).toISOString(),Z(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(On,{value:{notificationRecords:q},children:n})}function Qe(){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 kt(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"],Ot=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:Ot(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=Z().startOf("day");return n.filter(t=>Z(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},Oe=(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=kt(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)})]})}Xe.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 Xe({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(Xe,{...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=kt(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")})]})}Ze.propTypes={value:h.array.isRequired,onChange:h.func};function Ze({value:n,onChange:s}){const{locale:t}=te(),r=Z().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(Z(i.startDate).isAfter(i.endDate)||!Z(i.startDate).isValid()||!Z(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(()=>xt(l,Lt()),[l]),{getReceivers:u,inService:p,teamDid:i,getUser:N,blocklet:I}=Qe(),[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:[Z().subtract(1,"month").startOf("day").toDate(),Z().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"}],O=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(()=>{O()},[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:k})=>{const[,U=[],ne=[],J=[]]=k;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,k="")=>{if(!(!d.length||!c.length))try{s(c,d,m,k),F.anchorEl||(await Ee(.5),fe())}catch(U){console.error("handleResend error",{error:U})}},x=async({channels:c,isResendFailedOnly:d})=>{const m=C.map(k=>E[k].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(k){M.error(k.response?k.response.statusText:k.message)}},L=async(c,d,m,k=[],U=!0)=>{if(c.stopPropagation(),Kn(d,m)>=4){M.warning(r("notification.resendLimit"));return}if(!Ve.includes(m)){await A(d,k,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||Zt(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,k)=>{c.stopPropagation();const U=m.filter(ne=>ne!==d);w(ne=>({...ne,[k]: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:Oe},filterOptions:{names:T,fullWidth:!0,logic:De,display:(c,d,m,k)=>e.jsx(Be,{label:"Wallet",filterList:c,onChange:d,index:m,column:k,filterValues:T})},customBodyRenderLite:c=>{const{walletSendStatus:d,walletSendAt:m,walletSendFailedReason:k}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:k,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:k}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:k,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:Oe},filterOptions:{names:T,fullWidth:!0,logic:De,display:(c,d,m,k)=>e.jsx(Be,{label:"Push Kit",filterList:c,onChange:d,index:m,column:k,filterValues:T})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{emailSendStatus:d,emailSendAt:m,emailSendFailedReason:k}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:k,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:Oe},filterOptions:{names:T,fullWidth:!0,logic:De,display:(c,d,m,k)=>e.jsx(Be,{label:"Email",filterList:c,onChange:d,index:m,column:k,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[k,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:k},k),e.jsx(xe,{status:ne.status,updatedAt:ne.sendAt,reason:ne.failedReason,channel:"webhook",onResend:J=>L(J,E[c],"webhook",[k],!1)})]},k)})}}},{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(Ze,{value:f.dateRange,onChange:W},"date-picker"),e.jsx(ce,{variant:"contained",size:"small",color:"primary",loading:S,startIcon:e.jsx(qt,{}),onClick:()=>O(),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(gt,{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:k}=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]?ke.success.main:"inherit"},children:[B?.result?e.jsx(Mt,{}):e.jsx(ft,{size:12,sx:{color:ke.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:ke.error.main},children:[e.jsx(Ut,{}),e.jsx("span",{children:k})]},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
2
|
td.MuiTableCell-footer {
|
|
3
3
|
border: none !important;
|
|
4
4
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as a,D as I,T as _,ci as C,Q as W,cj as Q,aV as q,ak as h,ck as K,aU as X,av as B,f as L,b_ as Y,cl as J}from"./vendor-mui-core-CcrDM-5l.js";import{r as d,k as V,L as z,n as Z,o as ee}from"./vendor-react-Dvs43sk9.js";import{H as A,aL as ae}from"./index-
|
|
1
|
+
import{j as a,D as I,T as _,ci as C,Q as W,cj as Q,aV as q,ak as h,ck as K,aU as X,av as B,f as L,b_ as Y,cl as J}from"./vendor-mui-core-CcrDM-5l.js";import{r as d,k as V,L as z,n as Z,o as ee}from"./vendor-react-Dvs43sk9.js";import{H as A,aL as ae}from"./index-D6YhMyoB.js";import{e as te}from"./vendor-hooks-DTeIFVkk.js";import{M as ie,m,U as E,V as S}from"./vendor-ux-CUBj5GXM.js";import{z as re}from"./vendor-arcblock-BnbwP1kf.js";const U=d.createContext(null),oe=e=>{const i=d.use(U);return d.useLayoutEffect(()=>{},[]),i};function se({children:e=void 0,...i}){const[t,r]=d.useState({inFullPage:!1,showToggleButton:!1,headerVisibleInFullPage:!0,footerVisibleInFullPage:!1,sidebarVisibleInFullPage:!1}),s=()=>{r(o=>({...o,inFullPage:!o.inFullPage}))},l=d.useMemo(()=>({...t,headerVisible:!t.inFullPage||t.headerVisibleInFullPage,footerVisible:!t.inFullPage||t.footerVisibleInFullPage,sidebarVisible:!t.inFullPage||t.sidebarVisibleInFullPage,toggleFullPage:s,configure:o=>r(n=>({...n,...o}))}),[t]);return a.jsx(U,{value:l,...i,children:e})}function le({name:e,size:i=36,alt:t="",color:r="#000000",prefix:s="/images",showBadge:l=!1,style:o={},...n}){const c=`${s}/${e}-${r.replace(/^#/,"")}.png`;return a.jsxs(ne,{style:{width:i,height:i},children:[a.jsx(ie,{width:i,height:i,alt:t||e,src:c,style:Object.assign({width:i},o),...n}),l&&a.jsx("i",{className:"badge-point"})]})}const ne=m("div")`
|
|
2
2
|
position: relative;
|
|
3
3
|
.badge-point {
|
|
4
4
|
position: absolute;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t,ak as s,T as n,W as i}from"./vendor-mui-core-CcrDM-5l.js";import{T as f}from"./vendor-ux-CUBj5GXM.js";import{L as g,r as k}from"./vendor-react-Dvs43sk9.js";import"./index-
|
|
1
|
+
import{j as t,ak as s,T as n,W as i}from"./vendor-mui-core-CcrDM-5l.js";import{T as f}from"./vendor-ux-CUBj5GXM.js";import{L as g,r as k}from"./vendor-react-Dvs43sk9.js";import"./index-D6YhMyoB.js";import"./vendor-utils-BOkrEpKO.js";import"./vendor-hooks-DTeIFVkk.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-BnbwP1kf.js";const l=(e,o)=>[e,...Array.isArray(o)?o:[o]],a=(e=2)=>({overflow:"hidden",textOverflow:"ellipsis",wordBreak:"break-word",display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical"});function p({sx:e={},...o}){const r=l({display:"flex",flexWrap:"wrap",mx:-1},e);return t.jsx(s,{sx:r,...o})}p.propTypes={sx:i.object};function w({icon:e}){const[o,r]=k.useState(!1);return!e||o?null:typeof e=="string"?t.jsx(s,{component:"img",src:e,alt:"",sx:{width:1,height:1},onError:()=>r(!0)}):e}w.propTypes={icon:i.oneOfType([i.string,i.node]).isRequired};function b({title:e,desc:o,extra:r,cover:c,icon:d,to:x,sx:h}){const m=l({position:"relative",flexBasis:{xs:"100%",sm:"50%",md:"33.33%",lg:"25%"},maxWidth:{xs:"100%",sm:"50%",md:"33.33%",lg:"25%"},mb:{xs:2,md:6},px:1},h);return t.jsx(s,{sx:m,children:t.jsx(s,{component:g,to:x,target:"_blank",sx:{display:"flex",flexDirection:"column",gap:1,height:1,pt:0,color:"inherit",textDecoration:"none",borderRadius:1,cursor:"pointer"},children:t.jsxs(s,{children:[t.jsxs(s,{sx:{position:"relative"},children:[c,d&&t.jsx(s,{sx:{position:"absolute",top:44,left:16,zIndex:1,width:56,height:56},children:t.jsx(w,{icon:d})})]}),t.jsx(n,{sx:{mt:1,fontSize:"1.25rem",fontWeight:600,...a()},children:e}),o&&t.jsx(n,{variant:"body2",sx:{my:1,...a(),color:"text.secondary"},children:o}),r]})})})}b.propTypes={title:i.string.isRequired,desc:i.string.isRequired,extra:i.node.isRequired,cover:i.string.isRequired,icon:i.string.isRequired,to:i.string.isRequired,sx:i.object.isRequired};const j="/.well-known/service/static/assets/doc-board-bg-DWZHV9Ng.png";function u({board:e,sx:o,...r}){return t.jsx(b,{date:e.createdAt,sx:o,to:e.link,title:e.title,desc:e.desc,cover:t.jsx(s,{sx:{position:"relative",paddingTop:`${9/16*100}%`,border:1,borderColor:"divider",borderRadius:1,overflow:"hidden"},children:t.jsx(s,{component:"img",src:j,alt:"",sx:{position:"absolute",top:0,left:0,width:1,filter:c=>c.palette.mode==="dark"?"brightness(0.28) contrast(1.1)":"none"}})}),icon:e.icon,...r})}u.propTypes={board:i.object.isRequired,sx:i.object.isRequired};function I(){const{locale:e}=f(),o=[{id:"1",title:"Blocklet Platform",desc:"Guide to understand and build on our blocklet platform",icon:"https://www.arcblock.io/favicon.ico",link:`https://www.arcblock.io/docs/blocklet-developer/${e}/getting-started`},{id:"2",title:"Create Blocklet",desc:"Build blocklet with just one command line.",icon:"https://www.arcblock.io/favicon.ico",link:`https://www.arcblock.io/docs/createblocklet/${e}/quick-start`},{id:"3",title:"Blocklet Launcher",desc:"Streamlining Blocklet Launching.",icon:"https://www.arcblock.io/docs/uploads/5a4f4716bc8061532a535fe816a9169c.png",link:`https://www.arcblock.io/docs/launcher/${e}/launcher-welcome`},{id:"4",title:"DID Spaces",desc:"Digital Spaces for Decentralized Identity (DID)",icon:"https://www.arcblock.io/docs/uploads/3a8b142d7c940c57eced71eddba2ff19.png",link:`https://www.arcblock.io/docs/did-spaces/${e}/did-spaces-getting-started`},{id:"5",title:"DID Wallet",desc:"DID Wallet Support docs",icon:"https://www.arcblock.io/docs/uploads/59ddb28f405ee670428e5fe1ff12d104.png",link:`https://www.arcblock.io/docs/did-wallet/${e}/get-started`},{id:"6",title:"DID Names",desc:"Naming Service based on NFT and verifiable credentials",icon:"https://www.didnames.io/favicon.ico?imageFilter=resize&w=32",link:`https://www.arcblock.io/docs/did-domain/${e}/did-domain-faq`},{id:"7",title:"Blockchain",desc:"The ledger for ArcBlock ecosystem",icon:"https://www.arcblock.io/docs/uploads/4a20c152faae0f104ed0815ff3b8b48b.png",link:`https://www.arcblock.io/docs/blockchain/${e}/blockchain-how-to-guides`},{id:"8",title:"DID Connect",desc:"The open protocol and development kit for connecting users and dapps",icon:"https://www.arcblock.io/docs/uploads/d189118f89b56e9d5b03ad5a0212a4ab.png",link:`https://www.arcblock.io/docs/did-connect/${e}/developer-guides`}];return t.jsx(p,{children:o.map(r=>t.jsx(u,{board:r},r.id))})}export{I as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as u}from"./vendor-react-Dvs43sk9.js";import{W as o,j as e,ak as j,aN as L,z as A,at as K,bm as B,I as P,a6 as W,bE as M,aj as X,bF as G}from"./vendor-mui-core-CcrDM-5l.js";import{C as H}from"./Google-kE2qbn1K.js";import{b as U}from"./vendor-ux-CUBj5GXM.js";import{aE as Y,f as $}from"./index-
|
|
1
|
+
import{r as u}from"./vendor-react-Dvs43sk9.js";import{W as o,j as e,ak as j,aN as L,z as A,at as K,bm as B,I as P,a6 as W,bE as M,aj as X,bF as G}from"./vendor-mui-core-CcrDM-5l.js";import{C as H}from"./Google-kE2qbn1K.js";import{b as U}from"./vendor-ux-CUBj5GXM.js";import{aE as Y,f as $}from"./index-D6YhMyoB.js";import{A as J}from"./vendor-arcblock-BnbwP1kf.js";import{R as Q}from"./required-qTx6pgJa.js";import{F as Z}from"./form-wrapper-DimyA4Kf.js";import{L as v}from"./logo-uploader-DDncXmM_.js";import{A as ee,a as ne,b as te}from"./collapse-B0wJmKRl.js";const S={description:o.string,editing:o.bool,onChange:o.func,required:o.bool,value:o.any,componentProps:o.object,render:o.func,renderFormItem:o.func};function T({editing:n,value:s,onChange:l}){const[i,c]=u.useState(!1),m=u.useRef(),f=u.useRef(s);u.useEffect(()=>{let a=null;return n&&(a=setTimeout(()=>{c(!0)},50)),()=>{clearTimeout(a)}},[n]);const h=a=>{f.current=a,l(a)},b=()=>{c(!1),l(f.current)},y=e.jsx(j,{className:"form-item-input slot",sx:{px:1},children:e.jsxs(j,{sx:{display:"flex",alignItems:"center"},children:[s,s!=="auto"&&e.jsx("div",{style:{marginLeft:4,backgroundColor:s,width:"1em",height:"1em",borderRadius:"0.2em"}})]})}),p=e.jsxs(j,{onKeyDown:b,sx:{display:"flex",flexGrow:1,alignItems:"center",height:"40px"},children:[e.jsx(j,{onClick:()=>c(!0),sx:{display:"flex",alignItems:"center"},children:e.jsx("div",{ref:m,style:{flexShrink:0,marginLeft:"8px",backgroundColor:s,width:"32px",height:"32px",boxSizing:"border-box",borderRadius:"8px",border:"1px solid #eee",cursor:s==="auto"?"default":"pointer"}})}),e.jsx(L,{open:i,anchorEl:m.current,onClose:()=>c(!1),anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:e.jsx(H,{color:s,onChange:a=>h(a.hex)})})]});return n?p:y}T.propTypes=S;function D({editing:n,description:s,value:l,onChange:i,componentProps:c={},...m}){const{placeholder:f}=c,h=u.useRef(l),{t:b}=u.useContext(U),y=a=>{a.key==="Enter"&&i(h.current,"confirm")},p=a=>{h.current=a,i(a)};return n?e.jsx(A,{style:{flex:1},fullWidth:!0,value:l,onChange:a=>{a.persist(),p(a.target.value)},autoFocus:!0,size:"small",variant:"outlined",placeholder:s||f,onKeyDown:y,...m}):e.jsx(j,{className:"form-item-input slot",sx:{px:1},children:l||e.jsx("span",{className:"placeholder",children:b("common.requiredInputPlaceholder",{name:s||f})})})}D.propTypes=S;function O({editing:n,value:s,onChange:l,componentProps:i,...c}){const{blocklet:m}=i,f=s==="auto"?J(m.appDid):s;return e.jsxs(j,{sx:{display:"flex",alignItems:"center"},children:[e.jsx("div",{style:{width:96,marginRight:12},dangerouslySetInnerHTML:{__html:Y({title:"Owner",issuer:$.getDisplayName(m),issuerDid:m.appDid,ownerName:"Your Name",ownerDid:m.appDid,preferredColor:s||"auto"})}}),e.jsx(T,{...c,editing:n,value:n?f:s,onChange:l,componentProps:i})]})}O.propTypes={...S,componentProps:o.shape({blocklet:o.object.isRequired}).isRequired};const re=G`
|
|
2
2
|
0%, 100% {
|
|
3
3
|
transform: scale(1) translateX(0);
|
|
4
4
|
}
|