@abtnode/blocklet-services 1.16.38-beta-20250125-130409-89d4849d → 1.16.38-beta-20250127-033053-73a3d2dc
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/dist/assets/{Add-B2yJ7-eq.js → Add-0_yO_NcD.js} +1 -1
- package/dist/assets/{ArrowDropDown-D34En9iv.js → ArrowDropDown-CSe7vdhu.js} +1 -1
- package/dist/assets/{CheckCircle-BFXaMcKG.js → CheckCircle-C20J4AX-.js} +1 -1
- package/dist/assets/{ChevronLeft-BXNAWRN5.js → ChevronLeft-CYpg5M_K.js} +1 -1
- package/dist/assets/{ChevronRight-bqoO4ITE.js → ChevronRight-DORpkdoL.js} +1 -1
- package/dist/assets/{DeleteOutline-_fdI9SLO.js → DeleteOutline-BaOxCgo3.js} +1 -1
- package/dist/assets/{Done-BegjCX44.js → Done-Bsd0QwkQ.js} +1 -1
- package/dist/assets/{Download-ynxZ21_h.js → Download-BF8ec3kS.js} +1 -1
- package/dist/assets/{Error-Dy9JDlUO.js → Error-CmnuwZkD.js} +1 -1
- package/dist/assets/{Google-oUsdET4E.js → Google-F1HiAjHW.js} +1 -1
- package/dist/assets/{InfoOutlined-CNFvZjEE.js → InfoOutlined-DZAeG3v-.js} +1 -1
- package/dist/assets/{Launch-DrBfpSUO.js → Launch-DNY7Ut_B.js} +1 -1
- package/dist/assets/{LaunchOutlined-BstP_JKj.js → LaunchOutlined-BUOyH9Rv.js} +1 -1
- package/dist/assets/{Loop-CuBUpP_g.js → Loop-gZ2g1v3i.js} +1 -1
- package/dist/assets/{MoreHoriz-jduVqLUc.js → MoreHoriz-CwoKs0Gg.js} +1 -1
- package/dist/assets/{PlayArrow-CauLC4o_.js → PlayArrow-C6dXJHO6.js} +1 -1
- package/dist/assets/{ViewList-CePklU1n.js → ViewList-DfGpYdZ-.js} +1 -1
- package/dist/assets/{access-control-DMs8KTjf.js → access-control-DWS7Lowo.js} +1 -1
- package/dist/assets/{actions-B31e80dT.js → actions-BvtS-2sJ.js} +1 -1
- package/dist/assets/{add-component-core-BRZ3frb6.js → add-component-core-DZPE4BRe.js} +1 -1
- package/dist/assets/{add-resource-CpU17Psd.js → add-resource-CYNZTaOG.js} +1 -1
- package/dist/assets/{addon-DTkR7c7s.js → addon-CDVN9YCj.js} +1 -1
- package/dist/assets/{analytics-BdRFij_g.js → analytics-0lVXNyXs.js} +1 -1
- package/dist/assets/{audit-logs-B5tzv9w6.js → audit-logs-CJvI5okV.js} +1 -1
- package/dist/assets/{base32-Bxy_Ng3r.js → base32-Bl4ek2bl.js} +1 -1
- package/dist/assets/{branding-DEsr5kE0.js → branding-CfeUWBA7.js} +2 -2
- package/dist/assets/{bundle-avatar-BSrkMwWG.js → bundle-avatar-TEUPlhi2.js} +1 -1
- package/dist/assets/{button-CT_SqdC_.js → button-CzSgwkGN.js} +1 -1
- package/dist/assets/{click-to-copy-DG6oCsDy.js → click-to-copy-Ck4RKrL7.js} +1 -1
- package/dist/assets/{complete-B7fQAviW.js → complete-CPnz5QUF.js} +1 -1
- package/dist/assets/{component-L5_5YcjO.js → component-Srk2_SVH.js} +1 -1
- package/dist/assets/{config-Bi4mtKrp.js → config-Cp3L8D_L.js} +1 -1
- package/dist/assets/{config-DfNCVYae.js → config-kJZsVZD6.js} +1 -1
- package/dist/assets/{config-navigation-BEXQaINe.js → config-navigation-a3GJWM1m.js} +3 -3
- package/dist/assets/{config-space-C1WFdLmf.js → config-space-piVzY5c1.js} +1 -1
- package/dist/assets/{confirm-Cbx82b25.js → confirm-D7n9Rzfx.js} +1 -1
- package/dist/assets/{connect-Cp12hGV2.js → connect-BZUv1d-6.js} +1 -1
- package/dist/assets/{connect-kW-GMUG3.js → connect-rdXbvbmJ.js} +1 -1
- package/dist/assets/{connect-to-D5VZBQsq.js → connect-to-BzfmK9yx.js} +1 -1
- package/dist/assets/{dashboard-uG_G13IR.js → dashboard-B_hsqmQK.js} +3 -3
- package/dist/assets/{did-address-DhC4Z1Ef.js → did-address-CLeqbWiu.js} +1 -1
- package/dist/assets/{domain-DvrEWdQ8.js → domain-DgPzyf2N.js} +1 -1
- package/dist/assets/domain-list-BiYGOOY3.js +15 -0
- package/dist/assets/{email-Cs87G5pr.js → email-5azpRba_.js} +1 -1
- package/dist/assets/{exchange-passport-Crhw_vMf.js → exchange-passport-Cus1rYsJ.js} +1 -1
- package/dist/assets/{form-text-input-COijwVFy.js → form-text-input-Cf1j6PeI.js} +1 -1
- package/dist/assets/{fuel-DxcT-75B.js → fuel-BaqDy7AE.js} +1 -1
- package/dist/assets/{fullpage-CAAXK4pO.js → fullpage-Dx8PYbvz.js} +1 -1
- package/dist/assets/{get-safe-url-CJIsC1HE.js → get-safe-url-BF9qL1PD.js} +1 -1
- package/dist/assets/{get-safe-url-jf8X-XpV.js → get-safe-url-BsKINLVF.js} +1 -1
- package/dist/assets/{home-Ckf42YJd.js → home-D42zu2I_.js} +1 -1
- package/dist/assets/{iframe-BYvZHXU-.js → iframe-Cn--d9nR.js} +1 -1
- package/dist/assets/{index-BNCJw59G.js → index-6oQLUjq6.js} +1 -1
- package/dist/assets/{index-BJpEKQ4d.js → index-BDfZ8xEV.js} +22 -22
- package/dist/assets/{index-CRaD-3s4.js → index-BWKYj-2X.js} +4 -4
- package/dist/assets/{index-Xsfh2QSh.js → index-BgGF6utP.js} +1 -1
- package/dist/assets/{index-Dnxf7bfY.js → index-CEbjBHHi.js} +1 -1
- package/dist/assets/{index-B86l7aCe.js → index-CFT-L0SZ.js} +1 -1
- package/dist/assets/{index-3PobA81m.js → index-CKsz_iVM.js} +1 -1
- package/dist/assets/{index-2NCgoG1i.js → index-CSkA6M4K.js} +1 -1
- package/dist/assets/{index-KhsqOaMW.js → index-CXVY5UoP.js} +1 -1
- package/dist/assets/{index-Bw3pdP7q.js → index-DTzPwoh8.js} +1 -1
- package/dist/assets/{index-_ph5477y.js → index-DpNGP1ih.js} +1 -1
- package/dist/assets/{index-DBxnR425.js → index-DpOEjWGx.js} +1 -1
- package/dist/assets/index-fel1gHRy.js +61 -0
- package/dist/assets/{index-C7s7t2aN.js → index-kk2gduJr.js} +1 -1
- package/dist/assets/{index-PxlbAHCL.js → index-uosYiNLl.js} +3 -3
- package/dist/assets/{invitation-DbGm8k25.js → invitation-DpOgzXor.js} +1 -1
- package/dist/assets/{invite-6nyN-oEv.js → invite-DmpCzOPN.js} +1 -1
- package/dist/assets/{issue-passport-YNIanHYf.js → issue-passport--83QQUn2.js} +1 -1
- package/dist/assets/{item-DvkqLmAe.js → item-7Z8_UB5K.js} +1 -1
- package/dist/assets/{layout-BVSGD29L.js → layout-Dv_7-Fpq.js} +1 -1
- package/dist/assets/{list-header-Br_UsG2e.js → list-header-CfBPZZEw.js} +1 -1
- package/dist/assets/{list-DrMoP89n.js → list-yjVo8vxH.js} +1 -1
- package/dist/assets/{localization-V7oQS6wL.js → localization-CRwVeETn.js} +1 -1
- package/dist/assets/{log-DCaMhKsI.js → log-CNjGA-yl.js} +1 -1
- package/dist/assets/{login-CHKXy0wB.js → login-DWrSz67b.js} +1 -1
- package/dist/assets/{login-oauth-callback-BSX9wejc.js → login-oauth-callback-VNeZxFH0.js} +1 -1
- package/dist/assets/{logo-uploader-D3pYQBpx.js → logo-uploader-DZm2nb0s.js} +3 -3
- package/dist/assets/{lost-passport-BDU3b7Z_.js → lost-passport-DFh2B6Gl.js} +1 -1
- package/dist/assets/{open-window-DrK6iGmf.js → open-window-BvyLumiN.js} +1 -1
- package/dist/assets/{overview-BdW7-A5w.js → overview-DNQZ-tgj.js} +1 -1
- package/dist/assets/{page-header-JASV_XcR.js → page-header-CJHCTtBc.js} +1 -1
- package/dist/assets/{permission-BkijBCin.js → permission-B0xKCybj.js} +1 -1
- package/dist/assets/{preferences-CtlqLrD7.js → preferences-BMgF6Djl.js} +1 -1
- package/dist/assets/publish-resource-B_OOg2Om.js +1 -0
- package/dist/assets/{react-beautiful-dnd.esm-C5Uq3rbJ.js → react-beautiful-dnd.esm-DY38RjFx.js} +1 -1
- package/dist/assets/{relative-time-CQ0hJZC_.js → relative-time-C36uWHLw.js} +1 -1
- package/dist/assets/sdk-VtyRZZVE.js +1 -0
- package/dist/assets/{session-ClC5u_ou.js → session-DutPZhUI.js} +1 -1
- package/dist/assets/{setup-DdTSQTvr.js → setup-lHrzljce.js} +3 -3
- package/dist/assets/{start-Byudzjg5.js → start-DNIWxyMi.js} +1 -1
- package/dist/assets/{step-actions-Zk6bKoYE.js → step-actions-BYFwIhu4.js} +1 -1
- package/dist/assets/{studio-BGgRA_ZI.js → studio-DBfgF1ck.js} +1 -1
- package/dist/assets/{switch-control-BmI39UF6.js → switch-control-B8wYzo2_.js} +1 -1
- package/dist/assets/{traffic-B70zlTcA.js → traffic-1TtyUzFO.js} +1 -1
- package/dist/assets/{transfer-C-8HxdfL.js → transfer-Bh7VQuKL.js} +1 -1
- package/dist/assets/{unsubscribe-CrmlZkSk.js → unsubscribe-C_eX2N6S.js} +1 -1
- package/dist/assets/{useLocalStorage-CTToOZ4l.js → useLocalStorage-tmIJr51I.js} +1 -1
- package/dist/assets/{user-center-BB2CLc7Q.js → user-center-pv7oyGUu.js} +1 -1
- package/dist/assets/{util-DowdN-NO.js → util-BY6uUuCk.js} +1 -1
- package/dist/assets/{util-BnCdSUGw.js → util-CtKeCk_N.js} +1 -1
- package/dist/assets/{vendor-arcblock-CVRRnBv2.js → vendor-arcblock-Bf7AGBSd.js} +1 -1
- package/dist/assets/{wrap-locale-CNuv_qkt.js → wrap-locale-BjJvyHQM.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/service-worker.js +1 -1
- package/package.json +25 -25
- package/dist/assets/domain-list-B1J4C6ST.js +0 -15
- package/dist/assets/index-BUstrRo5.js +0 -61
- package/dist/assets/publish-resource-CsuZRYMx.js +0 -1
- package/dist/assets/sdk-CncrP2i9.js +0 -1
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import{_ as ae,aC as $e,z as ut,f as Be,L as mt,e as k,a1 as W,a5 as pt,j as O,aW as ft,aX as Me,aY as ht,C as Pe,Y as xt,a8 as ze,aS as gt,aq as Dt}from"./vendor-arcblock-CVRRnBv2.js";import{a1 as le,j as e,a3 as p,a2 as z,T as q,ad as ce,e as G,t as de,aj as Ue,E as s,a4 as M,M as yt,bW as jt,al as Ne,bm as vt,bn as bt,am as Ct,ao as wt,aa as St,I as Rt}from"./vendor-mui-core-CCMNKHtm.js";import{x as Y,w as At,y as It,H as ue,C as Pt,n as Ee,b as Et}from"./vendor-utils-5TjOM6td.js";import{r as A,g as kt}from"./vendor-react-D-afvo_7.js";import{d as Tt}from"./Add-B2yJ7-eq.js";import{b as Lt}from"./base32-Bxy_Ng3r.js";import{ah as _t,ai as Oe,y as F,B as We,h as ke,aj as He,R as qt,ak as Ft,ag as Ve,b as $t,G as Te,al as Bt,L as Mt,I as zt,am as Ut,an as Nt,f as Le}from"./index-PxlbAHCL.js";import{d as Ot}from"./LockIcon-BITD3hjp.js";import{s as Wt,u as V,o as Ht,n as Vt,w as Yt}from"./vendor-hooks-BKxTDk_P.js";import{d as Gt}from"./CheckCircle-BFXaMcKG.js";import{d as Kt,p as _e}from"./util-BnCdSUGw.js";import{_ as K}from"./useSetState-Crt4S51m.js";import{w as Ye}from"./permission-BkijBCin.js";import{_ as Qt,D as qe}from"./useAsyncRetry-EMRT9Ldq.js";import{C as Q}from"./confirm-Cbx82b25.js";import{d as Xt}from"./InfoOutlined-CNFvZjEE.js";import{_ as Zt}from"./useAsync-Ua5iss51.js";import"./api-K65cLqol.js";import{I as Jt}from"./index-Bw3pdP7q.js";import{A as en}from"./actions-B31e80dT.js";var me={},tn=le;Object.defineProperty(me,"__esModule",{value:!0});var Ge=me.default=void 0,nn=tn(ae()),sn=e;Ge=me.default=(0,nn.default)((0,sn.jsx)("path",{d:"m12 8-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"}),"ExpandLess");const on=$e({});on.interceptors.request.use(n=>{const t=window.blocklet?window.blocklet.prefix:"/";return n.baseURL=t||"",n.url=Y("/api",String(n.url)),n.timeout=2e5,n.params=n.params||{},new URLSearchParams(n.url.split("?")[1]).has("locale")||(n.params.locale=ut()),n},n=>Promise.reject(n));const Ke=(...n)=>$e(...n),rn=(n,t)=>t?n?[n,...Array.isArray(t)?t:[t]]:t:n,an=(n,{width:t=600,height:o=700,name:i="did-domain:popup"}={})=>{const a=window.screenX+(window.innerWidth-t)/2,r=window.screenY+(window.innerHeight-o)/2,l=[`left=${a}`,`top=${r}`,`width=${t}`,`height=${o}`,"resizable=no","scrollbars=yes","status=yes","popup=yes"],c=window.open("",i,l.join(","));if(c===null)throw new Error("Failed to open popup");return c.location.href=At(n,{opener:window.location.origin}),c},ln="z2qaGosS3rZ7m5ttP3Nd4V4qczR9TryTcRV4p",Qe=async n=>{var d;if(!n||!(n!=null&&n.trim()))return null;const t=Ke(),o=new URL(n);o.pathname="__blocklet__.js",o.searchParams.set("type","json");const{data:i}=await t.get(o.toString()),a=(d=i==null?void 0:i.componentMountPoints)==null?void 0:d.find(h=>h.did===ln),r=new URL(n);r.pathname=a==null?void 0:a.mountPoint;const l=r.toString(),c=Y(l,"/api");return{base:l,api:c}},cn=Be({buy:{button:{title:"Buy DID Domain"},status:{inProgress:"Please wait while we are processing your request, the domain will be automatically resolved to the current app after the purchase...",success:"Purchase completed!"},error:{failedToCreateSession:"Failed to create session"}}}),dn=Be({buy:{button:{title:"购买 DID 域名"},status:{inProgress:"请稍等,我们正在处理您的请求,购买域名后会自动解析到当前的应用...",success:"购买完成!"},error:{failedToCreateSession:"创建会话失败"}}}),un={zh:dn,en:cn};function Xe({delegatee:n,delegateePk:t,didDomainURL:o,locale:i,title:a,onSuccess:r,...l}){const{t:c}=k(),[d,h]=Wt({currentState:1}),f=A.useRef(null),C=V(x=>{var m,v,I,j;x.data.type==="didDomain.success"&&(r==null||r({nftDid:(m=x.data)==null?void 0:m.nftDid,domain:(v=x.data)==null?void 0:v.domain,chainHost:(I=x.data)==null?void 0:I.chainHost}),(j=f.current)==null||j.close(),f.current=null,h({currentState:4}),setTimeout(()=>{h({currentState:8})},2e3))});Ht(()=>{var x;try{window.removeEventListener("message",C),(x=f.current)==null||x.close(),f.current=null}catch(m){console.warn("Failed to close popup",m)}});const S=V(()=>{h({currentState:1})}),g=V(()=>{h({currentState:2}),P.run()}),y=V(({sessionId:x,baseURL:m})=>{window.addEventListener("message",C);const v=new URL(m);v.searchParams.set("sessionId",x),v.searchParams.set("locale",i),f.current=an(v.toString());const I=setInterval(()=>{var j;(j=f.current)!=null&&j.closed&&(clearInterval(I),S())},1e3);return()=>clearInterval(I)}),P=Vt(async()=>{const x=await Qe(o);if(!x)return null;const m=Ke({baseURL:x.api}),{data:v}=await m.post("/payment/session",{delegatee:n,delegateePk:t});return y({sessionId:v.sessionId,baseURL:x.base})},{manual:!0,debounceWait:500,debounceLeading:!0,debounceTrailing:!1,debounceMaxWait:3e3,refreshDeps:[],onError(x){console.error(x)}});return e.jsxs(e.Fragment,{children:[e.jsx(W,{onClick:g,variant:"contained",startIcon:e.jsx(Kt,{}),...l,children:a||c("buy.button.title")}),e.jsxs(pt,{fullWidth:!0,maxWidth:"xs",open:d.currentState>1&&d.currentState<8,onClose:S,children:[!P.error&&e.jsxs(p,{sx:{display:"flex",alignItems:"center",flexDirection:"column",gap:2},children:[d.currentState===2&&e.jsx(z,{size:50}),d.currentState===4&&e.jsx(Gt,{sx:{color:"primary.main",fontSize:"5rem"}}),d.currentState===2&&e.jsx(q,{children:c("buy.status.inProgress")}),d.currentState===4&&e.jsx(q,{children:c("buy.status.success")})]}),P.error&&e.jsx(ce,{severity:"error",children:c("buy.error.failedToCreateSession")})]})]})}const Ze={onSuccess:()=>{},title:""};Xe.defaultProps=Ze;function Je(n){return e.jsx(mt,{locale:n.locale,translations:un,children:e.jsx(Xe,{...n})})}Je.defaultProps=Ze;function et({nftDid:n,didDomainURL:t,locale:o,sx:i}){const{t:a}=k(),[r,l]=K({safeIframeRef:null,popoverAnchorEl:null}),c=A.useRef(null),d=G(),h=de(d.breakpoints.down("md")),f=y=>{l({popoverAnchorEl:y.currentTarget})},C=()=>{l({popoverAnchorEl:null})},S=Yt(async()=>{const y=await Qe(t);return y?y.base:null});if(!S.value)return null;if(S.loading)return e.jsx(z,{});const g=Y(S.value,`/embed/domain?nft-did=${n}&locale=${o}`);return e.jsxs(e.Fragment,{children:[e.jsx(p,{component:"img",src:Y(t,"/.well-known/service/blocklet/logo"),alt:"logo",width:16,height:16,onClick:f,sx:rn({cursor:"pointer"},i)}),e.jsx(Ue,{id:"popover-info",open:!!r.popoverAnchorEl,anchorEl:r.popoverAnchorEl,onClose:C,anchorOrigin:{vertical:"bottom",horizontal:"right"},children:e.jsx("iframe",{ref:c,title:a("common.subscription"),width:h?"320px":"400px",height:h?"600px":"680px",style:{border:0},src:g})})]})}et.defaultProps={sx:{}};const mn=n=>["waiting","creating","renewaling"].includes(n);function pe(n){var w,R;const{t}=k(),[o,i]=A.useState(!1),{inService:a}=F(),[r,l]=A.useState(null),{siteId:c,domain:d,onAdd:h,children:f,did:C}=n,[S,g]=A.useState(!1),{api:y,ws:{useSubscription:P}}=F(),{mode:x,actions:{refreshDomainStatus:m}}=We(),v=Qt(async()=>{const{cert:b}=await y.findCertificateByDomain({input:{domain:d,did:C}});return b}),I=(b,U)=>{b.domain===d&&(g(!1),i(!1),a&&x!=="setup"&&(U==="success"?O.success(t("setup.domain.genCertSuccess",{domain:b.domain})):U==="error"&&O.error(t("setup.domain.genCertFailed",{domain:b.domain,message:b.message}))))};if(A.useEffect(()=>{var b;v.loading||g(mn((b=v.value)==null?void 0:b.status))},[v.loading,(w=v.value)==null?void 0:w.status]),P(ke.BlockletEvents.certError,b=>I(b,"error")),P(ke.BlockletEvents.certIssued,b=>{v.retry(),m(b.domain),I(b,"success")}),v.loading||((R=v.value)==null?void 0:R.status)==="normal")return"";const j=()=>{i(!1),l(null)},T=async()=>{i(!0);try{await y.issueLetsEncryptCert({input:{siteId:c,domain:d,did:C,inBlockletSetup:x==="setup"}}),h(),g(!0)}catch(b){console.error(b),g(!1)}finally{i(!1),l(null)}},u={title:t("router.cert.genLetsEncryptCert.title"),description:e.jsxs("div",{children:[e.jsx(ce,{severity:"success",children:t("router.cert.genLetsEncryptCert.dnsTip")}),t("router.cert.genLetsEncryptCert.description")]}),confirm:t("common.confirm"),onConfirm:T,onCancel:j},L=b=>{b.stopPropagation(),l(u)};return e.jsxs(e.Fragment,{children:[S?e.jsx(M,{title:t("router.cert.issuing"),children:e.jsx(z,{size:12})}):f({loading:o,open:L}),r&&e.jsx(Q,{color:"primary",title:r.title,description:r.description,confirm:r.confirm,params:r.params,onConfirm:r.onConfirm,onCancel:r.onCancel})]})}pe.propTypes={domain:s.string.isRequired,did:s.string.isRequired,siteId:s.string.isRequired,onAdd:s.func,children:s.any};pe.defaultProps={onAdd:()=>{},children:null};function fe(n){const{domain:t,domainStatus:o,...i}=n;return _t(t)||!Oe(t)||It(o)||o!=null&&o.isHttps?"":e.jsx(pe,{domain:t,...i})}fe.propTypes={domain:s.string.isRequired,domainStatus:s.shape({isHttps:s.bool}).isRequired,did:s.string.isRequired,onAdd:s.func,children:s.any};fe.defaultProps={onAdd:()=>{},children:null};var he={},pn=le;Object.defineProperty(he,"__esModule",{value:!0});var tt=he.default=void 0,fn=pn(ae()),hn=e;tt=he.default=(0,fn.default)((0,hn.jsx)("path",{d:"M17 20.41 18.41 19 15 15.59 13.59 17zM7.5 8H11v5.59L5.59 19 7 20.41l6-6V8h3.5L12 3.5z"}),"CallMerge");const nt=A.createContext({}),{Provider:xn,Consumer:es}=nt;function gn({children:n}){const[t,o]=K({domain:"",error:null}),{locale:i}=k(),a={error:t.error,domain:t.domain,setError:r=>{o({error:r})},setDomain:r=>{const l=ue(r),c=He(l,i);o({domain:l,error:c})}};return e.jsx(xn,{value:{value:a},children:n})}function Dn(){const{value:n}=A.useContext(nt);return n}const{joinURL:Fe}=qt,yn=Ft,st="z2qaGosS3rZ7m5ttP3Nd4V4qczR9TryTcRV4p",jn=async n=>{var c;if(!n||!(n!=null&&n.trim()))return null;const t=new URL(n);t.pathname="__blocklet__.js",t.searchParams.set("type","json");const{data:o}=await yn.get(t.toString()),i=(c=o==null?void 0:o.componentMountPoints)==null?void 0:c.find(d=>d.did===st),a=new URL(n);a.pathname=i==null?void 0:i.mountPoint;const r=a.toString(),l=Fe(r,"/api");return{base:r,api:l,domain:Fe(l,"/domains")}};var vn={DID_DOMAIN_SERVICE_DID:st,getDidDomainServiceURL:jn},X={exports:{}};const bn=ft,Cn=["Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Network request failed"];class ot extends Error{constructor(t){super(),t instanceof Error?(this.originalError=t,{message:t}=t):(this.originalError=new Error(t),this.originalError.stack=this.stack),this.name="AbortError",this.message=t}}const wn=(n,t,o)=>{const i=o.retries-(t-1);return n.attemptNumber=t,n.retriesLeft=i,n},Sn=n=>Cn.includes(n),it=(n,t)=>new Promise((o,i)=>{t={onFailedAttempt:()=>{},retries:10,...t};const a=bn.operation(t);a.attempt(async r=>{try{o(await n(r))}catch(l){if(!(l instanceof Error)){i(new TypeError(`Non-error was thrown: "${l}". You should only throw errors.`));return}if(l instanceof ot)a.stop(),i(l.originalError);else if(l instanceof TypeError&&!Sn(l.message))a.stop(),i(l);else{wn(l,r,t);try{await t.onFailedAttempt(l)}catch(c){i(c);return}a.retry(l)||i(a.mainError())}}})});X.exports=it;X.exports.default=it;X.exports.AbortError=ot;var Rn=X.exports;const An=kt(Rn);function xe({domain:n,resolvedTarget:t,...o}){const{t:i,locale:a}=k();return e.jsxs(p,{sx:{backgroundColor:"rgb(236, 251, 253)",borderColor:"rgb(236, 251, 253)",borderRadius:"8px",padding:"12px"},...o,children:[e.jsxs(p,{display:"flex",children:[i("router.domain.setup.tipStart"),n&&e.jsx(p,{mx:.5,color:"primary.main",fontWeight:"fontWeightBold",children:n}),i("router.domain.setup.tipEnd"),":"]}),e.jsxs(p,{sx:{"&>div":{mb:0},marginTop:"8px"},children:[e.jsx(se,{label:i("router.domain.setup.recordType"),value:"CNAME",locale:a}),e.jsx(se,{label:i("router.domain.setup.recordValue"),value:t,locale:a})]})]})}xe.propTypes={domain:s.string,resolvedTarget:s.string.isRequired};xe.defaultProps={domain:""};function se({locale:n,label:t,value:o}){const i=de(r=>r.breakpoints.down("md")),a=G();return e.jsx(Jt,{name:t,nameWidth:120,children:e.jsxs(p,{sx:{display:"flex",alignItems:"center",lineHeight:1},children:[e.jsx(q,{component:"span",color:"primary.main",overflow:"auto",sx:i?{maxWidth:"95%",wordWrap:"break-word"}:{wordWrap:"break-word"},children:o}),e.jsx(Me,{content:o,locale:n,style:{marginLeft:"4px",color:a.palette.text.secondary}})]})})}se.propTypes={locale:s.string.isRequired,label:s.string.isRequired,value:s.string.isRequired};function ge({siteId:n,teamDid:t,cnameDomain:o,defaultCustomDomain:i,onInputDomain:a,appId:r,appPk:l,onSuccess:c,onError:d,disabled:h,autoFocus:f,inBlockletSetup:C,shouldCheckDomain:S,onStateChange:g,currentIp:y,resolveDomain:P,...x}){const{t:m,locale:v}=k(),{api:I,info:j}=F(),T=Dn(),u=G(),L=ht({key:"sm"}),[w,R]=K({submittingDomain:!1,domain:i,error:null,type:j!=null&&j.nftDomainUrl?"nftDomain":"inputDomain",showNFTDomainAuth:!1,showDnsTip:!1}),b=Zt(()=>vn.getDidDomainServiceURL(j==null?void 0:j.nftDomainUrl));if(j!=null&&j.nftDomainUrl&&b.loading)return e.jsx(p,{...x,children:e.jsx(Pe,{relative:"parent",children:e.jsx(z,{})})});if(b.error)return e.jsx(p,{...x,children:e.jsx(Pe,{relative:"parent",children:b.error.message})});const U=b.value,at=()=>{R({invalidDNSDomain:null})},ee=async D=>{g(m("setup.domain.addingDomain")),await I.addDomainAlias({input:{id:n,domainAlias:D,teamDid:t,inBlockletSetup:!0}}),R({submittingDomain:!1}),c({domain:D,type:"inputDomain"})},Se=async({domain:D,type:E,nftDid:N,chainHost:_})=>{try{if(!S){if(E==="inputDomain"){await ee(D);return}c({domain:D,type:E,nftDid:N,chainHost:_});return}g({text:m("setup.domain.checkingResolvable")});let $=30;const te=3e3,dt=$*1e3/te,Ae=setInterval(()=>{if($<=0){clearInterval(Ae);return}g({text:`${m("setup.domain.checkingResolvable")} (${$--}s)`})},1e3),Ie=await An(async()=>{const{data:B}=await P(D);if(!B.address)throw new Error("Cannot resolve domain");return B.address},{retries:dt,minTimeout:te,maxTimeout:te,onFailedAttempt:console.error}).catch(console.error);if(clearInterval(Ae),!Ie){const B=m("setup.domain.cannotResolve",{domain:D});if(E==="nftDomain"){O.error(B),c({domain:D,type:"nftDomain"});return}g({text:""}),R({invalidDNSDomain:{domain:D,error:B},domain:D,type:E,submittingDomain:!1});return}if(Ie!==y){const B=m("setup.domain.resolvedAddressError",{domain:D,curDomain:window.location.hostname});if(E==="nftDomain"){O.error(B),c({domain:D,type:"nftDomain"});return}g({text:""}),R({invalidDNSDomain:{domain:D,error:B},domain:D,type:E,submittingDomain:!1});return}if(E==="nftDomain"){c({domain:D,type:"nftDomain"});return}await ee(D)}catch($){O.error($.message),g({text:""}),R({submittingDomain:!1})}},lt=async({domain:D,nftDid:E,chainHost:N})=>{try{const _=_e(D);R({submittingDomain:!0}),await I.addDomainAlias({input:{id:n,type:"nft-domain",domainAlias:_,nftDid:E,chainHost:N,teamDid:t,inBlockletSetup:C}});const $="nftDomain";R({showNFTDomainAuth:!1,type:$}),await Se({domain:_,type:$,nftDid:E,chainHost:N})}catch(_){O.error(_.message)}finally{R({showNFTDomainAuth:!1,submittingDomain:!1})}},ct=async()=>{try{R({submittingDomain:!0});const D=_e(w.domain);if(j.nftDomainUrl&&U&&(await I.isDidDomain({input:{domain:D}})).value===!0){R({showNFTDomainAuth:!0});return}await Se({domain:D,type:w.type})}catch(D){R({submittingDomain:!1}),T.setError(D.message)}},Re=T.error||w.error;return e.jsx(p,{...x,children:e.jsxs(p,{sx:{display:"flex",flexDirection:"column",justifyContent:"flex-start",gap:"1em"},children:[e.jsxs(p,{sx:{display:"flex",flexDirection:"column",gap:"8px"},children:[e.jsx(q,{sx:{color:u.palette.text.primary},children:m("router.domainAlias.add.tips")}),e.jsx(yt,{sx:{display:"block",marginTop:"8px"},label:m("router.domainAlias.add.domainDescription"),helperText:w.type==="inputDomain"&&Re||m("router.domainAlias.add.helperText"),inputProps:{"data-cy":"domain-name-input"},fullWidth:!0,disabled:h,value:w.domain,size:"small",variant:"outlined",error:!!Re&&w.type==="inputDomain",onChange:D=>{var _;const E=ue((_=D.target)==null?void 0:_.value);T.setDomain(E);const N=He(E,v);R({domain:E,error:N,type:"inputDomain"}),a({domain:E,error:N,type:"inputDomain"})},autoFocus:f,onBlur:()=>{T.domain||(R({error:null}),T.setError(null))}}),e.jsx(p,{sx:{width:"100%",display:"flex",justifyContent:"flex-end"},children:e.jsx(jt,{"data-cy":"confirm-add-domain",fullWidth:L,variant:"contained",loading:w.submittingDomain,onClick:ct,children:m("common.add")})}),e.jsxs(p,{sx:{cursor:"pointer",fontSize:"14px",display:"flex",alignItems:"center",gap:"4px",lineHeight:1,color:u.palette.primary.main},onClick:()=>R({showDnsTip:!w.showDnsTip}),children:[e.jsx(Xt,{fontSize:"1em"}),m("router.domainAlias.showTipHint")]}),w.showDnsTip&&e.jsx(xe,{domain:w.domain,resolvedTarget:o,style:{marginTop:"4px"}})]}),w.invalidDNSDomain&&e.jsx(Q,{title:m("common.reminder"),description:m("setup.domain.invalidDNSReminder",{error:w.invalidDNSDomain.error}),color:"primary",confirm:m("setup.domain.continueAdd"),onConfirm:()=>ee(w.invalidDNSDomain.domain,w.type),onCancel:at}),U&&e.jsx(xt,{open:w.showNFTDomainAuth,popup:!0,useSocket:!1,forceConnected:!1,action:"authorize",baseUrl:U.api,checkFn:Pt.create({baseURL:U.api}).get,extraParams:{delegatee:r,delegateePk:l,domain:w.domain},onSuccess:lt,onClose:()=>R({showNFTDomainAuth:!1,submittingDomain:!1}),checkTimeout:60*5e3,showDownload:!1,messages:{title:m("router.domainAlias.addDomainNFT.connect.title"),scan:m("router.domainAlias.addDomainNFT.connect.scan"),confirm:m("router.domainAlias.addDomainNFT.connect.confirm"),success:m("router.domainAlias.addDomainNFT.connect.success")}})]})})}ge.propTypes={siteId:s.string.isRequired,currentIp:s.string,teamDid:s.string.isRequired,cnameDomain:s.string.isRequired,defaultCustomDomain:s.string,onInputDomain:s.func,onSuccess:s.func,appId:s.string,appPk:s.string,disabled:s.bool,autoFocus:s.bool,inBlockletSetup:s.bool,shouldCheckDomain:s.bool,onStateChange:s.func,resolveDomain:s.func,onError:s.func};ge.defaultProps={defaultCustomDomain:"",currentIp:"",onInputDomain:Ee,onSuccess:Ee,appId:"",appPk:"",disabled:!1,autoFocus:!0,inBlockletSetup:!1,shouldCheckDomain:!1,onStateChange:()=>{},resolveDomain:()=>{},onError:()=>{}};function De({id:n,children:t,title:o,teamDid:i,systemDomains:a,appId:r,appPk:l}){const{t:c}=k(),[d,h]=K({loading:!1,confirmSetting:null}),f=a.find(y=>Ve.isDidDomain(y)),C=()=>{h({loading:!1,confirmSetting:null})},S={title:o||c("router.domainAlias.add.title"),description:function(P,x,m){return e.jsx(ge,{siteId:n,teamDid:i,cnameDomain:f,onSuccess:()=>h({confirmSetting:null}),onInputDomain:({domain:v,type:I,error:j})=>{x({...P,domain:v,type:I,__disableConfirm:!!j}),m(j)},appId:r,appPk:l})},confirm:c("common.confirm"),cancel:c("common.cancel"),params:{domain:"",__disableConfirm:!0},onCancel:C},g=y=>{y.stopPropagation(),h({confirmSetting:S})};return e.jsxs(e.Fragment,{children:[typeof t=="function"?t({loading:d.loading,open:g}):e.jsxs(Ne,{onClick:g,className:"rule-action","data-cy":"action-add-domain-alias",children:[d.loading?e.jsx(z,{size:16}):e.jsx(tt,{style:{fontSize:18,marginRight:5}}),c("router.domainAlias.add.title")]}),d.confirmSetting&&e.jsx(Q,{title:d.confirmSetting.title,description:d.confirmSetting.description,confirm:d.confirmSetting.confirm,cancel:d.confirmSetting.cancel,params:d.confirmSetting.params,onCancel:d.confirmSetting.onCancel,showConfirm:!1,showCancel:!0,displayError:!1,color:"primary",loading:d.loading,maxWidth:"sm"})]})}De.propTypes={id:s.string.isRequired,children:s.any,title:s.string,teamDid:s.string,systemDomains:s.arrayOf(s.string).isRequired,appId:s.string,appPk:s.string.isRequired};De.defaultProps={children:null,title:"",teamDid:"",appId:null};function In(n){return e.jsx(gn,{children:e.jsx(De,{...n})})}function ye({appId:n,appPk:t,siteId:o,inBlockletSetup:i,teamDid:a,sx:r,...l}){const{api:c,info:d}=F(),{locale:h,t:f}=k(),C=async({domain:S,nftDid:g,chainHost:y})=>{await c.addDomainAlias({input:{id:o,type:"nft-domain",domainAlias:S,nftDid:g,chainHost:y,teamDid:a,inBlockletSetup:i}})};return e.jsx(Je,{delegatee:n,delegateePk:t,didDomainURL:d.nftDomainUrl,onSuccess:C,locale:h,variant:"outlined",sx:r,title:f("router.domainAlias.addDomainNFT.buy"),...l})}ye.propTypes={appId:s.string.isRequired,appPk:s.string.isRequired,siteId:s.string.isRequired,inBlockletSetup:s.bool.isRequired,teamDid:s.string.isRequired,sx:s.object};ye.defaultProps={sx:{}};function je(n){const{t}=k(),[o,i]=A.useState(!1),[a,r]=A.useState(null),{id:l,domain:c,children:d,teamDid:h}=n,{api:f}=F(),C=()=>{i(!1),r(null)},S=async()=>{i(!0);try{await f.deleteDomainAlias({input:{id:l,domainAlias:c,teamDid:h}}),await $t(2e3)}catch(P){O.error(P.message)}finally{r(null),i(!1)}},g={title:t("router.domainAlias.delete.title"),description:t("router.domainAlias.delete.description"),confirm:t("common.confirm"),onConfirm:S,onCancel:C},y=P=>{P.stopPropagation(),r(g)};return e.jsxs(e.Fragment,{children:[typeof d=="function"?d({loading:o,open:y}):e.jsxs(W,{edge:"end",onClick:y,size:"small",className:"rule-action",color:"error","data-cy":"action-delete-domain-alias",children:[o?e.jsx(z,{size:16}):e.jsx(ze,{style:{fontSize:16}}),t("router.domainAlias.delete.title")]}),a&&e.jsx(Q,{title:a.title,description:a.description,confirm:a.confirm,params:a.params,onConfirm:a.onConfirm,onCancel:a.onCancel})]})}je.propTypes={id:s.string.isRequired,domain:s.string.isRequired,children:s.any,teamDid:s.string};je.defaultProps={children:null,teamDid:""};function ve({site:n,domain:t,blocklet:o}){const{t:i}=k(),a=t.value===window.location.hostname;return e.jsx(en,{"data-cy":"domain-actions",size:"large",actions:[({close:r})=>{var l;return e.jsx(je,{id:n.id,domain:t.value,teamDid:(l=o==null?void 0:o.meta)==null?void 0:l.did,children:({open:c})=>e.jsx(M,{title:a?i("blocklet.router.currentDomainTip"):"",children:e.jsx("span",{children:e.jsxs(Ne,{disabled:t.isProtected||a,dense:!0,onClick:d=>{r(),c(d)},"data-cy":"action-toggle-block",children:[e.jsx(vt,{style:{minWidth:24,marginRight:8},children:e.jsx(ze,{})}),e.jsx(bt,{primary:i("common.delete")})]},"remove")})})})}]})}ve.propTypes={site:s.object.isRequired,domain:s.object.isRequired,blocklet:s.object.isRequired};ve.defaultProps={};var be={},Pn=le;Object.defineProperty(be,"__esModule",{value:!0});var Ce=be.default=void 0,En=Pn(ae()),kn=e;Ce=be.default=(0,En.default)((0,kn.jsx)("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2m-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2m3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1z"}),"Https");const Z=s.shape({href:s.string,accessibility:s.shape({loading:s.bool,accessible:s.bool}),domainStatus:s.shape({isHttps:s.bool,matchedCert:s.object}),dns:s.shape({resolved:s.bool,ip:s.string})});function we({certificate:n}){const[t,o]=A.useState(null),i=F(),{t:a,locale:r}=k(),l=h=>{o(h.currentTarget)},c=()=>{o(null)},d=!!t;return e.jsxs(e.Fragment,{children:[e.jsx(Ce,{"aria-owns":d?"mouse-over-popover":void 0,onMouseEnter:l,onMouseLeave:c,style:{color:"#44cdc6",fontSize:20,cursor:"pointer"}}),e.jsx(Ue,{id:"mouse-over-popover",style:{pointerEvents:"none"},open:d,anchorEl:t,anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},onClose:c,disableRestoreFocus:!0,children:e.jsx(Ct,{children:e.jsxs(wt,{style:{display:"flex"},children:[e.jsx("div",{children:e.jsx("img",{src:`${i.imgPrefix}/https-certificate-icon.png`,alt:"certificate icon",style:{maxHeight:"100%",maxWidth:"100%"}})}),e.jsxs(q,{component:"div",style:{marginLeft:"16px"},children:[e.jsx(q,{component:"div",style:{fontWeight:"bold"},children:n.domain}),e.jsx(q,{component:"div",children:`${a("common.issuer")}: ${Et(n,"issuer.commonName","")}`}),e.jsx(q,{component:"div",children:`${a("router.cert.issuedOn")}: ${Te(n.validFrom,r)}`}),e.jsx(q,{component:"div",children:`${a("router.cert.expiryOn")}: ${Te(n.validTo,r)}`})]})]})})})]})}we.propTypes={certificate:s.object};we.defaultProps={certificate:{}};function H({domain:n,filters:t}){const{t:o}=k(),{value:i,domainStatus:a}=n;if(!Oe(i))return null;let r=null,l=null;const{isHttps:c,matchedCert:d}=a;if(!Bt(i)){const{dns:{resolved:f,ip:C}={}}=a;f||C==="127.0.0.1"?r=e.jsx(M,{title:o("router.domain.verify.ok"),children:e.jsx(qe,{color:"success"})}):r=e.jsx(M,{title:o("router.domain.verify.notResolved"),children:e.jsx(qe,{color:"error"})})}c?l=e.jsx(we,{certificate:d}):l=e.jsx(M,{title:o("router.domain.https.bad"),children:e.jsx(Ce,{style:{color:"#D0021B",fontSize:20,cursor:"pointer"}})});const h=t.map(f=>f==="domain"?r:f==="http"?l:null);return A.createElement(A.Fragment,null,...h)}H.propTypes={domain:Z.isRequired,filters:s.array};H.defaultProps={filters:["domain","http"]};const Tn=Ye(J,"mutate_blocklets"),Ln=Ye(J,"",Mt);function rt(n){const{inService:t}=F(),{blocklet:o,loadingRuntimeInfo:i}=We();let a=Tn;return t&&(a=Ln),e.jsx(a,{...n,blocklet:o,inService:t,loadingRuntimeInfo:i})}rt.propTypes={listOnly:s.bool};rt.defaultProps={listOnly:!1};function J({hasPermission:n,blocklet:t,loadingRuntimeInfo:o,inService:i,listOnly:a}){var v,I,j,T;const{t:r}=k(),{info:l}=F(),[c,d]=A.useState(!1),h=de(u=>u.breakpoints.down("md")),f=A.useMemo(()=>{let u=n;return zt(t)&&(u=u&&i),u},[n,i,t]),{site:C}=t,S=A.useMemo(()=>{var u;return Ut((u=t.site)==null?void 0:u.domainAliases)},[(v=t.site)==null?void 0:v.domainAliases]),g=[],y=[],P=Lt.encode(t.appPid),x=(j=(I=t.environments)==null?void 0:I.find(u=>u.key==="BLOCKLET_APP_PK"))==null?void 0:j.value,m=Nt(S);return S.forEach(u=>{const L=u.value||"";Ve.isDidDomain(L)&&!L.startsWith(P)?y.push(u):g.push(u)}),e.jsxs(e.Fragment,{children:[!a&&e.jsxs(e.Fragment,{children:[e.jsxs(p,{className:"title first",display:"flex",justifyContent:"space-between",alignItems:"center",children:[e.jsx(p,{children:r("common.domain")}),f&&e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(In,{id:C.id,title:r("router.domain.add.title"),teamDid:(T=t.meta)==null?void 0:T.did,appId:t.appPid,appPk:x,systemDomains:m==null?void 0:m.map(u=>u.value),children:({open:u})=>e.jsxs(W,{style:{marginLeft:16},variant:"contained",color:"primary","data-cy":"add-domain-alias",onClick:u,disabled:Le.isInProgress(t.status),children:[e.jsx(Tt,{style:{fontSize:"1.3em",marginRight:4}}),r("common.add")]})}),l.nftDomainUrl&&e.jsx(ye,{variant:"outlined",appId:t.appPid,appPk:x,siteId:C.id,inBlockletSetup:!1,teamDid:t.meta.did})]})]}),Le.isAccessible(t.status)===!1&&e.jsx(p,{mt:1.5,mb:1.5,children:e.jsx(ce,{severity:"warning",children:r("blocklet.router.noRunning")})})]}),e.jsx(p,{sx:{display:"flex",flexDirection:"column",gap:1},children:(c?S:g).map(u=>{var w,R;const L=u.value;return e.jsxs(A.Fragment,{children:[h&&e.jsxs(p,{display:"flex",flexDirection:"column",children:[e.jsx(p,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:e.jsx(oe,{domain:u,target:"_blank",children:u.value})}),e.jsxs(p,{display:"flex",alignItems:"center",justifyContent:"space-between",children:[e.jsxs(p,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:1},children:[e.jsx(H,{domain:u,filters:["domain"]},`${u.value}-domain`),e.jsx(re,{siteId:(w=t.site)==null?void 0:w.id,domain:u,blocklet:t,hasMutatePermission:f})]}),e.jsx(p,{sx:{button:{padding:0}},children:e.jsx(ie,{hasMutatePermission:f,site:C,domain:u,blocklet:t})})]})]},L),!h&&e.jsxs(p,{display:"flex",alignItems:"center",justifyContent:"space-between",children:[e.jsxs(p,{display:"flex",alignItems:"center",justifyContent:"flex-start",children:[e.jsx(H,{domain:u,filters:["domain"]},`${u.value}-domain`),e.jsx(p,{sx:{ml:2,mr:.5},children:e.jsx(oe,{domain:u,target:"_blank",children:u.value})}),e.jsx(re,{siteId:(R=t.site)==null?void 0:R.id,domain:u,blocklet:t,hasMutatePermission:f})]}),e.jsx(p,{sx:{button:{padding:0}},children:e.jsx(ie,{hasMutatePermission:f,site:C,domain:u,blocklet:t})})]},L)]},L)})}),y.length>0&&e.jsx("div",{style:{marginLeft:"20px",marginTop:"12px"},children:e.jsx(W,{endIcon:c?e.jsx(Ge,{}):e.jsx(gt,{}),onClick:()=>d(!c),children:r(c?"common.collapseAll":"blocklet.router.showAllDomains")})}),!S.length&&(o?e.jsx(z,{size:16}):e.jsx(Dt,{children:r("common.empty")}))]})}J.propTypes={hasPermission:s.bool,blocklet:s.object.isRequired,loadingRuntimeInfo:s.bool,inService:s.bool.isRequired,listOnly:s.bool};J.defaultProps={hasPermission:!1,loadingRuntimeInfo:!1,listOnly:!1};function oe({domain:n,children:t,...o}){const{t:i,locale:a}=k(),{href:r,accessibility:l,value:c}=n,d=A.useCallback(()=>e.jsx(Me,{content:ue(c),locale:a,style:{marginLeft:"4px",color:"#999",fontSize:"0.8em",verticalAlign:"bottom"}}),[c,a]);return!l||l.loading?e.jsxs(ne,{...o,children:[t,d(),e.jsx(M,{title:i("blocklet.router.checkUrlAccessible"),placement:"top-end",children:e.jsx("span",{className:"status",children:e.jsx(z,{size:12})})})]}):l.accessible?e.jsxs(ne,{...o,children:[e.jsx(p,{component:"a",href:r,target:"_blank",rel:"noopener noreferrer",children:t}),d()]}):e.jsxs(ne,{...o,children:[e.jsx(M,{title:i("blocklet.router.urlInaccessible"),placement:"top-end",children:e.jsx("span",{children:t})}),d()]})}oe.propTypes={domain:Z.isRequired,children:s.any.isRequired};const ne=St.span`
|
|
2
|
-
&,
|
|
3
|
-
& > * {
|
|
4
|
-
color: #222;
|
|
5
|
-
font-size: 18px;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
& > * {
|
|
9
|
-
word-break: break-all;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.status {
|
|
13
|
-
margin-left: 8px;
|
|
14
|
-
}
|
|
15
|
-
`;function ie({hasMutatePermission:n,site:t,domain:o,blocklet:i}){const a=G(),{t:r}=k();return n&&!o.isProtected?e.jsx(ve,{site:t,domain:o,blocklet:i}):e.jsx(M,{title:r("blocklet.router.domainLockTooltip"),placement:"top",children:e.jsx(Rt,{disabled:!0,size:"large",style:{pointerEvents:"auto",paddingTop:0,paddingBottom:0},children:e.jsx(Ot,{style:{fill:a.palette.text.disabled}})})})}ie.propTypes={hasMutatePermission:s.bool.isRequired,site:s.object.isRequired,domain:Z.isRequired,blocklet:s.object.isRequired};function re({siteId:n,domain:t,blocklet:o,hasMutatePermission:i}){const{info:a}=F(),{t:r,locale:l}=k();return e.jsxs(p,{sx:{display:"flex",justifyContent:"flex-start",alignItems:"center",gap:1},children:[t.type==="nft-domain"&&e.jsx(et,{locale:l,nftDid:t.nftDid,didDomainURL:a.nftDomainUrl}),e.jsx(H,{domain:t,filters:["http"]},`${t.value}-http`),i&&e.jsx(fe,{siteId:n,domain:t.value,domainStatus:t.domainStatus,did:o.meta.did,children:({open:c})=>e.jsx(W,{sx:{padding:0},size:"small",onClick:d=>c(d),children:r("router.cert.genLetsEncryptCert.title")})})]})}re.propTypes={siteId:s.string.isRequired,domain:Z.isRequired,blocklet:s.object.isRequired,hasMutatePermission:s.bool.isRequired};export{ge as A,ye as B,gn as D,rt as a};
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import{r as m}from"./vendor-react-D-afvo_7.js";import{j as e,a1 as xe,E as x,a4 as Te,T as L,a3 as S,aa as ce,A as ue,a2 as ne,ah as De,aj as be,x as Se,R as Ae,V as Ee,bD as ke,cn as Le,cl as Ie,aN as Oe,bJ as Pe}from"./vendor-mui-core-CCMNKHtm.js";import{b as $,z as Fe,A as ze,ap as ae}from"./vendor-utils-5TjOM6td.js";import{b as W,j as V,_ as ye,ay as _,e as M,a5 as Be,bg as _e,B as Ke,aR as We,bv as qe}from"./vendor-arcblock-CVRRnBv2.js";import{y as Ue,E as K,m as $e,G as fe}from"./index-PxlbAHCL.js";import{b as re}from"./dashboard-uG_G13IR.js";import{d as Q}from"./vendor-hooks-BKxTDk_P.js";import{p as Me}from"./util-DowdN-NO.js";import{W as Ve}from"./did-address-DhC4Z1Ef.js";import{S as X}from"./shorten-label-CYJeMT7h.js";import{c as me}from"./index-DoZ2YM4T.js";import{a as He}from"./list-DrMoP89n.js";import{D as Ge,g as Je}from"./traffic-B70zlTcA.js";import{R as Qe}from"./relative-time-CQ0hJZC_.js";import{B as Xe}from"./bundle-avatar-BSrkMwWG.js";import{B as Ye}from"./index-2NCgoG1i.js";import"./useLocalStorage-CTToOZ4l.js";import"./confirm-Cbx82b25.js";import"./format-error-C0Ke3VXF.js";import"./PlayArrow-CauLC4o_.js";import"./get-safe-url-CJIsC1HE.js";import"./session-ClC5u_ou.js";import"./useAsyncRetry-EMRT9Ldq.js";import"./useAsync-Ua5iss51.js";import"./useSetState-Crt4S51m.js";import"./index-DE_r-gh_.js";import"./InfoOutlined-CNFvZjEE.js";import"./iframe-BYvZHXU-.js";import"./LaunchOutlined-BstP_JKj.js";import"./ChevronLeft-BXNAWRN5.js";import"./ChevronRight-bqoO4ITE.js";import"./index-D5mFr1eo.js";import"./vendor-mui-x-DmPVvZFJ.js";const je=m.createContext({}),{Provider:Ze,Consumer:ss}=je;function et({children:t,blocklet:o=""}){const{api:i,inService:u,ws:{useSubscription:d}}=Ue(),[c,p]=m.useState([]),[b,w]=m.useState({total:0,pageSize:20,pageCount:0,page:1}),[v,E]=m.useState(!1),T=Q(()=>{var R;return(R=o.meta)==null?void 0:R.did},[o]),[F,D]=m.useState({}),z=async({page:R=1,pageSize:h=20,...C}={})=>{if(!(v||!T))try{E(!0);const j={paging:{page:R,pageSize:h},...C,userName:C.searchText||"",teamDid:T,dateRange:C.dateRange?[K(C.dateRange[0]).toISOString(),K(C.dateRange[1]).toISOString()]:void 0},O=await i.getNotificationSendLog({input:j});D(j);const P=O.list.map(B=>({...B,receiverUser:{...B.receiverUser,avatar:Me(B.receiverUser.avatar,T,u)}}));p(P),w(O.paging),E(!1)}catch(j){V.error(j.message),E(!1)}},I=m.useCallback(R=>{const h=o.children.find(C=>{var j;return((j=C.meta)==null?void 0:j.did)===R});if(h)return h.ancestors=[o],h},[o]),f=async({notificationReceiverIds:R,channels:h,...C})=>{await i.resendNotification({input:{teamDid:T,notificationReceiverIds:R,channels:h.map(j=>j==="wallet"?"app":j==="pushKit"?"pushKit":j),...C}})},y=m.useCallback(async R=>(await i.getUser({input:{teamDid:T,user:{did:R}}})).user,[i,T]);d(`${W.EVENTS.NOTIFICATION_BLOCKLET_CREATE}`,R=>{R&&z(F)},[F]);const N={loading:v,fetch:z,data:c,paging:b,blocklet:o,getComponent:I,resendNotification:f,getUser:y};return e.jsx(Ze,{value:{notificationRecords:N},children:t})}function Re(){const{notificationRecords:t}=m.useContext(je);return t}var de={},tt=xe;Object.defineProperty(de,"__esModule",{value:!0});var we=de.default=void 0,st=tt(ye()),nt=e;we=de.default=(0,st.default)((0,nt.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12m8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8"}),"Block");var pe={},at=xe;Object.defineProperty(pe,"__esModule",{value:!0});var ve=pe.default=void 0,it=at(ye()),ot=e;ve=pe.default=(0,it.default)((0,ot.jsx)("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"CheckCircleOutline");const rt=(t,o,i="")=>{if(!i||!o)return"";switch(i){case W.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:o});case W.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:o});case W.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:o});case W.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return i}};function ee(t,o,i={}){const{status:u,updatedAt:d,reason:c="",channel:p="wallet"}=i,b=d?t("notification.sendStatus.sentTime",{date:$e(d,o)}):"",w=rt(t,p,c);return u===W.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:b,reason:w}:u===W.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:b}:{status:"unsent",title:t("notification.sendStatus.unsent"),reason:w,sentTime:b}}const he={unsent:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},le=["wallet","pushKit","email"],lt=(t,o)=>{var d,c;const{settings:i}=t,u=$(o,"extra.notifications.email",!0);return{available:(c=(d=i==null?void 0:i.notification)==null?void 0:d.email)==null?void 0:c.enabled,enabled:u}},ct=(t,o)=>{var d,c;const{settings:i}=t,u=$(o,"extra.notifications.push",!0);return{available:(c=(d=i==null?void 0:i.notification)==null?void 0:d.pushKit)==null?void 0:c.enabled,enabled:u}},ut=t=>({enabled:$(t,"extra.notifications.wallet",!0)}),dt=t=>({enabled:$(t,"extra.webhooks",[]).length>0}),ge=(t=3e3)=>new Promise(o=>{setTimeout(()=>{o()},t)}),pt=(t,o)=>o==="wallet"||o==="webhook"?[{channel:o,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:o}),fail:t("notification.sendStatus.reason.disabled",{channel:o})}]:o==="pushKit"||o==="email"?[{channel:o,type:"available",pass:t("notification.sendStatus.reason.available",{channel:o}),fail:t("notification.sendStatus.reason.unavailable",{channel:o})},{channel:o,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:o}),fail:t("notification.sendStatus.reason.disabled",{channel:o})}]:[],ft=t=>{const o={},i=K().startOf("day");le.forEach(c=>{const p=`${c}SendRecord`,w=$(t,p,[]).filter(v=>K(v.sendAt).isSame(i,"day")).length;o[c]=w});const u=$(t,"webhook",{}),d=Object.keys(u??{})??[];return d.length>0&&d.forEach(c=>{const b=(u[c]??[]).filter(w=>K(w.sendAt).isSame(i,"day")).length;o[c]=b}),o};function q({config:t,enableTooltip:o=!0}){const{status:i,title:u="",sentTime:d="",reason:c=""}=t,p=[u,c].filter(Boolean).join(", ");return e.jsx(Te,{title:o?e.jsxs(e.Fragment,{children:[e.jsx(L,{color:"inherit",sx:{fontSize:12},children:p}),e.jsx("span",{children:d})]}):null,arrow:!0,placement:"top",children:e.jsxs(S,{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center",children:[e.jsx(S,{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:he[i],style:{opacity:.15}}),e.jsx(S,{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:he[i]})]})})}q.propTypes={config:x.object.isRequired,enableTooltip:x.bool};q.defaultProps={enableTooltip:!0};Ce.propTypes={notification:x.object.isRequired,onCancel:x.func,blocklet:x.object.isRequired,resendChannel:x.array,refresh:x.func};function Ce({notification:t,onCancel:o=()=>{},blocklet:i,resendChannel:u="",refresh:d=()=>{}}){const{t:c,locale:p}=M(),{getComponent:b,resendNotification:w,getUser:v}=Re(),[E,T]=m.useState([]),[F,D]=m.useState([]),[z,I]=m.useState(null),[f,y]=m.useState(null),N=m.useRef({}),R=Q(()=>b(t.componentId)||i,[i,t.componentId]),h=Q(()=>{var r;return(r=t==null?void 0:t.receivers)==null?void 0:r[0]},[t.receivers]),C=Q(()=>ft(h),[h]),j=m.useCallback(async r=>{const{receiver:s}=h??{};if(!s)return!1;const n=await v(s);return n?r==="wallet"?ut(n):r==="email"?lt(i,n):r==="pushKit"?ct(i,n):r==="webhook"?dt(n):!0:!1},[h,v,i]);m.useEffect(()=>{if(!h)T([]);else{const r=le.map(n=>{const a=h[`${n}SendStatus`],l=h[`${n}SendAt`],g=h[`${n}SendFailedReason`],A=ee(c,p,{status:a,updatedAt:l,reason:g,channel:n});return{type:n,extra:A}});T(r);const s=(h==null?void 0:h.webhook)||{};D(Object.entries(s))}},[h,p,c]);const O=m.useCallback(async(r,s="")=>{const{id:n}=h??{};if(n)try{await w({notificationReceiverIds:[n],channels:[r],...r==="webhook"&&s?{webhookUrls:[s]}:{}}),V.success("Message has been sent!"),r!=="webhook"&&(await ge(1e3),I(null))}catch(a){console.error("handleResend error",{error:a}),V.error(a.response?a.response.statusText:a.message)}},[w,h]),P=async(r,s)=>{if(s==null||s.stopPropagation(),C[r.type]>=4){V.warning(c("notification.resendLimit"));return}if(s&&I(s==null?void 0:s.currentTarget),y({channel:r.type}),!(!r||r.checking)){T(a=>a.map(l=>r.type===l.type?{...l,checking:!0}:l));try{const a=await j(r.type);await ge(),y({channel:r.type,result:a}),(typeof a=="boolean"&&a||Fe(a)&&Object.values(a).every(l=>!!l))&&(await O(r.type),d()),T(l=>l.map(g=>r.type===g.type?{...g,checking:!1}:g))}catch(a){console.error("handleResend error",{error:a})}}},B=async(r,s=null)=>{if(s==null||s.stopPropagation(),C[r]>=4){V.warning(c("notification.resendLimit"));return}D(a=>a.map(l=>r===l[0]?[...l.slice(0,2),!0]:l));try{await O("webhook",r),D(a=>a.map(l=>r===l[0]?[...l.slice(0,2),!0]:l)),d()}catch(a){console.error("handleResend error",{error:a})}};m.useEffect(()=>{u&&setTimeout(()=>{const r=N.current[u];r&&(le.includes(u)?(I(r),P({type:u})):B(u))},500)},[u]);const te=()=>{I(null)},U=m.useCallback(r=>pt(c,r),[c]),G=!!z,se=G?"check-resend-popover":void 0;return e.jsx(Be,{title:c("notification.notificationDetails"),onClose:o,open:!0,PaperProps:{style:{maxWidth:832,maxHeight:"80vh"}},fullWidth:!0,actionsPosition:"left",children:e.jsxs(mt,{children:[e.jsx(He,{notification:t,blocklet:R}),E.length>0&&e.jsx(S,{className:"notification-resend-section",display:"flex",flexDirection:"column",gap:1,children:E.map(r=>e.jsxs(S,{className:"channel-item",children:[e.jsx(ue,{size:"small",label:e.jsxs(S,{color:"inherit",sx:{fontSize:12,display:"flex",alignItems:"center"},children:[e.jsxs(L,{component:"span",style:{display:"inline-block",fontSize:12,textTransform:"capitalize",fontWeight:500,marginRight:4},children:[r.type,":"," "]}),e.jsxs(S,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:[e.jsx(q,{config:r.extra}),e.jsx("span",{children:r.extra.title})]})]})},r.type),r.extra.status!=="success"&&e.jsxs(L,{ref:s=>{N.current[r.type]=s},component:"span",sx:{color:_.primary.main},className:me("resend-btn",{disabled:r.checking||C[r.type]>=4}),onClick:s=>P(r,s),children:[r.checking?e.jsx(ne,{size:12,sx:{color:_.primary.main}}):e.jsx(re,{}),e.jsx("span",{style:{marginLeft:4},children:c("notification.resend")})]})]}))}),F.length>0&&e.jsxs(S,{className:"webhook-section",sx:{paddingLeft:"56px"},children:[e.jsx(De,{textAlign:"left",sx:{mt:1,mb:1},children:"Webhook"}),e.jsx(S,{className:"notification-resend-section",display:"flex",flexDirection:"column",gap:1,style:{paddingLeft:0},children:F.map(([r,s,n])=>{const a=s[0],l=ee(c,p,{...a,updatedAt:a.sendAt,reason:a.failedReason,channel:"webhook"});return e.jsxs(S,{className:"channel-item",display:"flex",alignItems:"center",sx:{gap:"4px",fontSize:12},children:[e.jsx(X,{maxLength:30,children:r}),e.jsxs(S,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:[e.jsx(q,{config:l}),e.jsx("span",{children:l.title})]}),l.status!=="success"&&e.jsxs(L,{ref:g=>{N.current[r]=g},component:"span",sx:{color:_.primary.main},className:me("resend-btn",{disabled:n||C[r]>=4}),onClick:g=>B(r,g),children:[n?e.jsx(ne,{size:12,sx:{color:_.primary.main}}):e.jsx(re,{}),e.jsx("span",{style:{marginLeft:4},children:c("notification.resend")})]})]},r)})})]}),e.jsx(be,{id:se,open:G,anchorEl:z,onClose:te,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(ht,{children:[e.jsxs(L,{variant:"body1",component:"div",className:"check-title",children:[f==null?void 0:f.channel," Checking"]}),e.jsx(S,{display:"flex",flexDirection:"column",sx:{gap:"4px"},children:U(f==null?void 0:f.channel).map(r=>{var l,g;const{type:s,pass:n,fail:a}=r;return!(f!=null&&f.result)||(l=f==null?void 0:f.result)!=null&&l[s]?e.jsxs(L,{variant:"body1",component:"div",className:"check-item",display:"flex",alignItems:"center",sx:{gap:"4px",color:(g=f==null?void 0:f.result)!=null&&g[s]?_.success.main:"inherit"},children:[f!=null&&f.result?e.jsx(ve,{}):e.jsx(ne,{size:12,sx:{color:_.primary.main}}),e.jsx("span",{children:n})]},s):e.jsxs(L,{variant:"body1",component:"div",display:"flex",alignItems:"center",className:"check-item",sx:{gap:"4px",color:_.error.main},children:[e.jsx(we,{}),e.jsx("span",{children:a})]},s)})})]})})]})})}const mt=ce.div`
|
|
2
|
-
& > .notification-row {
|
|
3
|
-
padding: 0;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
.notification-resend-section {
|
|
7
|
-
padding-left: 56px;
|
|
8
|
-
.channel-item {
|
|
9
|
-
display: flex;
|
|
10
|
-
padding: 4px;
|
|
11
|
-
justify-content: flex-start;
|
|
12
|
-
align-items: center;
|
|
13
|
-
gap: 8px;
|
|
14
|
-
> p {
|
|
15
|
-
font-size: 15px;
|
|
16
|
-
}
|
|
17
|
-
.resend-btn {
|
|
18
|
-
svg {
|
|
19
|
-
font-size: 16px;
|
|
20
|
-
}
|
|
21
|
-
display: flex;
|
|
22
|
-
align-items: center;
|
|
23
|
-
font-size: 12px;
|
|
24
|
-
cursor: pointer;
|
|
25
|
-
&.disabled {
|
|
26
|
-
cursor: not-allowed;
|
|
27
|
-
color: ${_.text.disabled};
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
`,ht=ce.div`
|
|
33
|
-
padding: 8px 16px;
|
|
34
|
-
.check-title {
|
|
35
|
-
font-weight: 500;
|
|
36
|
-
margin-bottom: 8px;
|
|
37
|
-
&::first-letter {
|
|
38
|
-
text-transform: uppercase;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
.check-item {
|
|
42
|
-
svg {
|
|
43
|
-
font-size: 16px;
|
|
44
|
-
}
|
|
45
|
-
font-size: 12px;
|
|
46
|
-
}
|
|
47
|
-
`;Ne.propTypes={value:x.array.isRequired,onChange:x.func};function Ne({value:t,onChange:o}){const{locale:i}=M(),u=K().toDate(),[d,c]=m.useState(null),p=v=>{c(d?null:v.currentTarget)},b=!!d,w=v=>{o([v.startDate,v.endDate]),c(null)};return e.jsxs("div",{children:[e.jsx(L,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:0,children:e.jsxs(Se,{onClick:p,variant:"outlined",size:"small",color:"inherit",children:[fe(t[0],i)," - ",fe(t[1],i)]})}),e.jsx(be,{open:b,anchorEl:d,onClose:()=>{c(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(Ge,{open:!0,maxDate:u,initialDateRange:{startDate:t[0],endDate:t[1]},toggle:p,definedRanges:Je(u),onChange:w})})]})}const gt=["receiver","data","createdAt","walletSendStatus","pushKitSendStatus","emailSendStatus"],xt=()=>Ae({components:{MuiPopover:{styleOverrides:{root:{"& .MuiPaper-root:has(.filter-container)":{width:"420rpx"}}}}}}),ie=(t,o,i)=>(t[i].splice(o,1),t),oe=(t,o)=>o.length?!o.includes(t):!1;function bt({label:t}){return e.jsx(ue,{label:t,variant:"outlined"})}function St(t){var u;const{t:o}=M();return!((u=t==null?void 0:t.filterList)!=null&&u.filter(d=>d.length).length)?null:e.jsxs(S,{display:"flex",gap:1,alignItems:"center",children:[e.jsx("div",{className:"toolbar-filter-title",children:o("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(qe.TableFilterList,{...t,ItemComponent:bt})})]})}H.propTypes={status:x.number.isRequired,updatedAt:x.string.isRequired,reason:x.string,channel:x.string,onResend:x.func};function H({status:t,updatedAt:o,reason:i="",channel:u="wallet",onResend:d}){const{t:c,locale:p}=M(),b=ee(c,p,{status:t,updatedAt:o,reason:i,channel:u});return e.jsxs(S,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(q,{config:b}),e.jsx(L,{color:"inherit",sx:{fontSize:12},children:b.title}),b.status!=="success"&&e.jsx(Se,{className:"resend-btn",size:"small",startIcon:e.jsx(re,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2rpx"}},onClick:d,children:c("notification.resend")})]})}Y.propTypes={filterList:x.array.isRequired,onChange:x.func.isRequired,index:x.number.isRequired,column:x.object.isRequired,statusFilterValues:x.array.isRequired,label:x.string.isRequired};function Y({filterList:t,onChange:o,index:i,column:u,statusFilterValues:d,label:c}){return e.jsxs(ke,{className:"filter-container",children:[e.jsx(Le,{component:"legend",children:c}),e.jsx(Ie,{row:!0,children:d.map(p=>{const b={status:p.status};return e.jsx(Oe,{control:e.jsx(Pe,{checked:t[i].indexOf(p.value)>-1,onChange:w=>{w.target.checked?t[i].push(p.value):t[i]=t[i].filter(v=>v!==p.value),o(t[i],i,u)},name:p.value}),label:e.jsxs("span",{style:{display:"flex",alignItems:"center"},children:[e.jsx(q,{enableTooltip:!1,config:b}),p.label]})},p.value)})})]})}Z.propTypes={list:x.array.isRequired,label:x.string.isRequired,onDelete:x.func.isRequired};function Z({list:t,label:o,onDelete:i}){const{t:u,locale:d}=M();return e.jsxs(S,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(L,{children:[o,": "]}),t.map(c=>{const p=ee(u,d,{status:c});return e.jsx(ue,{size:"small",label:e.jsxs(S,{display:"flex",alignItems:"center",sx:{gap:"4rpx"},children:[e.jsx(q,{config:p,enableTooltip:!1}),e.jsx("span",{children:p.title})]}),onDelete:b=>i(b,c)},c)})]})}function yt(){var r;const{t,locale:o}=M(),{data:i,paging:u,loading:d,blocklet:c,fetch:p,getComponent:b}=Re(),w=m.useRef(null),[v,E]=m.useState(null),[T,F]=m.useState([]),[D,z]=m.useState(gt),I=`notification-records-${(r=c.meta)==null?void 0:r.did}`,f=_e(I),[y,N]=m.useState({searchText:f.searchText||"",pageSize:f.rowsPerPage||10,page:f.page?f.page+1:1,walletSendStatus:f.walletSendStatus||[],pushKitSendStatus:f.pushKitSendStatus||[],emailSendStatus:f.emailSendStatus||[],dateRange:f.dateRange||[K().subtract(1,"month").startOf("day").toDate(),K().endOf("day").toDate()]}),R=m.useCallback(s=>{const{notification:n}=s,a=ze(s,"notification");return a.read=!0,n.receivers=[a],n},[]),h=m.useCallback(s=>{const n=R(s);E(n)},[R]);m.useEffect(()=>{p(y)},[y]),m.useEffect(()=>{E(s=>{if(!s)return null;const n=i.find(a=>a.notification.id===s.id);return n?h(n):s})},[i,h]);const C=({page:s,rowsPerPage:n,searchText:a,filterList:l})=>{const[,,,g=[],A=[],J=[]]=l;y.pageSize!==n?N(k=>({...k,pageSize:n,page:1})):y.page!==s+1?N(k=>({...k,page:s+1})):y.searchText!==a?N(k=>({...k,searchText:a,page:1})):ae(y.walletSendStatus,g)?ae(y.pushKitSendStatus,A)?ae(y.emailSendStatus,J)||N(k=>({...k,emailSendStatus:J,page:1})):N(k=>({...k,pushKitSendStatus:A,page:1})):N(k=>({...k,walletSendStatus:g,page:1}))},j=[{label:t("notification.sendStatus.unsent"),value:0,status:"unsent"},{label:t("notification.sendStatus.success"),value:1,status:"success"},{label:t("notification.sendStatus.failed"),value:2,status:"failed"}],O=(s,n,a,l)=>{s.stopPropagation();const g=a.filter(A=>A!==n);N(A=>({...A,[l]:g,page:1}))},P=(s,n,a)=>{s.stopPropagation();const l=R(n);E(l),F(a)},B=()=>{E(null),F("")},te=m.useCallback(()=>{p(y)},[p,y]),U=[{label:t("notification.receiver"),name:"receiver",width:200,options:{filter:!1,display:D.includes("receiver"),customBodyRenderLite:s=>{const{receiverUser:n,receiver:a}=i[s];return n?e.jsxs(S,{"data-cy":`member-name-${n.fullName}`,display:"flex",alignItems:"center",gap:2,justifyContent:"flex-start",children:[e.jsx(Ke,{src:`${n.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:a,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(X,{children:n.fullName})]},a):e.jsx(Ve,{size:14,responsive:!1,compact:!0,copyable:!1,did:a})}}},{label:t("notification.notificationPreview"),name:"data",width:300,options:{filter:!1,display:D.includes("data"),customBodyRenderLite:s=>{const n=i[s],{notification:a}=n,l=b(a.componentDid);return e.jsxs(S,{display:"flex",alignItems:"center",gap:1,onClick:g=>{g.stopPropagation(),h(n)},children:[l?e.jsx(Xe,{size:32,blocklet:l,ancestors:l.ancestors??[]}):e.jsx(Ye,{blocklet:c,size:32}),e.jsx(X,{maxLength:50,children:a.title})]})}}},{label:t("common.createdAt"),name:"createdAt",width:200,options:{filter:!1,display:D.includes("createdAt"),customBodyRenderLite:s=>{const{createdAt:n}=i[s];return e.jsx(Qe,{value:n,locale:o,shouldUpdate:!0})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{display:D.includes("walletSendStatus"),setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:y.walletSendStatus??[],customFilterListOptions:{render:s=>e.jsx(Z,{list:s,label:"Wallet",onDelete:(n,a)=>{n.stopPropagation(),O(n,a,U[3].options.filterList,"walletSendStatus")}}),update:ie},filterOptions:{names:j,fullWidth:!0,logic:oe,display:(s,n,a,l)=>e.jsx(Y,{label:"Wallet",filterList:s,onChange:n,index:a,column:l,statusFilterValues:j})},customBodyRenderLite:s=>{const{walletSendStatus:n,walletSendAt:a,walletSendFailedReason:l}=i[s];return e.jsx(H,{status:n,updatedAt:a,reason:l,channel:"wallet",onResend:g=>P(g,i[s],"wallet")})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{display:D.includes("pushKitSendStatus"),setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:s=>{const{pushKitSendStatus:n,pushKitSendAt:a,pushKitSendFailedReason:l}=i[s];return e.jsx(H,{status:n,updatedAt:a,reason:l,channel:"pushkit",onResend:g=>P(g,i[s],"pushKit")})},filter:!0,filterType:"custom",filterList:y.pushKitSendStatus??[],customFilterListOptions:{render:s=>e.jsx(Z,{list:s,label:"PushKit",onDelete:(n,a)=>{n.stopPropagation(),O(n,a,U[4].options.filterList,"pushKitSendStatus")}}),update:ie},filterOptions:{names:j,fullWidth:!0,logic:oe,display:(s,n,a,l)=>e.jsx(Y,{label:"PushKit",filterList:s,onChange:n,index:a,column:l,statusFilterValues:j})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),display:D.includes("emailSendStatus"),customBodyRenderLite:s=>{const{emailSendStatus:n,emailSendAt:a,emailSendFailedReason:l}=i[s];return e.jsx(H,{status:n,updatedAt:a,reason:l,channel:"email",onResend:g=>P(g,i[s],"email")})},filter:!0,filterType:"custom",filterList:y.emailSendStatus??[],customFilterListOptions:{render:s=>e.jsx(Z,{list:s,label:"Email",onDelete:(n,a)=>{n.stopPropagation(),O(n,a,U[5].options.filterList,"emailSendStatus")}}),update:ie},filterOptions:{names:j,fullWidth:!0,logic:oe,display:(s,n,a,l)=>e.jsx(Y,{label:"Email",filterList:s,onChange:n,index:a,column:l,statusFilterValues:j})}}},{label:"Webhook",name:"webhook",width:200,options:{display:D.includes("webhook"),filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:s=>{const{webhook:n}=i[s];if(!n)return null;const a=Object.entries(n)[0];if(!a)return null;const[l,g]=a,A=g[0];return e.jsx(S,{display:"flex",flexDirection:"column",gap:1,children:e.jsxs(S,{className:"webhook-item",fontSize:12,children:[e.jsx(X,{maxLength:30,children:l},l),e.jsx(H,{status:A.status,updatedAt:A.sendAt,reason:A.failedReason,channel:"webhook",onResend:J=>P(J,i[s],l)})]},l)})}}}],G=s=>{N(n=>({...n,dateRange:s,page:1}))},se=[e.jsx(Ne,{value:y.dateRange,onChange:G})];return e.jsxs(S,{ref:w,sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:[e.jsx(jt,{children:e.jsx(Ee,{theme:xt(),children:e.jsx(We,{className:"main-data",verticalKeyWidth:100,loading:d,locale:o,columns:U,data:i,durable:I,onChange:C,options:{sort:!1,download:!1,print:!1,responsive:!1,expandableRowsOnClick:!0,searchPlaceholder:t("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:u.page-1,rowsPerPage:u.pageSize,count:u.total,...f,searchText:y.searchText,onViewColumnsChange:(s,n)=>{z(n==="add"?a=>[...a,s]:a=>a.filter(l=>l!==s))}},customButtons:se,components:{TableFilterList:St}})})}),v&&e.jsx(Ce,{refresh:te,onCancel:B,notification:v,blocklet:c,resendChannel:T})]})}const jt=ce.div`
|
|
48
|
-
td.MuiTableCell-footer {
|
|
49
|
-
border: none !important;
|
|
50
|
-
}
|
|
51
|
-
.sent-status-cell {
|
|
52
|
-
.resend-btn {
|
|
53
|
-
display: none;
|
|
54
|
-
}
|
|
55
|
-
&:hover {
|
|
56
|
-
.resend-btn {
|
|
57
|
-
display: flex;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
`;Rt.propTypes={blocklet:x.object.isRequired};function Rt({blocklet:t={}}){return e.jsx(et,{blocklet:t,children:e.jsx(yt,{})})}export{Rt as default,xt as getMuiTheme};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{t as n,j as i,a3 as l}from"./vendor-mui-core-CCMNKHtm.js";import{l as d,r as c}from"./vendor-react-D-afvo_7.js";import{e as u,a5 as h}from"./vendor-arcblock-CVRRnBv2.js";import g from"./index-CRaD-3s4.js";import"./vendor-utils-5TjOM6td.js";import"./vendor-hooks-BKxTDk_P.js";import"./index-PxlbAHCL.js";import"./Add-B2yJ7-eq.js";import"./Error-Dy9JDlUO.js";import"./confirm-Cbx82b25.js";import"./format-error-C0Ke3VXF.js";import"./session-ClC5u_ou.js";import"./did-address-DhC4Z1Ef.js";import"./react-beautiful-dnd.esm-C5Uq3rbJ.js";import"./raf-schd.esm-Cxhj8umC.js";import"./bundle-avatar-BSrkMwWG.js";import"./shorten-label-CYJeMT7h.js";import"./Download-ynxZ21_h.js";import"./QuestionMarkCircle-SCPzvU7T.js";import"./useSetState-Crt4S51m.js";import"./index-DoZ2YM4T.js";import"./index-DE_r-gh_.js";import"./index-DBxnR425.js";import"./api-K65cLqol.js";import"./ChevronRight-bqoO4ITE.js";import"./vendor-mui-x-DmPVvZFJ.js";import"./DeleteOutline-_fdI9SLO.js";import"./item-DvkqLmAe.js";import"./Launch-DrBfpSUO.js";import"./Done-BegjCX44.js";import"./click-to-copy-DG6oCsDy.js";import"./get-safe-url-CJIsC1HE.js";import"./ArrowDropDown-D34En9iv.js";import"./index-BvLMNAG0.js";import"./index-C0uUrAqS.js";const r=new URL(window.location.href),s=r.searchParams.get("mode")==="dialog",w=s?"":r.searchParams.get("padding")||"";function _(){const{t:p}=u(),{componentDid:o}=d(),a=n(t=>t.breakpoints.down("md")),m=t=>{t.stopPropagation(),window.parent.postMessage({event:"resourceDialog.close",componentDid:o},"*")};c.useEffect(()=>{window.parent.postMessage({event:"resourceDialog.loaded",componentDid:o},"*")},[o]);const e=i.jsx(g,{padding:w,initUrl:r});return s?i.jsx(h,{className:"studio-dialog",title:p("blocklet.publish.blockletStudio"),maxWidth:!1,fullWidth:!1,PaperProps:{style:a?{width:"100%",height:window.innerHeight}:{maxWidth:1350,minWidth:930,width:"80%"}},onClose:m,showCloseButton:!0,disableEscapeKeyDown:!0,open:!0,children:i.jsx(l,{sx:{height:"72vh",overflow:"auto",position:"relative"},children:e})}):e}export{_ as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ao as o}from"./vendor-arcblock-CVRRnBv2.js";const e=new o;export{e as b};
|