@abtnode/blocklet-services 1.17.8-beta-20260108-021819-e099f0ca → 1.17.8-beta-20260108-120904-21cb5fb6
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/util/blocklet-utils.js +9 -4
- package/dist/assets/{Google-JbLVL0lz.js → Google-BI3aC5vK.js} +1 -1
- package/dist/assets/{access-control-DMsY0Jfu.js → access-control-BL-PuDiR.js} +1 -1
- package/dist/assets/{add-component-core-DXBsHpN1.js → add-component-core-BzMN094F.js} +1 -1
- package/dist/assets/{add-resource-B1owMSeP.js → add-resource-BRF-rYME.js} +1 -1
- package/dist/assets/{addon-B42_QFF5.js → addon-yDIBSjIk.js} +1 -1
- package/dist/assets/{advanced-BnFynWN7.js → advanced-DEE0XFtQ.js} +1 -1
- package/dist/assets/{aigne-Qq2FBVAW.js → aigne-9evgyH7b.js} +1 -1
- package/dist/assets/{appearance-Dnc6HNzY.js → appearance-C8B414U2.js} +1 -1
- package/dist/assets/{audit-logs-Cfw8JmA4.js → audit-logs-qNutRhHx.js} +1 -1
- package/dist/assets/{authorize-B_1efpwx.js → authorize-CZSHuYdu.js} +1 -1
- package/dist/assets/{base32-r3F0yIbl.js → base32-z3esjJBn.js} +1 -1
- package/dist/assets/{bind-account-Cw-tBmC3.js → bind-account-QxLU_sxt.js} +1 -1
- package/dist/assets/{branding-BxEmV2m2.js → branding-Bk26INk9.js} +1 -1
- package/dist/assets/{branding-CBavw5s2.js → branding-_XszRU-Z.js} +1 -1
- package/dist/assets/{branding-CbYOEW_s.js → branding-tR0gcoY_.js} +1 -1
- package/dist/assets/{bundle-avatar-1zs0l21j.js → bundle-avatar-2AQWR0ld.js} +1 -1
- package/dist/assets/{complete-CIQgRJri.js → complete-CEvsz8uU.js} +1 -1
- package/dist/assets/{component-qZAbczHw.js → component-BrZ1DWiw.js} +2 -2
- package/dist/assets/{config-btuzRTop.js → config-6tpm84_l.js} +1 -1
- package/dist/assets/{config-BaKRlJau.js → config-CwlqBQNt.js} +1 -1
- package/dist/assets/config-cdtQwn5t.js +53 -0
- package/dist/assets/{config-navigation-BNsZpUQd.js → config-navigation-CZ9V7otK.js} +2 -2
- package/dist/assets/{config-space-BZQrckxG.js → config-space-CZRqkXsR.js} +1 -1
- package/dist/assets/{confirm-D6AvlbAp.js → confirm-Ch-CAgUO.js} +1 -1
- package/dist/assets/{connect-_I5q1wXN.js → connect-BNkv99fz.js} +1 -1
- package/dist/assets/{connect-Dv4BPfET.js → connect-CadBIZOq.js} +1 -1
- package/dist/assets/{connect-BC85oS0g.js → connect-i7rkK26L.js} +1 -1
- package/dist/assets/{connect-to-CVH3cw77.js → connect-to-lX3lujSp.js} +1 -1
- package/dist/assets/{dashboard-BQgUp8NI.js → dashboard-CmJOnF0g.js} +2 -2
- package/dist/assets/{delete-confirm-BLy-Oo1o.js → delete-confirm-DiU5PO2T.js} +1 -1
- package/dist/assets/{domain-BqtauLm5.js → domain-DHqSA0zl.js} +1 -1
- package/dist/assets/{domain-action-card-nuzd77mn.js → domain-action-card-BsNaII7k.js} +1 -1
- package/dist/assets/{domains-Cg8723ho.js → domains-BQ_Of9Oo.js} +1 -1
- package/dist/assets/{email-CCNEyVGq.js → email-DXdzQLls.js} +1 -1
- package/dist/assets/engine-D18zeIE7.js +1 -0
- package/dist/assets/{exchange-passport-DR-pKNHM.js → exchange-passport-NOgYhNpm.js} +1 -1
- package/dist/assets/{form-Bkig0Zr5.js → form-DhecYoSJ.js} +1 -1
- package/dist/assets/{fuel-tC2bCgpP.js → fuel-DgzL5KSX.js} +1 -1
- package/dist/assets/{gen-access-key-BbtCn0wJ.js → gen-access-key-BxnyhhCR.js} +1 -1
- package/dist/assets/{gen-simple-access-key-DbKaLz9m.js → gen-simple-access-key-BJI-4yOF.js} +1 -1
- package/dist/assets/{get-safe-url-DxqVk96E.js → get-safe-url-BVTaUfvO.js} +1 -1
- package/dist/assets/{home-BdXWvJM-.js → home-Bibhtg_U.js} +1 -1
- package/dist/assets/{iframe-BHP6CYbe.js → iframe-CqiUrjUO.js} +1 -1
- package/dist/assets/{index-DixUQBnm.js → index-0ZSFNH-D.js} +1 -1
- package/dist/assets/{index-C96Fw4Lj.js → index-BhpNA6ar.js} +1 -1
- package/dist/assets/{index-D3L_FG1K.js → index-BszSKE9L.js} +1 -1
- package/dist/assets/{index-BbSDwNE6.js → index-CHkWO9t3.js} +1 -1
- package/dist/assets/{index-BPZITdMW.js → index-Cdaohlhu.js} +1 -1
- package/dist/assets/{index-DVrxzIzr.js → index-CdsI3g5U.js} +1 -1
- package/dist/assets/index-CsYL8tps.js +1 -0
- package/dist/assets/{index-CNGNZ6kv.js → index-D88DUiSg.js} +1 -1
- package/dist/assets/{index-B0O4cfgn.js → index-D8NN8LDz.js} +1 -1
- package/dist/assets/{index-BEfIUbZC.js → index-DI4CWTXR.js} +62 -62
- package/dist/assets/{index-BvB9yPsA.js → index-DUnMyyWn.js} +3 -3
- package/dist/assets/{index-DUL9RfTo.js → index-D_ckidZn.js} +1 -1
- package/dist/assets/{index-5IYIk-ZG.js → index-DlifV2p1.js} +1 -1
- package/dist/assets/{index-BGo7DXlf.js → index-DzdHYw6g.js} +1 -1
- package/dist/assets/{index-B7hLDto7.js → index-Ge2WhAk1.js} +1 -1
- package/dist/assets/{index-BoLm67SH.js → index-POuATgdm.js} +1 -1
- package/dist/assets/index-TBM4hzrY.js +81 -0
- package/dist/assets/{index-BasnkqHA.js → index-WjASWJcO.js} +1 -1
- package/dist/assets/{index-Cvt4JvUl.js → index-fC-FqmP3.js} +1 -1
- package/dist/assets/{index-yvRJAzQn.js → index-gohmHhDq.js} +1 -1
- package/dist/assets/{index-Ly6A31IO.js → index-hBDzzv6I.js} +1 -1
- package/dist/assets/{index-dC2vB2_g.js → index-iX-pnOjy.js} +1 -1
- package/dist/assets/{index-BrDWLIA2.js → index-jILCQaR3.js} +1 -1
- package/dist/assets/{index-D320ZZ3W.js → index-m_xRKGyG.js} +1 -1
- package/dist/assets/{index-Bv2O-NCZ.js → index-mt_AKU_F.js} +2 -2
- package/dist/assets/{index-DTdf57JC.js → index-u9tqiWy4.js} +1 -1
- package/dist/assets/{index-BHnD9G0G.js → index-uexcv8C-.js} +1 -1
- package/dist/assets/{info-outline-rounded-YiCh4oGg.js → info-outline-rounded-BLwoUxyI.js} +1 -1
- package/dist/assets/{invitation-CnuNtRnn.js → invitation-DSs7YT3_.js} +1 -1
- package/dist/assets/{invitations-D_3NLIPO.js → invitations-DK7oD-E6.js} +1 -1
- package/dist/assets/{invite-CUVHQCSI.js → invite-CdWfDz--.js} +1 -1
- package/dist/assets/{isURL-vNa-ZfGd.js → isURL-DMMDDAKA.js} +1 -1
- package/dist/assets/{issue-passport-Do2LhI-f.js → issue-passport-yIqheTA0.js} +1 -1
- package/dist/assets/{item-BabsiwzU.js → item-BV3WfK17.js} +1 -1
- package/dist/assets/{landing-page-B5QvkHHO.js → landing-page-BDAr8Hmo.js} +1 -1
- package/dist/assets/{layout-DRVZ4L0D.js → layout-DzZv-Jny.js} +1 -1
- package/dist/assets/{list-B22ZyQqz.js → list-B6eMSw29.js} +1 -1
- package/dist/assets/{list-BbHzj-7w.js → list-BWd3aUjb.js} +1 -1
- package/dist/assets/{localization-BFHoFo4B.js → localization-oLJXrcTA.js} +1 -1
- package/dist/assets/{log-BigiLZw2.js → log-BskdQbRf.js} +1 -1
- package/dist/assets/{login-DeBY1fPe.js → login-CfL0Uf6Y.js} +1 -1
- package/dist/assets/{login-oauth-callback-Du-bMipe.js → login-oauth-callback-_6XAZMOE.js} +1 -1
- package/dist/assets/{logo-uploader-DEFzQY0j.js → logo-uploader-D5E5QaRF.js} +1 -1
- package/dist/assets/{lost-passport-DkN5GdCK.js → lost-passport-CUtEI06a.js} +1 -1
- package/dist/assets/{open-window-CdadJ5vo.js → open-window-Bi6zVDJd.js} +1 -1
- package/dist/assets/{over-due-invoice-payment-CXZ42RZu.js → over-due-invoice-payment-B7FQEnNH.js} +1 -1
- package/dist/assets/{overview-a9TXaGnH.js → overview-C7QghcRT.js} +1 -1
- package/dist/assets/{passport-C_PAxd9K.js → passport-B_eTMTmZ.js} +1 -1
- package/dist/assets/{passport-item-BudJHbYX.js → passport-item-D53yZ-cF.js} +1 -1
- package/dist/assets/{permission-CeqEAPPT.js → permission-DC8i_y8F.js} +1 -1
- package/dist/assets/{preferences-ixUbb8gE.js → preferences-DzDUGj-O.js} +1 -1
- package/dist/assets/{profile-embed-BIwa1Yt3.js → profile-embed-B3QUDkbU.js} +1 -1
- package/dist/assets/{provider-icon-CkqIY6iX.js → provider-icon-D15U0Izg.js} +1 -1
- package/dist/assets/{publish-resource-BpvxLOlV.js → publish-resource-DCIlLUPS.js} +1 -1
- package/dist/assets/{runtime-TkU2snTc.js → runtime-BHekBabT.js} +1 -1
- package/dist/assets/sdk-CJUhxOGJ.js +1 -0
- package/dist/assets/{security-Dw0iwARQ.js → security-BMslI5IZ.js} +1 -1
- package/dist/assets/{session-Cin9Rizr.js → session-CZpDtsCZ.js} +1 -1
- package/dist/assets/{setup-Daw0Bdkr.js → setup-CCvGdFDO.js} +1 -1
- package/dist/assets/{spaces-DghHe7uP.js → spaces-D3H6AchN.js} +1 -1
- package/dist/assets/{start-SLdZOtVD.js → start-SeWUP0mo.js} +1 -1
- package/dist/assets/{starting-progress-BiI8hmaj.js → starting-progress-Y3UjFmoX.js} +1 -1
- package/dist/assets/{status-DRNtY6SL.js → status-MSXp_buG.js} +1 -1
- package/dist/assets/{step-actions-Cb6B0FCJ.js → step-actions-BNFJWVZI.js} +1 -1
- package/dist/assets/{studio-CVfdma-R.js → studio-CRjDRBty.js} +1 -1
- package/dist/assets/{team-DkV63Yjl.js → team-YWd-FRKh.js} +1 -1
- package/dist/assets/{traffic-C8BReAMz.js → traffic-0IuWlrAD.js} +1 -1
- package/dist/assets/{transfer-Dt4V38KL.js → transfer-DRS2VUAN.js} +1 -1
- package/dist/assets/{unsubscribe-rCcvC6Dj.js → unsubscribe-xDow2Z6m.js} +1 -1
- package/dist/assets/{use-app-logo-DnCfhAzv.js → use-app-logo-hIHAHSSI.js} +1 -1
- package/dist/assets/{user-center-Cnc61do7.js → user-center-COnqQuqE.js} +1 -1
- package/dist/assets/{user-follower-Cc2pWcSL.js → user-follower-DVX8m-Zk.js} +1 -1
- package/dist/assets/{util-CMCJQTXJ.js → util-Dee1Ybp3.js} +1 -1
- package/dist/assets/{util-BgLSp_5A.js → util-GXkeqbBQ.js} +1 -1
- package/dist/assets/{wait-connect-TKbZWSFd.js → wait-connect-CLe9IfYi.js} +1 -1
- package/dist/assets/{wizard-BSaM_cSr.js → wizard-8Tk0iyxY.js} +1 -1
- package/dist/assets/{wizard-components-BOHnkwWH.js → wizard-components-C10frai0.js} +1 -1
- package/dist/assets/{wrap-locale-CFhaO2KZ.js → wrap-locale-CxYp8fAf.js} +1 -1
- package/dist/assets/{zh-DG89vJJ6.js → zh-BRjrClew.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +24 -24
- package/dist/assets/config-CoSaZVwp.js +0 -53
- package/dist/assets/engine-DOYgeVKF.js +0 -1
- package/dist/assets/index-B3RkYGd7.js +0 -1
- package/dist/assets/index-Bm1VCAzZ.js +0 -81
- package/dist/assets/sdk-CMvNWVGa.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as x}from"./vendor-react-CTtPmzVP.js";import{j as e,W as d,am as mt,ak as N,T as Y,U as ke,y as Fe,bk as Ve,b$ as Re,bX as Te,a5 as Ie,Q as Ce,dH as Pe,aN as Ee,a6 as Ge,D as Ye,cD as ht,ad as Qe,e5 as gt,e6 as xt,at as ae,b4 as He,n as bt,J as yt,x as jt,bZ as St,M as qe,cB as vt}from"./vendor-mui-core-CKKG_1TN.js";import{e as ee,l as Ct,w as pe}from"./vendor-utils-CUs2ebe7.js";import{W as q,ba as Nt,V as X,dg as wt,m as Xe,Y as Ze,F as Ae,b3 as Je,bE as be,a_ as Rt,bc as Tt,bk as It,bu as Et}from"./vendor-ux-DjXlxcvL.js";import{Z as At,Q as H,c as E,C as Dt,a1 as Ue}from"./index-BEfIUbZC.js";import{a as Q,g as De}from"./vendor-hooks-DQAdyHrE.js";import{S as me}from"./shorten-label-DXFyDHDr.js";import{v as et}from"./index-BSZ3mQac.js";import{R as tt,A as Ot,S as Lt,a as kt,B as Ft}from"./list-BbHzj-7w.js";import{i as Pt,e as _t,N as Bt}from"./team-DkV63Yjl.js";import{W as zt}from"./did-address-Cq16cwTy.js";import{p as st}from"./util-BgLSp_5A.js";import{D as Wt,g as Mt}from"./traffic-C8BReAMz.js";import{B as nt}from"./bundle-avatar-1zs0l21j.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-BCP2x3BR.js";import"./server-logo-notext.svg-BLAdvsmP.js";import"./session-Cin9Rizr.js";import"./isURL-vNa-ZfGd.js";import"./use-app-logo-DnCfhAzv.js";import"./base32-r3F0yIbl.js";import"./useAsyncRetry-B_bXUXWM.js";import"./useAsync-D6IP8T2e.js";import"./iframe-BHP6CYbe.js";import"./index-KUC3HPt0.js";import"./index-DBs9Ljax.js";import"./base-chart-DT--nPCU.js";import"./index-CaQuyP_U.js";import"./vendor-mui-x-DHGvg6Bj.js";import"./AdapterDayjs-C1bdndja.js";const at=x.createContext({}),{Provider:Kt,Consumer:Hs}=at;function Ht({children:t,blocklet:s=""}){const{api:n,inService:r,ws:{useSubscription:i}}=At(),[l,b]=x.useState([]),[m,S]=x.useState({total:0,pageSize:20,pageCount:0,page:1}),h=Q(()=>s.meta?.did,[s]),[y,v]=x.useState([]),[P,F]=x.useState({}),w=Q(()=>l.length?new Set(l.map(p=>p.id)):new Set,[l]),U=async({page:p=1,pageSize:g=20,...T}={})=>{if(!h)return[];try{const D={paging:{page:p,pageSize:g},...T,teamDid:h,dateRange:T.dateRange?[H(T.dateRange[0]).toISOString(),H(T.dateRange[1]).toISOString()]:void 0},{dids:O,...z}=D;let _="";O&&O.includes("system")&&(_="system");const ie=O?O.filter(oe=>oe!=="system"):[],se={...z,source:_,componentDids:ie},J=await n.getNotificationSendLog({input:se});return F(se),b(J.list),S(J.paging),J.list}catch(D){return q.error(D.message),[]}},M=async()=>{const p=await n.getNotificationComponents({input:{teamDid:h}});v(p.componentDids)},L=x.useCallback(p=>{const g=s.children.find(T=>T.meta?.did===p);if(g)return g.ancestors=[s],g},[s]),k=async({notificationId:p,receivers:g,channels:T,...D})=>{await n.resendNotification({input:{teamDid:h,notificationId:p,receivers:g,channels:T.map(O=>O==="wallet"?E.NOTIFICATION_SEND_CHANNEL.WALLET:O==="pushKit"?E.NOTIFICATION_SEND_CHANNEL.PUSH:O),...D}})},$=x.useCallback(async p=>(await n.getUser({input:{teamDid:h,user:{did:p},options:{enableConnectedAccount:!0}}})).user,[n,h]),V=x.useCallback(async({page:p=1,pageSize:g=20,...T}={})=>{try{const D={paging:{page:p,pageSize:g},...T,userName:T.searchText||"",teamDid:h,dateRange:T.dateRange?[H(T.dateRange[0]).toISOString(),H(T.dateRange[1]).toISOString()]:void 0};return await n.getReceivers({input:D})}catch(D){throw q.error(D.message),D}},[n,h]);x.useEffect(()=>{h&&M()},[h]),i(E.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,p=>{w.has(p.notificationId)&&U(P)},[w,P]),i(E.EVENTS.NOTIFICATION_BLOCKLET_CREATE,p=>{w.has(p.id)||U(P)},[w,P]);const Z={fetch:U,data:l,paging:m,blocklet:s,getComponent:L,resendNotification:k,getUser:$,componentDids:y,getReceivers:V,inService:r,teamDid:h};return e.jsx(Kt,{value:{notificationRecords:Z},children:t})}function _e(){const{notificationRecords:t}=x.useContext(at);return t}he.propTypes={severity:d.oneOf(Object.values(["info","success","error","warning"])).isRequired};const qt={info:"primary",success:"success",error:"error",warning:"warning"};function he({severity:t="info"}){return e.jsx(Nt,{type:qt[t],children:t})}const Ut=(t,s,n="")=>{if(!n||!s)return"";switch(n){case E.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:s});case E.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:s});case E.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:s});case E.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return n}};function it(t,s,n={}){const{status:r,updatedAt:i,reason:l="",channel:b="wallet"}=n,m=i?t("notification.sendStatus.sentTime",{date:Dt(i,s)}):"",S=Ut(t,b,l);return r===E.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:m,reason:S}:r===E.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:m}:{status:"pending",title:t("notification.sendStatus.pending"),reason:S,sentTime:m}}const Oe={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Le=["wallet","pushKit","email"],$e=["info","success","error","warning"],ot=t=>{const{settings:s}=t;return s?.notification?.email?.enabled},rt=t=>{const{settings:s}=t;return s?.notification?.pushKit?.enabled},$t=(t,s)=>{const n=ee(s,"extra.notifications.email",!0);return{available:ot(t),enabled:n}},Vt=(t,s)=>{const n=ee(s,"extra.notifications.push",!0);return{available:rt(t),enabled:n}},Gt=t=>({enabled:ee(t,"extra.notifications.wallet",!0)}),Yt=t=>({enabled:ee(t,"extra.webhooks",[]).length>0}),ge=(t=3)=>new Promise(s=>{setTimeout(()=>{s()},t*1e3)}),Qt=(t,s)=>s==="wallet"||s==="webhook"?[{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:s==="pushKit"||s==="email"?[{channel:s,type:"available",pass:t("notification.sendStatus.reason.available",{channel:s}),fail:t("notification.sendStatus.reason.unavailable",{channel:s})},{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:[],xe=(t=[])=>{const s=H().startOf("day");return t.filter(n=>H(n.sendAt).isSame(s,"day")).length},Xt=(t,s="")=>{if(s&&Le.includes(s)){const l=`${s}SendRecord`,b=ee(t,l,[]);return xe(b)}const n=ee(t,"webhook",{}),r=Object.keys(n??{})??[];if(s&&r.includes(s)){const l=n[s]??[];return xe(l)}const i={};return Le.forEach(l=>{const b=`${l}SendRecord`,m=ee(t,b,[]),S=xe(m);i[l]=S}),r.length>0&&r.forEach(l=>{const b=n[l]??[],m=xe(b);i[l]=m}),i},ye=(t,s,n)=>{if(!Array.isArray(t))throw new Error("Invalid filterList or index");return t[n].splice(s,1),t},je=(t,s)=>{if(!Array.isArray(s))throw new Error("filters must be an array");return s.length?!s.includes(t):!1},Zt=t=>{switch(t){case E.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case E.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case E.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case E.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 te({config:t,enableTooltip:s=!0,showTitle:n=!1,children:r=null}){const{status:i,title:l="",sentTime:b="",reason:m=""}=t,S=[l,m].filter(Boolean).join(", ");return e.jsx(mt,{title:s?e.jsxs(e.Fragment,{children:[e.jsx(Y,{color:"inherit",sx:{fontSize:12},children:S}),e.jsx("span",{children:b})]}):null,arrow:!0,placement:"top",children:e.jsxs(N,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(N,{sx:{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx(N,{style:{opacity:.15},sx:{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Oe[i]}}),e.jsx(N,{sx:{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Oe[i]}})]}),e.jsx(Y,{color:"inherit",sx:{fontSize:12},children:n?l:r})]})})}te.propTypes={config:d.object.isRequired,enableTooltip:d.bool,showTitle:d.bool,children:d.node};Se.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};function Se({list:t,label:s,onDelete:n=()=>{}}){const{t:r,locale:i}=X();return e.jsxs(N,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsxs(Y,{children:[s,": "]}),t.map(l=>{const b=it(r,i,{status:l});return e.jsx(ke,{size:"small",label:e.jsx(N,{sx:{display:"flex",alignItems:"center",gap:"4px"},children:e.jsx(te,{config:b,enableTooltip:!1,children:b.title})}),onDelete:m=>n(m,l)},l)})]})}Be.propTypes={filterList:d.array.isRequired,onChange:d.func.isRequired,index:d.number.isRequired,column:d.object.isRequired,filterValues:d.array.isRequired,label:d.string.isRequired,renderLabel:d.func.isRequired};function Be({filterList:t,onChange:s,index:n,column:r,filterValues:i,label:l,renderLabel:b}){return e.jsxs(Fe,{className:"filter-container",children:[e.jsx(Ve,{component:"legend",children:l}),e.jsx(Re,{row:!0,children:i.map(m=>e.jsx(Te,{control:e.jsx(Ie,{checked:t[n].indexOf(m.value??m)>-1,onChange:S=>{const h=[...t];S.target.checked?h[n]=[...h[n],m.value??m]:h[n]=h[n].filter(y=>y!==(m.value??m)),s(h[n],n,r)},name:m.value??m}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:b(m)})},m.value??m))})]})}function we(t){return e.jsx(Be,{...t,renderLabel:s=>e.jsx(te,{enableTooltip:!1,config:{status:s.status},children:s.label})})}ce.propTypes={status:d.number.isRequired,updatedAt:d.string.isRequired,reason:d.string,channel:d.string,onResend:d.func};function ce({status:t,updatedAt:s,reason:n="",channel:r="wallet",onResend:i}){const{t:l,locale:b}=X(),m=it(l,b,{status:t,updatedAt:s,reason:n,channel:r});return e.jsxs(N,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(te,{config:m,showTitle:!0}),m.status!=="success"&&e.jsx(Ce,{className:"resend-btn",size:"small",startIcon:e.jsx(Pe,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:i,children:l("notification.resend")})]})}ze.propTypes={value:d.array.isRequired,onChange:d.func};function ze({value:t,onChange:s}){const{locale:n}=X(),r=H().toDate(),[i,l]=x.useState(null),b=x.useCallback(h=>{l(i?null:h.currentTarget)},[i]),m=!!i,S=x.useCallback(h=>{if(!h.startDate||!h.endDate){q.error("Please select a date range");return}if(H(h.startDate).isAfter(h.endDate)||!H(h.startDate).isValid()||!H(h.endDate).isValid()){q.error("Invalid date range");return}s([h.startDate,h.endDate]),l(null)},[s]);return e.jsxs("div",{children:[e.jsx(Y,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},sx:{mb:0},children:e.jsxs(Ce,{onClick:b,variant:"outlined",size:"small",color:"inherit",children:[Ue(t[0],n)," - ",Ue(t[1],n)]})}),e.jsx(Ee,{open:m,anchorEl:i,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(Wt,{open:!0,maxDate:r,initialDateRange:{startDate:t[0],endDate:t[1]},toggle:b,definedRanges:Mt(r),onChange:S})})]})}We.propTypes={itemComponent:d.elementType.isRequired};function We({itemComponent:t,...s}){const{t:n}=X();return!s?.filterList?.filter(i=>i.length).length?null:e.jsxs(N,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsx("div",{className:"toolbar-filter-title",children:n("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(wt.TableFilterList,{...s,ItemComponent:t})})]})}function Me({label:t,onDelete:s,canDelete:n=()=>!0,...r}){const i=s&&typeof s=="function"?s:void 0;let l=!0;return n&&typeof n=="function"&&(l=n({label:t,...r})),e.jsx(ke,{label:t,variant:"outlined",...i&&l?{onDelete:i}:{}})}Me.propTypes={label:d.string.isRequired,onDelete:d.func,canDelete:d.func};const Jt=[{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}];ct.propTypes={loading:d.bool,onCancel:d.func,onConfirm:d.func};function ct({loading:t=!1,onCancel:s=()=>{},onConfirm:n=()=>{}}){const{t:r}=X(),[i,l]=x.useState(Jt),[b,m]=x.useState(!0),S=(y,v)=>{v.checked=y.target.checked;const P=i.map(F=>({...F,checked:F.value===v.value?v.checked:F.checked}));l(P)},h=y=>{y.stopPropagation(),n({channels:i.filter(v=>v.checked).map(v=>v.value),isResendFailedOnly:b})};return e.jsxs(N,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(Y,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(N,{className:"choose-channel",children:e.jsxs(Fe,{component:"fieldset",variant:"standard",children:[e.jsx(Ve,{component:"legend",children:r("notification.selectChannels")}),e.jsx(Re,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:i.map(y=>e.jsx(Te,{control:e.jsx(Ie,{checked:y.checked,onChange:v=>S(v,y),name:y.value}),label:y.label},y.value))})]})}),e.jsx(N,{className:"resend-config-footer",children:e.jsx(Re,{children:e.jsx(Te,{control:e.jsx(Ie,{checked:b,onChange:y=>m(y.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(N,{className:"resend-config-footer-tip",sx:{display:"flex",justifyContent:"flex-end",gap:1},children:[e.jsx(Ce,{onClick:y=>{y.stopPropagation(),s()},color:"inherit",children:r("common.cancel")}),e.jsxs(Ce,{onClick:h,color:"primary",disabled:t,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[t&&e.jsx(Ge,{size:16}),r("common.confirm")]})]})]})}dt.propTypes={notificationId:d.string.isRequired,handleResend:d.func,resending:d.bool};function dt({notificationId:t,handleResend:s,resending:n=!1}){const{t:r,locale:i}=X(),l=Ye(),b=x.useMemo(()=>Xe(l,lt()),[l]),{getReceivers:m,inService:S,teamDid:h,getUser:y,blocklet:v}=_e(),[P,F]=x.useState(!1),[w,U]=x.useState([]),M=De({anchorEl:null,position:null}),L=De({anchorEl:null,position:null}),[k,$]=x.useState(null),[V,Z]=x.useState({total:0,pageSize:10,pageCount:0,page:1}),[p,g]=x.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[H().subtract(1,"month").startOf("day").toDate(),H().endOf("day").toDate()]}),[T,D]=x.useState([]),O=[{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"}],z=async()=>{if(!P&&t)try{F(!0);const a=await m({notificationId:t,...p}),o=a.list.map(c=>({...c,receiverUser:{...c.receiverUser,avatar:st(c.receiverUser.avatar,h,S)}}));U(o),Z(a.paging),F(!1)}catch(a){q.error(a.message),F(!1)}};x.useEffect(()=>{z()},[p]);const _=a=>{a.stopPropagation();const o=a.currentTarget;L.anchorEl=o;const c=o.getBoundingClientRect();L.position={top:c.top+window.scrollY,left:c.left+window.scrollX}},ie=a=>a.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(Ae,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(Pe,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:_,children:r("notification.resend")})}):null,se={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:V.page-1,rowsPerPage:V.pageSize,count:V.total,searchText:p.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:T,onRowSelectionChange:(a,o)=>{D(o.map(c=>c.dataIndex))},customToolbarSelect:ie},J=({page:a,rowsPerPage:o,searchText:c,filterList:C})=>{const[,B=[],G=[],K=[]]=C;p.pageSize!==o?g(W=>({...W,pageSize:o,page:1})):p.page!==a+1?g(W=>({...W,page:a+1})):p.searchText!==c?g(W=>({...W,searchText:c,page:1})):pe(B,p.walletSendStatus)?pe(G,p.pushKitSendStatus)?pe(K,p.emailSendStatus)||g(W=>({...W,emailSendStatus:K,page:1})):g(W=>({...W,pushKitSendStatus:G,page:1})):g(W=>({...W,walletSendStatus:B,page:1}))},oe=x.useCallback(async(a,o)=>{if(!o)return!1;const c=await y(o);return c?a==="wallet"?Gt(c):a==="email"?$t(v,c):a==="pushKit"?Vt(v,c):a==="webhook"?Yt(c):!0:!1},[y,v]),Ne=x.useCallback(a=>Qt(r,a),[r]),f=()=>{M.anchorEl=null,M.position=null,$(null)},u=()=>{L.anchorEl=null,L.position=null},j=async(a,o,c=!0,C="")=>{if(!(!o.length||!a.length))try{s(a,o,c,C),L.anchorEl||(await ge(.5),f())}catch(B){console.error("handleResend error",{error:B})}},I=async({channels:a,isResendFailedOnly:o})=>{const c=T.map(C=>w[C].receiver);await j(a,c,o),await ge(.5),u(),D([])},A=async(a,o=[],c=!0)=>{try{await j(["webhook"],[a.receiver],c,o)}catch(C){q.error(C.response?C.response.statusText:C.message)}},R=async(a,o,c,C=[],B=!0)=>{if(a.stopPropagation(),Xt(o,c)>=4){q.warning(r("notification.resendLimit"));return}if(!Le.includes(c)){await A(o,C,B);return}if(a){const K=a.currentTarget,W=K.getBoundingClientRect();M.anchorEl=K,M.position={top:W.top+window.scrollY,left:W.left+window.scrollX}}$({channel:c});try{const K=await oe(c,o.receiver);await ge(1),$({channel:c,result:K}),(typeof K=="boolean"&&K||Ct(K)&&Object.values(K).every(W=>!!W))&&(await s([c],[o.receiver],B),L.anchorEl||(await ge(.5),f()))}catch(K){q.error(K.message)}},re=a=>{g(o=>({...o,dateRange:a,page:1}))},ne=(a,o,c,C)=>{a.stopPropagation();const B=c.filter(G=>G!==o);g(G=>({...G,[C]:B,page:1}))},le=Q(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:a=>{const{receiverUser:o,receiver:c}=w[a];return o?e.jsxs(N,{"data-cy":`member-name-${o.fullName}`,sx:{display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start"},children:[e.jsx(Ze,{src:`${o.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:c,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(me,{children:o.fullName})]},c):e.jsx(zt,{size:14,responsive:!1,compact:!0,copyable:!1,did:c})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:p.walletSendStatus??[],customFilterListOptions:{render:a=>e.jsx(Se,{list:a,label:"Wallet",onDelete:(o,c)=>{o.stopPropagation(),ne(o,c,le[1].options.filterList,"walletSendStatus")}}),update:ye},filterOptions:{names:O,fullWidth:!0,logic:je,display:(a,o,c,C)=>e.jsx(we,{label:"Wallet",filterList:a,onChange:o,index:c,column:C,filterValues:O})},customBodyRenderLite:a=>{const{walletSendStatus:o,walletSendAt:c,walletSendFailedReason:C}=w[a];return e.jsx(ce,{status:o,updatedAt:c,reason:C,channel:"wallet",onResend:B=>R(B,w[a],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{pushKitSendStatus:o,pushKitSendAt:c,pushKitSendFailedReason:C}=w[a];return e.jsx(ce,{status:o,updatedAt:c,reason:C,channel:"pushkit",onResend:B=>R(B,w[a],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:p.pushKitSendStatus??[],customFilterListOptions:{render:a=>e.jsx(Se,{list:a,label:"Push Kit",onDelete:(o,c)=>{o.stopPropagation(),ne(o,c,le[2].options.filterList,"pushKitSendStatus")}}),update:ye},filterOptions:{names:O,fullWidth:!0,logic:je,display:(a,o,c,C)=>e.jsx(we,{label:"Push Kit",filterList:a,onChange:o,index:c,column:C,filterValues:O})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{emailSendStatus:o,emailSendAt:c,emailSendFailedReason:C}=w[a];return e.jsx(ce,{status:o,updatedAt:c,reason:C,channel:"email",onResend:B=>R(B,w[a],"email",[],!1)})},filter:!0,filterType:"custom",filterList:p.emailSendStatus??[],customFilterListOptions:{render:a=>e.jsx(Se,{list:a,label:"Email",onDelete:(o,c)=>{o.stopPropagation(),ne(o,c,le[3].options.filterList,"emailSendStatus")}}),update:ye},filterOptions:{names:O,fullWidth:!0,logic:je,display:(a,o,c,C)=>e.jsx(we,{label:"Email",filterList:a,onChange:o,index:c,column:C,filterValues:O})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{webhook:o}=w[a];if(!o)return null;const c=Object.entries(o)[0];if(!c)return null;const[C,B]=c,G=B[0];return e.jsx(N,{sx:{display:"flex",flexDirection:"column",gap:1},children:e.jsxs(N,{className:"webhook-item",sx:{fontSize:12},children:[e.jsx(me,{maxLength:30,children:C},C),e.jsx(ce,{status:G.status,updatedAt:G.sendAt,reason:G.failedReason,channel:"webhook",onResend:K=>R(K,w[a],"webhook",[C],!1)})]},C)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:a=>{const{createdAt:o}=w[a];return e.jsx(tt,{value:o,locale:i,shouldUpdate:!0})}}}],[w,i,p,r]),ft=[e.jsx(ze,{value:p.dateRange,onChange:re},"date-picker"),e.jsx(Ae,{variant:"contained",size:"small",color:"primary",loading:P,startIcon:e.jsx(ht,{}),onClick:()=>z(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(N,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(ts,{children:e.jsxs(Qe,{theme:b,children:[e.jsx(Je,{className:"receivers-table",locale:i,loading:P,columns:le,data:w,onChange:J,options:se,customButtons:ft,components:{TableFilterList:a=>e.jsx(We,{...a,itemComponent:o=>e.jsx(Me,{...o,canDelete:()=>!1})})}}),M.anchorEl&&e.jsx(Ee,{open:!!M.anchorEl,anchorReference:"anchorPosition",anchorPosition:M.position,onClose:f,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(ss,{children:[e.jsxs(Y,{variant:"body1",component:"div",className:"check-title",children:[k?.channel," Checking"]}),e.jsx(N,{sx:{display:"flex",flexDirection:"column",gap:"4px"},children:Ne(k?.channel).map(a=>{const{type:o,pass:c,fail:C}=a;return!k?.result||k?.result?.[o]?e.jsxs(Y,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:k?.result?.[o]?be.success.main:"inherit"},children:[k?.result?e.jsx(gt,{}):e.jsx(Ge,{size:12,sx:{color:be.primary.main}}),e.jsx("span",{children:c})]},o):e.jsxs(Y,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:be.error.main},children:[e.jsx(xt,{}),e.jsx("span",{children:C})]},o)})})]})}),L.anchorEl&&e.jsx(Ee,{open:!!L.anchorEl,anchorReference:"anchorPosition",anchorPosition:L.position,onClose:u,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(ct,{loading:n,onCancel:u,onConfirm:I})})]})})})}const es=x.memo(dt),ts=ae.div`
|
|
1
|
+
import{r as x}from"./vendor-react-CTtPmzVP.js";import{j as e,W as d,am as mt,ak as N,T as Y,U as ke,y as Fe,bk as Ve,b$ as Re,bX as Te,a5 as Ie,Q as Ce,dH as Pe,aN as Ee,a6 as Ge,D as Ye,cD as ht,ad as Qe,e5 as gt,e6 as xt,at as ae,b4 as He,n as bt,J as yt,x as jt,bZ as St,M as qe,cB as vt}from"./vendor-mui-core-CKKG_1TN.js";import{e as ee,l as Ct,w as pe}from"./vendor-utils-CUs2ebe7.js";import{W as q,ba as Nt,V as X,dg as wt,m as Xe,Y as Ze,F as Ae,b3 as Je,bE as be,a_ as Rt,bc as Tt,bk as It,bu as Et}from"./vendor-ux-DjXlxcvL.js";import{Z as At,Q as H,c as E,C as Dt,a1 as Ue}from"./index-DI4CWTXR.js";import{a as Q,g as De}from"./vendor-hooks-DQAdyHrE.js";import{S as me}from"./shorten-label-DXFyDHDr.js";import{v as et}from"./index-BSZ3mQac.js";import{R as tt,A as Ot,S as Lt,a as kt,B as Ft}from"./list-BWd3aUjb.js";import{i as Pt,e as _t,N as Bt}from"./team-YWd-FRKh.js";import{W as zt}from"./did-address-Cq16cwTy.js";import{p as st}from"./util-GXkeqbBQ.js";import{D as Wt,g as Mt}from"./traffic-0IuWlrAD.js";import{B as nt}from"./bundle-avatar-2AQWR0ld.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-BCP2x3BR.js";import"./server-logo-notext.svg-BLAdvsmP.js";import"./session-CZpDtsCZ.js";import"./isURL-DMMDDAKA.js";import"./use-app-logo-hIHAHSSI.js";import"./base32-z3esjJBn.js";import"./useAsyncRetry-B_bXUXWM.js";import"./useAsync-D6IP8T2e.js";import"./iframe-CqiUrjUO.js";import"./index-KUC3HPt0.js";import"./index-DBs9Ljax.js";import"./base-chart-DT--nPCU.js";import"./index-CaQuyP_U.js";import"./vendor-mui-x-DHGvg6Bj.js";import"./AdapterDayjs-C1bdndja.js";const at=x.createContext({}),{Provider:Kt,Consumer:Hs}=at;function Ht({children:t,blocklet:s=""}){const{api:n,inService:r,ws:{useSubscription:i}}=At(),[l,b]=x.useState([]),[m,S]=x.useState({total:0,pageSize:20,pageCount:0,page:1}),h=Q(()=>s.meta?.did,[s]),[y,v]=x.useState([]),[P,F]=x.useState({}),w=Q(()=>l.length?new Set(l.map(p=>p.id)):new Set,[l]),U=async({page:p=1,pageSize:g=20,...T}={})=>{if(!h)return[];try{const D={paging:{page:p,pageSize:g},...T,teamDid:h,dateRange:T.dateRange?[H(T.dateRange[0]).toISOString(),H(T.dateRange[1]).toISOString()]:void 0},{dids:O,...z}=D;let _="";O&&O.includes("system")&&(_="system");const ie=O?O.filter(oe=>oe!=="system"):[],se={...z,source:_,componentDids:ie},J=await n.getNotificationSendLog({input:se});return F(se),b(J.list),S(J.paging),J.list}catch(D){return q.error(D.message),[]}},M=async()=>{const p=await n.getNotificationComponents({input:{teamDid:h}});v(p.componentDids)},L=x.useCallback(p=>{const g=s.children.find(T=>T.meta?.did===p);if(g)return g.ancestors=[s],g},[s]),k=async({notificationId:p,receivers:g,channels:T,...D})=>{await n.resendNotification({input:{teamDid:h,notificationId:p,receivers:g,channels:T.map(O=>O==="wallet"?E.NOTIFICATION_SEND_CHANNEL.WALLET:O==="pushKit"?E.NOTIFICATION_SEND_CHANNEL.PUSH:O),...D}})},$=x.useCallback(async p=>(await n.getUser({input:{teamDid:h,user:{did:p},options:{enableConnectedAccount:!0}}})).user,[n,h]),V=x.useCallback(async({page:p=1,pageSize:g=20,...T}={})=>{try{const D={paging:{page:p,pageSize:g},...T,userName:T.searchText||"",teamDid:h,dateRange:T.dateRange?[H(T.dateRange[0]).toISOString(),H(T.dateRange[1]).toISOString()]:void 0};return await n.getReceivers({input:D})}catch(D){throw q.error(D.message),D}},[n,h]);x.useEffect(()=>{h&&M()},[h]),i(E.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,p=>{w.has(p.notificationId)&&U(P)},[w,P]),i(E.EVENTS.NOTIFICATION_BLOCKLET_CREATE,p=>{w.has(p.id)||U(P)},[w,P]);const Z={fetch:U,data:l,paging:m,blocklet:s,getComponent:L,resendNotification:k,getUser:$,componentDids:y,getReceivers:V,inService:r,teamDid:h};return e.jsx(Kt,{value:{notificationRecords:Z},children:t})}function _e(){const{notificationRecords:t}=x.useContext(at);return t}he.propTypes={severity:d.oneOf(Object.values(["info","success","error","warning"])).isRequired};const qt={info:"primary",success:"success",error:"error",warning:"warning"};function he({severity:t="info"}){return e.jsx(Nt,{type:qt[t],children:t})}const Ut=(t,s,n="")=>{if(!n||!s)return"";switch(n){case E.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:s});case E.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:s});case E.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:s});case E.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return n}};function it(t,s,n={}){const{status:r,updatedAt:i,reason:l="",channel:b="wallet"}=n,m=i?t("notification.sendStatus.sentTime",{date:Dt(i,s)}):"",S=Ut(t,b,l);return r===E.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:m,reason:S}:r===E.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:m}:{status:"pending",title:t("notification.sendStatus.pending"),reason:S,sentTime:m}}const Oe={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Le=["wallet","pushKit","email"],$e=["info","success","error","warning"],ot=t=>{const{settings:s}=t;return s?.notification?.email?.enabled},rt=t=>{const{settings:s}=t;return s?.notification?.pushKit?.enabled},$t=(t,s)=>{const n=ee(s,"extra.notifications.email",!0);return{available:ot(t),enabled:n}},Vt=(t,s)=>{const n=ee(s,"extra.notifications.push",!0);return{available:rt(t),enabled:n}},Gt=t=>({enabled:ee(t,"extra.notifications.wallet",!0)}),Yt=t=>({enabled:ee(t,"extra.webhooks",[]).length>0}),ge=(t=3)=>new Promise(s=>{setTimeout(()=>{s()},t*1e3)}),Qt=(t,s)=>s==="wallet"||s==="webhook"?[{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:s==="pushKit"||s==="email"?[{channel:s,type:"available",pass:t("notification.sendStatus.reason.available",{channel:s}),fail:t("notification.sendStatus.reason.unavailable",{channel:s})},{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:[],xe=(t=[])=>{const s=H().startOf("day");return t.filter(n=>H(n.sendAt).isSame(s,"day")).length},Xt=(t,s="")=>{if(s&&Le.includes(s)){const l=`${s}SendRecord`,b=ee(t,l,[]);return xe(b)}const n=ee(t,"webhook",{}),r=Object.keys(n??{})??[];if(s&&r.includes(s)){const l=n[s]??[];return xe(l)}const i={};return Le.forEach(l=>{const b=`${l}SendRecord`,m=ee(t,b,[]),S=xe(m);i[l]=S}),r.length>0&&r.forEach(l=>{const b=n[l]??[],m=xe(b);i[l]=m}),i},ye=(t,s,n)=>{if(!Array.isArray(t))throw new Error("Invalid filterList or index");return t[n].splice(s,1),t},je=(t,s)=>{if(!Array.isArray(s))throw new Error("filters must be an array");return s.length?!s.includes(t):!1},Zt=t=>{switch(t){case E.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case E.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case E.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case E.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 te({config:t,enableTooltip:s=!0,showTitle:n=!1,children:r=null}){const{status:i,title:l="",sentTime:b="",reason:m=""}=t,S=[l,m].filter(Boolean).join(", ");return e.jsx(mt,{title:s?e.jsxs(e.Fragment,{children:[e.jsx(Y,{color:"inherit",sx:{fontSize:12},children:S}),e.jsx("span",{children:b})]}):null,arrow:!0,placement:"top",children:e.jsxs(N,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(N,{sx:{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx(N,{style:{opacity:.15},sx:{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Oe[i]}}),e.jsx(N,{sx:{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Oe[i]}})]}),e.jsx(Y,{color:"inherit",sx:{fontSize:12},children:n?l:r})]})})}te.propTypes={config:d.object.isRequired,enableTooltip:d.bool,showTitle:d.bool,children:d.node};Se.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};function Se({list:t,label:s,onDelete:n=()=>{}}){const{t:r,locale:i}=X();return e.jsxs(N,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsxs(Y,{children:[s,": "]}),t.map(l=>{const b=it(r,i,{status:l});return e.jsx(ke,{size:"small",label:e.jsx(N,{sx:{display:"flex",alignItems:"center",gap:"4px"},children:e.jsx(te,{config:b,enableTooltip:!1,children:b.title})}),onDelete:m=>n(m,l)},l)})]})}Be.propTypes={filterList:d.array.isRequired,onChange:d.func.isRequired,index:d.number.isRequired,column:d.object.isRequired,filterValues:d.array.isRequired,label:d.string.isRequired,renderLabel:d.func.isRequired};function Be({filterList:t,onChange:s,index:n,column:r,filterValues:i,label:l,renderLabel:b}){return e.jsxs(Fe,{className:"filter-container",children:[e.jsx(Ve,{component:"legend",children:l}),e.jsx(Re,{row:!0,children:i.map(m=>e.jsx(Te,{control:e.jsx(Ie,{checked:t[n].indexOf(m.value??m)>-1,onChange:S=>{const h=[...t];S.target.checked?h[n]=[...h[n],m.value??m]:h[n]=h[n].filter(y=>y!==(m.value??m)),s(h[n],n,r)},name:m.value??m}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:b(m)})},m.value??m))})]})}function we(t){return e.jsx(Be,{...t,renderLabel:s=>e.jsx(te,{enableTooltip:!1,config:{status:s.status},children:s.label})})}ce.propTypes={status:d.number.isRequired,updatedAt:d.string.isRequired,reason:d.string,channel:d.string,onResend:d.func};function ce({status:t,updatedAt:s,reason:n="",channel:r="wallet",onResend:i}){const{t:l,locale:b}=X(),m=it(l,b,{status:t,updatedAt:s,reason:n,channel:r});return e.jsxs(N,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(te,{config:m,showTitle:!0}),m.status!=="success"&&e.jsx(Ce,{className:"resend-btn",size:"small",startIcon:e.jsx(Pe,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:i,children:l("notification.resend")})]})}ze.propTypes={value:d.array.isRequired,onChange:d.func};function ze({value:t,onChange:s}){const{locale:n}=X(),r=H().toDate(),[i,l]=x.useState(null),b=x.useCallback(h=>{l(i?null:h.currentTarget)},[i]),m=!!i,S=x.useCallback(h=>{if(!h.startDate||!h.endDate){q.error("Please select a date range");return}if(H(h.startDate).isAfter(h.endDate)||!H(h.startDate).isValid()||!H(h.endDate).isValid()){q.error("Invalid date range");return}s([h.startDate,h.endDate]),l(null)},[s]);return e.jsxs("div",{children:[e.jsx(Y,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},sx:{mb:0},children:e.jsxs(Ce,{onClick:b,variant:"outlined",size:"small",color:"inherit",children:[Ue(t[0],n)," - ",Ue(t[1],n)]})}),e.jsx(Ee,{open:m,anchorEl:i,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(Wt,{open:!0,maxDate:r,initialDateRange:{startDate:t[0],endDate:t[1]},toggle:b,definedRanges:Mt(r),onChange:S})})]})}We.propTypes={itemComponent:d.elementType.isRequired};function We({itemComponent:t,...s}){const{t:n}=X();return!s?.filterList?.filter(i=>i.length).length?null:e.jsxs(N,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsx("div",{className:"toolbar-filter-title",children:n("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(wt.TableFilterList,{...s,ItemComponent:t})})]})}function Me({label:t,onDelete:s,canDelete:n=()=>!0,...r}){const i=s&&typeof s=="function"?s:void 0;let l=!0;return n&&typeof n=="function"&&(l=n({label:t,...r})),e.jsx(ke,{label:t,variant:"outlined",...i&&l?{onDelete:i}:{}})}Me.propTypes={label:d.string.isRequired,onDelete:d.func,canDelete:d.func};const Jt=[{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}];ct.propTypes={loading:d.bool,onCancel:d.func,onConfirm:d.func};function ct({loading:t=!1,onCancel:s=()=>{},onConfirm:n=()=>{}}){const{t:r}=X(),[i,l]=x.useState(Jt),[b,m]=x.useState(!0),S=(y,v)=>{v.checked=y.target.checked;const P=i.map(F=>({...F,checked:F.value===v.value?v.checked:F.checked}));l(P)},h=y=>{y.stopPropagation(),n({channels:i.filter(v=>v.checked).map(v=>v.value),isResendFailedOnly:b})};return e.jsxs(N,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(Y,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(N,{className:"choose-channel",children:e.jsxs(Fe,{component:"fieldset",variant:"standard",children:[e.jsx(Ve,{component:"legend",children:r("notification.selectChannels")}),e.jsx(Re,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:i.map(y=>e.jsx(Te,{control:e.jsx(Ie,{checked:y.checked,onChange:v=>S(v,y),name:y.value}),label:y.label},y.value))})]})}),e.jsx(N,{className:"resend-config-footer",children:e.jsx(Re,{children:e.jsx(Te,{control:e.jsx(Ie,{checked:b,onChange:y=>m(y.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(N,{className:"resend-config-footer-tip",sx:{display:"flex",justifyContent:"flex-end",gap:1},children:[e.jsx(Ce,{onClick:y=>{y.stopPropagation(),s()},color:"inherit",children:r("common.cancel")}),e.jsxs(Ce,{onClick:h,color:"primary",disabled:t,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[t&&e.jsx(Ge,{size:16}),r("common.confirm")]})]})]})}dt.propTypes={notificationId:d.string.isRequired,handleResend:d.func,resending:d.bool};function dt({notificationId:t,handleResend:s,resending:n=!1}){const{t:r,locale:i}=X(),l=Ye(),b=x.useMemo(()=>Xe(l,lt()),[l]),{getReceivers:m,inService:S,teamDid:h,getUser:y,blocklet:v}=_e(),[P,F]=x.useState(!1),[w,U]=x.useState([]),M=De({anchorEl:null,position:null}),L=De({anchorEl:null,position:null}),[k,$]=x.useState(null),[V,Z]=x.useState({total:0,pageSize:10,pageCount:0,page:1}),[p,g]=x.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[H().subtract(1,"month").startOf("day").toDate(),H().endOf("day").toDate()]}),[T,D]=x.useState([]),O=[{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"}],z=async()=>{if(!P&&t)try{F(!0);const a=await m({notificationId:t,...p}),o=a.list.map(c=>({...c,receiverUser:{...c.receiverUser,avatar:st(c.receiverUser.avatar,h,S)}}));U(o),Z(a.paging),F(!1)}catch(a){q.error(a.message),F(!1)}};x.useEffect(()=>{z()},[p]);const _=a=>{a.stopPropagation();const o=a.currentTarget;L.anchorEl=o;const c=o.getBoundingClientRect();L.position={top:c.top+window.scrollY,left:c.left+window.scrollX}},ie=a=>a.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(Ae,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(Pe,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:_,children:r("notification.resend")})}):null,se={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:V.page-1,rowsPerPage:V.pageSize,count:V.total,searchText:p.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:T,onRowSelectionChange:(a,o)=>{D(o.map(c=>c.dataIndex))},customToolbarSelect:ie},J=({page:a,rowsPerPage:o,searchText:c,filterList:C})=>{const[,B=[],G=[],K=[]]=C;p.pageSize!==o?g(W=>({...W,pageSize:o,page:1})):p.page!==a+1?g(W=>({...W,page:a+1})):p.searchText!==c?g(W=>({...W,searchText:c,page:1})):pe(B,p.walletSendStatus)?pe(G,p.pushKitSendStatus)?pe(K,p.emailSendStatus)||g(W=>({...W,emailSendStatus:K,page:1})):g(W=>({...W,pushKitSendStatus:G,page:1})):g(W=>({...W,walletSendStatus:B,page:1}))},oe=x.useCallback(async(a,o)=>{if(!o)return!1;const c=await y(o);return c?a==="wallet"?Gt(c):a==="email"?$t(v,c):a==="pushKit"?Vt(v,c):a==="webhook"?Yt(c):!0:!1},[y,v]),Ne=x.useCallback(a=>Qt(r,a),[r]),f=()=>{M.anchorEl=null,M.position=null,$(null)},u=()=>{L.anchorEl=null,L.position=null},j=async(a,o,c=!0,C="")=>{if(!(!o.length||!a.length))try{s(a,o,c,C),L.anchorEl||(await ge(.5),f())}catch(B){console.error("handleResend error",{error:B})}},I=async({channels:a,isResendFailedOnly:o})=>{const c=T.map(C=>w[C].receiver);await j(a,c,o),await ge(.5),u(),D([])},A=async(a,o=[],c=!0)=>{try{await j(["webhook"],[a.receiver],c,o)}catch(C){q.error(C.response?C.response.statusText:C.message)}},R=async(a,o,c,C=[],B=!0)=>{if(a.stopPropagation(),Xt(o,c)>=4){q.warning(r("notification.resendLimit"));return}if(!Le.includes(c)){await A(o,C,B);return}if(a){const K=a.currentTarget,W=K.getBoundingClientRect();M.anchorEl=K,M.position={top:W.top+window.scrollY,left:W.left+window.scrollX}}$({channel:c});try{const K=await oe(c,o.receiver);await ge(1),$({channel:c,result:K}),(typeof K=="boolean"&&K||Ct(K)&&Object.values(K).every(W=>!!W))&&(await s([c],[o.receiver],B),L.anchorEl||(await ge(.5),f()))}catch(K){q.error(K.message)}},re=a=>{g(o=>({...o,dateRange:a,page:1}))},ne=(a,o,c,C)=>{a.stopPropagation();const B=c.filter(G=>G!==o);g(G=>({...G,[C]:B,page:1}))},le=Q(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:a=>{const{receiverUser:o,receiver:c}=w[a];return o?e.jsxs(N,{"data-cy":`member-name-${o.fullName}`,sx:{display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start"},children:[e.jsx(Ze,{src:`${o.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:c,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(me,{children:o.fullName})]},c):e.jsx(zt,{size:14,responsive:!1,compact:!0,copyable:!1,did:c})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:p.walletSendStatus??[],customFilterListOptions:{render:a=>e.jsx(Se,{list:a,label:"Wallet",onDelete:(o,c)=>{o.stopPropagation(),ne(o,c,le[1].options.filterList,"walletSendStatus")}}),update:ye},filterOptions:{names:O,fullWidth:!0,logic:je,display:(a,o,c,C)=>e.jsx(we,{label:"Wallet",filterList:a,onChange:o,index:c,column:C,filterValues:O})},customBodyRenderLite:a=>{const{walletSendStatus:o,walletSendAt:c,walletSendFailedReason:C}=w[a];return e.jsx(ce,{status:o,updatedAt:c,reason:C,channel:"wallet",onResend:B=>R(B,w[a],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{pushKitSendStatus:o,pushKitSendAt:c,pushKitSendFailedReason:C}=w[a];return e.jsx(ce,{status:o,updatedAt:c,reason:C,channel:"pushkit",onResend:B=>R(B,w[a],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:p.pushKitSendStatus??[],customFilterListOptions:{render:a=>e.jsx(Se,{list:a,label:"Push Kit",onDelete:(o,c)=>{o.stopPropagation(),ne(o,c,le[2].options.filterList,"pushKitSendStatus")}}),update:ye},filterOptions:{names:O,fullWidth:!0,logic:je,display:(a,o,c,C)=>e.jsx(we,{label:"Push Kit",filterList:a,onChange:o,index:c,column:C,filterValues:O})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{emailSendStatus:o,emailSendAt:c,emailSendFailedReason:C}=w[a];return e.jsx(ce,{status:o,updatedAt:c,reason:C,channel:"email",onResend:B=>R(B,w[a],"email",[],!1)})},filter:!0,filterType:"custom",filterList:p.emailSendStatus??[],customFilterListOptions:{render:a=>e.jsx(Se,{list:a,label:"Email",onDelete:(o,c)=>{o.stopPropagation(),ne(o,c,le[3].options.filterList,"emailSendStatus")}}),update:ye},filterOptions:{names:O,fullWidth:!0,logic:je,display:(a,o,c,C)=>e.jsx(we,{label:"Email",filterList:a,onChange:o,index:c,column:C,filterValues:O})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{webhook:o}=w[a];if(!o)return null;const c=Object.entries(o)[0];if(!c)return null;const[C,B]=c,G=B[0];return e.jsx(N,{sx:{display:"flex",flexDirection:"column",gap:1},children:e.jsxs(N,{className:"webhook-item",sx:{fontSize:12},children:[e.jsx(me,{maxLength:30,children:C},C),e.jsx(ce,{status:G.status,updatedAt:G.sendAt,reason:G.failedReason,channel:"webhook",onResend:K=>R(K,w[a],"webhook",[C],!1)})]},C)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:a=>{const{createdAt:o}=w[a];return e.jsx(tt,{value:o,locale:i,shouldUpdate:!0})}}}],[w,i,p,r]),ft=[e.jsx(ze,{value:p.dateRange,onChange:re},"date-picker"),e.jsx(Ae,{variant:"contained",size:"small",color:"primary",loading:P,startIcon:e.jsx(ht,{}),onClick:()=>z(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(N,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(ts,{children:e.jsxs(Qe,{theme:b,children:[e.jsx(Je,{className:"receivers-table",locale:i,loading:P,columns:le,data:w,onChange:J,options:se,customButtons:ft,components:{TableFilterList:a=>e.jsx(We,{...a,itemComponent:o=>e.jsx(Me,{...o,canDelete:()=>!1})})}}),M.anchorEl&&e.jsx(Ee,{open:!!M.anchorEl,anchorReference:"anchorPosition",anchorPosition:M.position,onClose:f,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(ss,{children:[e.jsxs(Y,{variant:"body1",component:"div",className:"check-title",children:[k?.channel," Checking"]}),e.jsx(N,{sx:{display:"flex",flexDirection:"column",gap:"4px"},children:Ne(k?.channel).map(a=>{const{type:o,pass:c,fail:C}=a;return!k?.result||k?.result?.[o]?e.jsxs(Y,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:k?.result?.[o]?be.success.main:"inherit"},children:[k?.result?e.jsx(gt,{}):e.jsx(Ge,{size:12,sx:{color:be.primary.main}}),e.jsx("span",{children:c})]},o):e.jsxs(Y,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:be.error.main},children:[e.jsx(xt,{}),e.jsx("span",{children:C})]},o)})})]})}),L.anchorEl&&e.jsx(Ee,{open:!!L.anchorEl,anchorReference:"anchorPosition",anchorPosition:L.position,onClose:u,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(ct,{loading:n,onCancel:u,onConfirm:I})})]})})})}const es=x.memo(dt),ts=ae.div`
|
|
2
2
|
td.MuiTableCell-footer {
|
|
3
3
|
border: none !important;
|
|
4
4
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as b,g as We,a as $e}from"./vendor-react-CTtPmzVP.js";import{g as qe,p as V}from"./vendor-hooks-DQAdyHrE.js";import{j as e,ak as t,at as $,b6 as Y,a6 as F,aZ as Ue,am as G,br as He,U as Ge,T as B,a3 as Ye,W as S,z as O,M as J,I as _,dZ as ge,bi as je,A as Ke,x as Ze,cs as Ve,ct as ee,ca as Je,F as Qe,bZ as Xe,s as es}from"./vendor-mui-core-CKKG_1TN.js";import{V as A,a_ as W,bc as ss,b3 as ae,bk as se,W as D,F as N,b2 as re,bM as ye,bL as ts,j as as,ba as rs,bu as os}from"./vendor-ux-DjXlxcvL.js";import{Z as P,C as ns,Q as be,c as M,G as X,Y as is,q as ls,J as cs,f as Z,cE as ds}from"./index-
|
|
1
|
+
import{r as b,g as We,a as $e}from"./vendor-react-CTtPmzVP.js";import{g as qe,p as V}from"./vendor-hooks-DQAdyHrE.js";import{j as e,ak as t,at as $,b6 as Y,a6 as F,aZ as Ue,am as G,br as He,U as Ge,T as B,a3 as Ye,W as S,z as O,M as J,I as _,dZ as ge,bi as je,A as Ke,x as Ze,cs as Ve,ct as ee,ca as Je,F as Qe,bZ as Xe,s as es}from"./vendor-mui-core-CKKG_1TN.js";import{V as A,a_ as W,bc as ss,b3 as ae,bk as se,W as D,F as N,b2 as re,bM as ye,bL as ts,j as as,ba as rs,bu as os}from"./vendor-ux-DjXlxcvL.js";import{Z as P,C as ns,Q as be,c as M,G as X,Y as is,q as ls,J as cs,f as Z,cE as ds}from"./index-DI4CWTXR.js";import{W as oe}from"./did-address-Cq16cwTy.js";import{b as z}from"./team-YWd-FRKh.js";import{r as ne,a as ie,b as le,c as ve,d as Q,e as ps,u as us,f as ms}from"./passport-item-D53yZ-cF.js";import{p as Se}from"./util-GXkeqbBQ.js";import{u as fs}from"./use-mobile-_vjPRYx2.js";import{O as H}from"./index-BB8sYq-N.js";import{w as q,P as xs}from"./permission-DC8i_y8F.js";import{C as hs}from"./Google-BI3aC5vK.js";import{c as gs}from"./create-passport-svg-DeDfPZeD.js";import{A as js}from"./vendor-arcblock-BCP2x3BR.js";import{D as K,aC as ys}from"./vendor-utils-CUs2ebe7.js";import{e as Ce}from"./edit.svg-CTE5eATX.js";import{h as ce,b as bs}from"./index-WjASWJcO.js";import{C as Te}from"./confirm-Ch-CAgUO.js";import{L as we}from"./list-header-wJF4c6BN.js";import{f as te}from"./index-DBs9Ljax.js";import{u as vs}from"./useSetState-L-f8mSga.js";import"./lottie-web-4koyQiv_.js";import"./session-CZpDtsCZ.js";import"./isURL-DMMDDAKA.js";import"./use-app-logo-hIHAHSSI.js";import"./ua-parser-DP5omx3I.js";import"./base32-z3esjJBn.js";import"./cloneDeep-rgNCMFod.js";import"./lock.svg-CiT4rEpi.js";const me="info";function Ie({createPassportSvg:c,passport:s,onCancel:p,onSwitchPassport:u=()=>{}}){const{t:f}=A(),i=qe({tab:me}),d={info:{label:f("common.basicInfo"),value:me,component:()=>e.jsx(De,{passport:s,createPassportSvg:c})},logs:{label:f("common.logs"),value:"logs",component:()=>e.jsx(Re,{passport:s})},related:{label:f("team.passport.related"),value:"related",component:()=>e.jsx(Ae,{passport:s,onSwitchPassport:u})}},l=Object.values(d).map(({label:h,value:m})=>({label:h,value:m})).filter(h=>h.value==="related"?s.parentDid:!0),r=d[i.tab]||d.info,n=h=>{i.tab=h};return e.jsx(W,{title:f("common.passport"),onClose:p,open:!0,PaperProps:{style:{maxWidth:800,minHeight:"80vh"}},fullWidth:!0,children:e.jsxs(Ss,{children:[e.jsx(t,{className:"tabs",children:e.jsx(ss,{tabs:l,current:i.tab,onChange:n,scrollButtons:"auto"})}),e.jsx(t,{className:"body",children:e.jsx(r.component,{})})]})})}Ie.propTypes={createPassportSvg:S.func.isRequired,passport:S.object.isRequired,onCancel:S.func.isRequired,onSwitchPassport:S.func};const Ss=$(t)`
|
|
2
2
|
margin-top: -16px;
|
|
3
3
|
|
|
4
4
|
.tabs {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as p}from"./vendor-react-CTtPmzVP.js";import{j as a,y as b,W as t,z as y,M as E,ak as I}from"./vendor-mui-core-CKKG_1TN.js";import{a as j}from"./vendor-hooks-DQAdyHrE.js";import{Q as r}from"./index-
|
|
1
|
+
import{r as p}from"./vendor-react-CTtPmzVP.js";import{j as a,y as b,W as t,z as y,M as E,ak as I}from"./vendor-mui-core-CKKG_1TN.js";import{a as j}from"./vendor-hooks-DQAdyHrE.js";import{Q as r}from"./index-DI4CWTXR.js";import{V as A}from"./vendor-ux-DjXlxcvL.js";import{t as C}from"./arrow-down.svg-7ME6T1BL.js";import{L as O,D as H}from"./vendor-mui-x-DHGvg6Bj.js";import{A as R}from"./AdapterDayjs-C1bdndja.js";function v({value:s=null,onChange:i,error:l=!1,helperText:c="",label:h="",timezone:e="",minDateTime:f=null}){const d=j(()=>{let n=r();return s&&(n=e?r(s).tz(e):r(s)),n},[s,e]),m=n=>{const T=e?r(n).tz(e):r(n);i(new Date(T.format("YYYY-MM-DD HH:mm:00")))};return a.jsx(O,{dateAdapter:R,children:a.jsx(b,{fullWidth:!0,error:l,children:a.jsx(H,{label:h,minDateTime:f,value:d,onChange:m,slotProps:{textField:{error:l,helperText:l?c:""}},format:"YYYY-MM-DD HH:mm"})})})}v.propTypes={value:t.oneOfType([t.string,t.instanceOf(Date)]),onChange:t.func.isRequired,error:t.bool,helperText:t.string,label:t.string,timezone:t.string,minDateTime:t.instanceOf(Date)};function U(s){return a.jsx(C,{...s,width:20,height:20})}const u={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 $({placeholder:s="",value:i="",onChange:l,timezone:c="",showError:h=!0}){const{t:e}=A(),[f,d]=p.useState(i||""),[m,n]=p.useState(null),[T,Y]=p.useState(null),x=p.useMemo(()=>[{value:u.MINUTES_30,label:`30 ${e("common.minutes")}`},{value:u.HOUR_1,label:`1 ${e("common.hour")}`},{value:u.HOURS_3,label:`3 ${e("common.hours")}`},{value:u.DAY_1,label:`1 ${e("common.day")}`},{value:u.DAYS_7,label:`7 ${e("common.days")}`},{value:u.DAYS_30,label:`30 ${e("common.days")}`},{value:"custom",label:e("common.custom")}],[e]),M=o=>{if(d(o),o==="custom"){const D=c?r().tz(c):r(),S=D.add(1,"day").toDate();Y(D),n(S),l(S)}else l(new Date(Date.now()+o))},_=o=>{n(o),l(o)};p.useEffect(()=>{i&&(x.find(D=>r(D.value).isSame(i))||(d("custom"),n(i)))},[]);const g=j(()=>h?!!(!m||r(m).isBefore(r())):!1,[m,e]);return a.jsxs(a.Fragment,{children:[a.jsx(b,{fullWidth:!0,children:a.jsx(y,{select:!0,value:f,label:s||e("team.passport.passportExpireTime"),onChange:o=>M(o.target.value),variant:"outlined",slotProps:{select:{IconComponent:U}},sx:{"& .MuiInputLabel-root":{width:"calc(100% - 46px)"}},children:x.map(o=>a.jsx(E,{value:o.value,children:o.label},o.value))})}),f==="custom"&&a.jsx(I,{children:a.jsx(v,{value:m,onChange:_,label:e("team.passport.customExpireTime"),timezone:c,error:!!g,helperText:g?e("team.passport.customExpireTimeIsInvalid"):void 0,minDateTime:T})})]})}$.propTypes={value:t.oneOfType([t.string,t.instanceOf(Date)]),onChange:t.func.isRequired,timezone:t.string,placeholder:t.string,showError:t.bool};export{$ as T};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{V as te,W as _,F as N,b9 as de,bc as me}from"./vendor-ux-DjXlxcvL.js";import{g as fe,r as F,j as he}from"./vendor-react-CTtPmzVP.js";import{g as re,b as f,a as pe}from"./vendor-hooks-DQAdyHrE.js";import{j as e,ak as w,z as j,bX as $,bn as J,y as b,am as xe,e7 as ve,cZ as je,at as ie,b6 as ne,T as Y}from"./vendor-mui-core-CKKG_1TN.js";import{x as ae,F as be,z as ge}from"./vendor-utils-CUs2ebe7.js";import{u as se,C as x}from"./index.esm-Co8ZxFyk.js";import{aN as ye,Z as oe,Y as le,aB as ce,aS as U,c as we}from"./index-DI4CWTXR.js";import{i as Z}from"./isURL-DMMDDAKA.js";import{S as v}from"./section-CenHBXqj.js";import{A as Re,a as ke,b as Te}from"./collapse-D72lnPa9.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-BCP2x3BR.js";import"./required-DHjZE3-Y.js";var W={exports:{}},z={exports:{}},A={exports:{}},Q;function Se(){return Q||(Q=1,function(c,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=t;function t(h){return h==null}c.exports=n.default,c.exports.default=n.default}(A,A.exports)),A.exports}var G;function Ee(){return G||(G=1,function(c,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=S;var t=R(ye()),h=R(Se());function R(m){return m&&m.__esModule?m:{default:m}}var u=/^(?:[-+]?(?:0|[1-9][0-9]*))$/,p=/^[-+]?[0-9]+$/;function S(m,l){(0,t.default)(m),l=l||{};var d=l.allow_leading_zeroes===!1?u:p,i=!l.hasOwnProperty("min")||(0,h.default)(l.min)||m>=l.min,q=!l.hasOwnProperty("max")||(0,h.default)(l.max)||m<=l.max,I=!l.hasOwnProperty("lt")||(0,h.default)(l.lt)||m<l.lt,o=!l.hasOwnProperty("gt")||(0,h.default)(l.gt)||m>l.gt;return d.test(m)&&i&&q&&I&&o}c.exports=n.default,c.exports.default=n.default}(z,z.exports)),z.exports}var ee;function Ce(){return ee||(ee=1,function(c,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=R;var t=h(Ee());function h(u){return u&&u.__esModule?u:{default:u}}function R(u){return(0,t.default)(u,{allow_leading_zeroes:!1,min:0,max:65535})}c.exports=n.default,c.exports.default=n.default}(W,W.exports)),W.exports}var Pe=Ce();const _e=fe(Pe),V={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:"",companyName:"",companyLink:"",companyAddress:"",supportEmail:""};function qe(){const{api:c}=oe(),{blocklet:n}=le(),{t}=te(),{confirmApi:h,confirmHolder:R}=ce(),[u,p]=F.useState(!1),S=n?.meta?.did,m=Object.assign({...V},n?.settings?.notification?.email||{}),{handleSubmit:l,control:d,formState:i,watch:q,reset:I}=se({defaultValues:ae(m,Object.keys(V))}),o=re({testReceiver:"",testReceiverError:""}),a=q("enabled"),K=f(async(r,k,P=!0)=>{try{p(!0);const{blocklet:T}=await c.configNotification({input:{did:S,notification:JSON.stringify({email:r})}}),ue=Object.assign({...V},T?.settings?.notification?.email||{});I(ue),P&&_.success(t("common.saveSuccess"))}catch(T){if(P)_.error(T.message||t("common.saveFailed"));else throw T}finally{p(!1)}}),L=f(async(r,k,P)=>{try{p(!0),i.isDirty&&await K(r,k,!1),await c.sendEmail({input:{did:S,receiver:P,email:JSON.stringify({body:"Your SMTP configuration is correct!",title:"Test email",type:"notification",attachments:[{type:"link",data:{url:"https://community.arcblock.io",title:"Community",image:"https://community.arcblock.io/.well-known/service/blocklet/logo-rect-dark",utm:{campaign:"test-campaign"}}}],utm:{content:"test-email-button"}})}}),_.success(t("notification.email.testSuccess"))}catch(T){_.error(T.message||t("notification.email.testfailed"))}finally{p(!1)}}),B=f((r,k)=>{o.testReceiver=localStorage.getItem("test-receiver")||"",o.testReceiverError="",h.open({title:t("notification.email.testSendEmail"),content:()=>e.jsx(w,{sx:{width:"300px"},children:e.jsx(j,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:t("notification.email.inputTestReceiver"),value:o.testReceiver,onChange:P=>{o.testReceiver=P.target.value},error:!!o.testReceiverError,helperText:o.testReceiverError||" "})}),confirmButtonText:t("common.confirm"),cancelButtonText:t("common.cancel"),async onConfirm(P){const T=o.testReceiver?.trim();if(!T){o.testReceiverError=t("notification.email.receiverRequired");return}if(!U(T)){o.testReceiverError=t("notification.email.receiverInvalid");return}o.testReceiverError="",await L(r,k,T),P()},onCancel:()=>{p(!1)}})}),D=f(r=>{const k=r?.trim();return k?U(k)?!0:t("notification.email.fromInvalid"):t("notification.email.fromRequired")}),M=f(r=>{const k=r?.trim();return k?Z(k,{require_host:!1,protocols:[]})?!0:t("notification.email.hostInvalid"):t("notification.email.hostRequired")}),s=f(r=>r?_e(r)?!0:t("notification.email.portInvalid"):t("notification.email.portRequired")),E=f(r=>r?.trim()?!0:t("notification.email.userRequired")),g=f(r=>r?.trim()?!0:t("notification.email.passwordRequired")),C=f(r=>r?.trim()&&!Z(r,{protocols:["http","https"],require_protocol:!0})?t("notification.email.linkInvalid"):!0),O=f(r=>r?.trim()&&!U(r)?t("notification.email.emailInvalid"):!0),y=f(()=>!0);return e.jsxs(w,{children:[e.jsxs(Ie,{component:"form",onSubmit:l(K),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(v,{title:t("notification.email.enable"),my:2.5,children:e.jsx(x,{name:"enabled",control:d,render:({field:r})=>e.jsx($,{control:e.jsx(J,{checked:r.value,...r})})})}),e.jsx(v,{title:t("notification.email.from"),children:e.jsx(x,{name:"from",control:d,rules:{validate:a?D:y},render:({field:r})=>e.jsx(b,{fullWidth:!0,children:e.jsx(j,{...r,size:"small",required:!0,label:t("notification.email.from"),error:!!i.errors[r.name],helperText:i.errors[r.name]?.message||" ",disabled:!a})})})}),e.jsx(v,{title:t("notification.email.host"),children:e.jsx(x,{name:"host",control:d,rules:{validate:a?M:y},render:({field:r})=>e.jsx(b,{fullWidth:!0,children:e.jsx(j,{...r,size:"small",required:!0,error:!!i.errors[r.name],label:t("notification.email.host"),helperText:i.errors[r.name]?.message||" ",disabled:!a})})})}),e.jsx(v,{title:t("notification.email.port"),children:e.jsx(x,{name:"port",control:d,rules:{validate:a?s:y},render:({field:r})=>e.jsx(b,{fullWidth:!0,children:e.jsx(j,{...r,size:"small",required:!0,type:"number",error:!!i.errors[r.name],label:t("notification.email.port"),helperText:i.errors[r.name]?.message||" ",disabled:!a})})})}),e.jsx(v,{title:t("notification.email.user"),children:e.jsx(x,{name:"user",control:d,rules:{validate:a?E:y},render:({field:r})=>e.jsx(b,{fullWidth:!0,children:e.jsx(j,{...r,size:"small",required:!0,error:!!i.errors[r.name],label:t("notification.email.user"),helperText:i.errors[r.name]?.message||" ",disabled:!a})})})}),e.jsx(v,{title:t("notification.email.password"),children:e.jsx(x,{name:"password",control:d,rules:{validate:a?g:y},render:({field:r})=>e.jsx(b,{fullWidth:!0,children:e.jsx(j,{...r,size:"small",required:!0,type:"password",error:!!i.errors[r.name],label:t("notification.email.password"),helperText:i.errors[r.name]?.message||" ",disabled:!a})})})}),e.jsx(v,{title:t("notification.email.secure"),children:e.jsx(x,{name:"secure",control:d,rules:{validate:y},render:({field:r})=>e.jsx(b,{fullWidth:!0,children:e.jsx($,{control:e.jsx(J,{checked:r.value,...r,disabled:!a})})})})}),e.jsxs(Re,{children:[e.jsxs(ke,{expandIcon:e.jsx(je,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:[t("notification.email.signature"),e.jsx(xe,{title:t("notification.email.signatureTooltip"),children:e.jsx(ve,{fontSize:"small",sx:{ml:1,cursor:"help"}})})]}),e.jsxs(Te,{children:[e.jsx(v,{title:t("notification.email.companyName"),children:e.jsx(x,{name:"companyName",control:d,rules:{validate:y},render:({field:r})=>e.jsx(b,{fullWidth:!0,children:e.jsx(j,{...r,size:"small",error:!!i.errors[r.name],label:t("notification.email.companyName"),helperText:i.errors[r.name]?.message||" ",disabled:!a})})})}),e.jsx(v,{title:t("notification.email.companyLink"),children:e.jsx(x,{name:"companyLink",control:d,rules:{validate:a?C:y},render:({field:r})=>e.jsx(b,{fullWidth:!0,children:e.jsx(j,{...r,size:"small",error:!!i.errors[r.name],label:t("notification.email.companyLink"),helperText:i.errors[r.name]?.message||" ",disabled:!a})})})}),e.jsx(v,{title:t("notification.email.companyAddress"),children:e.jsx(x,{name:"companyAddress",control:d,rules:{validate:y},render:({field:r})=>e.jsx(b,{fullWidth:!0,children:e.jsx(j,{...r,size:"small",error:!!i.errors[r.name],label:t("notification.email.companyAddress"),helperText:i.errors[r.name]?.message||" ",disabled:!a})})})}),e.jsx(v,{title:t("notification.email.supportEmail"),children:e.jsx(x,{name:"supportEmail",control:d,rules:{validate:a?O:y},render:({field:r})=>e.jsx(b,{fullWidth:!0,children:e.jsx(j,{...r,size:"small",type:"email",error:!!i.errors[r.name],label:t("notification.email.supportEmail"),helperText:i.errors[r.name]?.message||" ",disabled:!a})})})})]})]}),e.jsxs(w,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(N,{variant:"outlined",loading:u,color:"warning",onClick:l(B),disabled:!a||u,children:t("common.runTest")}),e.jsx(N,{type:"submit",variant:"contained",loading:u,disabled:!i.isDirty||u,children:t("common.save")})]})]}),R]})}const Ie=ie(ne)``,H={enabled:!1,endpoint:"",did:void 0,pushPath:void 0};function Ke(){const{api:c}=oe(),{blocklet:n}=le(),{t}=te(),{confirmApi:h,confirmHolder:R}=ce(),[u,p]=F.useState(!1),S=n?.meta?.did,m=Object.assign({...H},n?.settings?.notification?.pushKit||{}),{handleSubmit:l,control:d,formState:i,watch:q,reset:I}=se({defaultValues:ae(m,Object.keys(H))}),o=re({testReceiver:"",testReceiverError:""}),a=q("enabled"),K=f(async(s,E,g=!0)=>{try{p(!0);const{blocklet:C}=await c.configNotification({input:{did:S,notification:JSON.stringify({pushKit:s})}}),O=Object.assign({...H},C?.settings?.notification?.pushKit||{});I(O),g&&_.success(t("common.saveSuccess"))}catch(C){if(g)_.error(C.message||t("common.saveFailed"));else throw C}finally{p(!1)}}),L=f(async(s,E)=>{try{p(!0),i.isDirty&&await K(s,E,!1);const g=(n?.configs||[]).find(y=>y.key==="BLOCKLET_APP_URL")?.value,C=be(ge(g,we.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo"),{v:n?.meta?.version,t:new Date(n?.updatedAt||0).getTime()}),O={type:"passthrough",passthroughType:"messageStatus",data:{message:{title:"Test push-kit notification",body:"This is message from push-kit config test",sender:{did:n?.appDid,fullName:n?.meta?.title,avatar:C}}}};await c.sendPush({input:{did:S,receiver:o.testReceiver,notification:JSON.stringify(O)}}),_.success(t("notification.pushKit.testSuccess"))}catch(g){_.error(g.message||t("notification.pushKit.testfailed"))}finally{p(!1)}}),B=f((s,E)=>{o.testReceiverError="",h.open({title:t("notification.pushKit.testSend"),content:()=>e.jsx(w,{sx:{width:"450px",maxWidth:"100%"},children:e.jsx(j,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:t("notification.pushKit.inputTestReceiver"),value:o.testReceiver,onChange:g=>{o.testReceiver=g.target.value},error:!!o.testReceiverError,helperText:o.testReceiverError||" "})}),confirmButtonText:t("common.confirm"),cancelButtonText:t("common.cancel"),async onConfirm(g){if(!o.testReceiver?.trim()){o.testReceiverError=t("notification.pushKit.receiverRequired");return}o.testReceiverError="",await L(s,E),g()},onCancel:()=>{p(!1)}})}),D=f(s=>{const E=s?.trim();return E?Z(E)?!0:t("notification.pushKit.endpointInvalid"):t("notification.pushKit.endpointRequired")}),M=f(()=>!0);return e.jsxs(w,{children:[e.jsxs(Oe,{component:"form",onSubmit:l(K),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(v,{title:t("notification.pushKit.enable"),my:2.5,children:e.jsx(x,{name:"enabled",control:d,render:({field:s})=>e.jsx($,{control:e.jsx(J,{checked:s.value,...s})})})}),e.jsx(v,{title:t("notification.pushKit.endpoint"),children:e.jsx(x,{name:"endpoint",control:d,rules:{validate:a?D:M},render:({field:s})=>e.jsx(b,{fullWidth:!0,children:e.jsx(j,{...s,size:"small",required:!0,label:t("notification.pushKit.endpoint"),error:!!i.errors[s.name],helperText:i.errors[s.name]?.message||" ",disabled:!a})})})}),e.jsxs(v,{title:t("notification.pushKit.customOptions"),children:[e.jsx(x,{name:"did",control:d,render:({field:s})=>e.jsx(b,{fullWidth:!0,children:e.jsx(j,{...s,size:"small",label:t("notification.pushKit.did"),error:!!i.errors[s.name],helperText:i.errors[s.name]?.message||" ",disabled:!a})})}),e.jsx(x,{name:"pushPath",control:d,render:({field:s})=>e.jsx(b,{fullWidth:!0,children:e.jsx(j,{...s,size:"small",label:t("notification.pushKit.pushPath"),error:!!i.errors[s.name],helperText:i.errors[s.name]?.message||" ",disabled:!a})})})]}),e.jsxs(w,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(N,{variant:"outlined",loading:u,color:"warning",onClick:l(B),disabled:!a||u,children:t("common.runTest")}),e.jsx(N,{type:"submit",variant:"contained",loading:u,disabled:!i.isDirty||u,children:t("common.save")})]})]}),R]})}const Oe=ie(ne)``,X=[{label:e.jsx(w,{sx:{textAlign:"center",width:"100%"},children:"Email"}),value:"email"},{label:e.jsx(w,{sx:{textAlign:"center",width:"100%"},children:"Push Kit"}),value:"pushKit"},{label:e.jsx(w,{sx:{textAlign:"center",width:"100%"},children:"Wallet"}),value:"wallet"},{label:e.jsx(w,{sx:{textAlign:"center",width:"100%"},children:"Webhooks"}),value:"webhooks"}],We=X.map(c=>c.value);function Ze(){const{t:c}=F.useContext(de),[n,t]=he(),h=n.get("type"),R=We.includes(h)?h:X[0].value,u=pe(()=>({email:e.jsx(qe,{}),pushKit:e.jsx(Ke,{}),wallet:e.jsx(Y,{variant:"body1",children:c("notification.wallet.description")}),webhooks:e.jsx(Y,{variant:"body1",children:c("notification.webhooks.description")})}),[c]),p=f(m=>{n.set("type",m),t(n,{replace:!0})}),S=F.useMemo(()=>({padding:"10px 0"}),[]);return e.jsxs(w,{children:[e.jsx(me,{variant:"card",tabs:X,current:R,onChange:p}),e.jsx(w,{style:S,children:u[R]})]})}export{Ze as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{D as w1,J as K1,j as r,Y as Y1,$ as W1,I as q1,cE as _1,ar as y1,ak as U,bb as R,bj as I1,b6 as $1,am as B1,T,bf as e6,z as t6,cF as n6,a6,Q as r6}from"./vendor-mui-core-CKKG_1TN.js";import{z as x,a as i6,ai as S1,F as M,c as s6,h as o6,l as c6}from"./vendor-utils-CUs2ebe7.js";import{V as l6,G as F1,a1 as u6,u as H,l as C6,j as p6,a_ as d6,F as t1,bz as n1}from"./vendor-ux-DjXlxcvL.js";import{r as t}from"./vendor-react-CTtPmzVP.js";import{p as L1,b as v1,a as Z}from"./vendor-hooks-DQAdyHrE.js";import{bq as Y,l as W,br as U1,bs as h6,w as m6,bt as E6,az as g6}from"./index-
|
|
1
|
+
import{D as w1,J as K1,j as r,Y as Y1,$ as W1,I as q1,cE as _1,ar as y1,ak as U,bb as R,bj as I1,b6 as $1,am as B1,T,bf as e6,z as t6,cF as n6,a6,Q as r6}from"./vendor-mui-core-CKKG_1TN.js";import{z as x,a as i6,ai as S1,F as M,c as s6,h as o6,l as c6}from"./vendor-utils-CUs2ebe7.js";import{V as l6,G as F1,a1 as u6,u as H,l as C6,j as p6,a_ as d6,F as t1,bz as n1}from"./vendor-ux-DjXlxcvL.js";import{r as t}from"./vendor-react-CTtPmzVP.js";import{p as L1,b as v1,a as Z}from"./vendor-hooks-DQAdyHrE.js";import{bq as Y,l as W,br as U1,bs as h6,w as m6,bt as E6,az as g6}from"./index-DI4CWTXR.js";import{x as f6}from"./index-DRYJ0xIl.js";import{f as A6}from"./index-BojVbZw0.js";import{O as a1}from"./index-BB8sYq-N.js";const j=Y({});function D6({key:e}={key:"md"}){const n=w1();return K1(n.breakpoints.down(e))}var A=(e=>(e[e.NETWORK_ERROR=1001]="NETWORK_ERROR",e[e.UNAUTHORIZED=1002]="UNAUTHORIZED",e[e.EXPIRED=1003]="EXPIRED",e[e.PAST_DUE=1004]="PAST_DUE",e[e.INVALID=1005]="INVALID",e[e.UNIT_LIMIT=1006]="UNIT_LIMIT",e[e.CORS_BLOCKED=1007]="CORS_BLOCKED",e[e.INCOMPATIBLE=1008]="INCOMPATIBLE",e))(A||{}),O1=(e=>(e.DEFAULT="default",e.SUCCEEDED="succeeded",e.FAILED="failed",e.PENDING="pending",e))(O1||{}),F=(e=>(e.APP_DISCONNECTED="app-disconnected",e.APP_RESTORE="app-restore",e.APP_BACKUP="app-backup",e.APP_CONNECTED="app-connected",e.APP_OBJECTS_SYNC="app-objects-sync",e))(F||{});function x6({endpoint:e,deps:n=[]}){return L1(async()=>{if(!W(e))return;const{headers:a}=await j.head(e,{timeout:1e3*30,params:{withExtras:!0}}),[i,s,c,u,l,C,d,p,m,g]=[a["x-space-name"],a["x-subscription-id"],a["x-listable"]==="true",a["x-readable"]==="true",a["x-writeable"]==="true",a["x-space-version"],a["x-space-owner-did"],a["x-space-is-available"],a["x-error-code"],a["x-is-site-admin"]],h=i?decodeURIComponent(i):"";if(p===void 0||m===void 0){const f=c&&u&&l;return{version:C,name:h,subscriptionId:s,ownerDid:d||"",isAvailable:f,errorCode:f?0:A.UNAUTHORIZED,isSiteAdmin:g==="true"}}return{version:C,name:h,subscriptionId:s,ownerDid:d,isAvailable:p==="true",errorCode:parseInt(m,10),isSiteAdmin:g==="true"}},{refreshDeps:[e].concat(n),onError(a){console.error(a)}})}const w6=U1.flatten({common:{cancel:"Cancel",confirm:"Confirm",delete:"Delete",error:"Error",open:"Open",unknown:"Unknown",invalidUrl:"Invalid url: {url}",upgrade:"Upgrade",viewMore:"View More"},storage:{spaces:{authorize:{title:"Connect {appName} to DID Spaces",scan:"Use your DID Wallet to scan the QR code below to allow the app {appName} to connect to DID Spaces",success:"Connected successfully"},connect:{reconnect:"Reconnect Now",useSpaceGateway:"Connect using the DID Spaces gateway",useWallet:"Connect to DID Spaces",howToGetGatewayUrl:"How to get the url of did spaces",providerForStorage:"Please connect your DID Spaces"},connected:{title:"Connected DID Spaces",tag:"Connected"},disconnected:{tag:"Disconnected"},error:{tag:"Need Attention",blockedByCors:"Access blocked by CORS",unreachable:"DID Space is unreachable",expired:"DID Spaces has expired, click this link to re-subscribe",pastDue:"DID Spaces has unpaid bills, click this link to complete payment",invalid:"DID Spaces subscription anomaly, click this link to check",unitLimit:"DID Spaces free quota has been used up, click this link to pay for the upgrade",cors:`The connection request may fail due to CORS restrictions:
|
|
2
2
|
1. Please contact the DID Space administrator to verify the relevant configuration.
|
|
3
3
|
2. If you are the administrator, click the link below to view the detailed setup guide and resolve the issue.`,networkError:"DID Space is currently unreachable due to potential server issues, network problems, or maintenance. Please click the link to visit the homepage and check its status.",incompatible:`The current connection of DID Spaces version ({spaceVersion}) is not compatible with the component version ({expectVersion}). Please contact the administrator for adjustments.
|
|
4
4
|
If you are the administrator, you can click the link below to take action.`},gateway:{add:{invalidUrl:"Invalid DID Spaces gateway url",label:"Enter the url of the DID Spaces",title:"Add DID Spaces"}},provideNFT:{title:"Please show the DID Spaces NFT for {appName}",scan:"Use your DID Wallet to scan the QR code below to allow the app {appName} show DID Spaces NFT",success:"Connected successfully"},helperText:{fixCorsError:"Fixing CORS Errors When Connecting to DID Spaces"}}},auditLog:{backup:{description:"A backup operation was completed {relativeTime}"},restore:{description:"A restore operation was completed {relativeTime}"},connected:{description:"A connection was established {relativeTime}"},disconnected:{description:"The connection was disconnected {relativeTime}"},objectsSync:{description:"{totalCount} objects ({size}) were synchronized {relativeTime}"}}}),y6=U1.flatten({common:{cancel:"取消",confirm:"确认",delete:"删除",error:"错误",open:"打开",unknown:"未知",invalidUrl:"无效的 url: {url}",upgrade:"升级",viewMore:"查看更多"},storage:{spaces:{authorize:{title:"连接 {appName} 至 DID Spaces",scan:"使用你的 DID Wallet 扫描下面的二维码以允许应用 {appName} 连接至 DID Spaces",success:"连接成功"},connect:{reconnect:"立即重连",useSpaceGateway:"使用 DID Spaces 网关连接",useWallet:"连接至 DID Spaces",howToGetGatewayUrl:"如何获取 DID Spaces 的网关地址",providerForStorage:"请连接您的 DID Spaces"},connected:{title:"已连接的 DID Spaces",tag:"已连接"},disconnected:{tag:"连接已断开"},error:{tag:"需要关注",blockedByCors:"因 CORS 限制,访问被阻止",unreachable:"DID Space 无法访问",expired:"DID Spaces 已过期,点击此链接重新订阅",pastDue:"DID Spaces 有未支付账单,点击此链接完成支付",invalid:"DID Spaces 订阅异常,点击此链接检查",unitLimit:"DID Spaces 免费额度已用完,点击此链接付费升级",cors:`连接请求可能因 CORS 限制而失败:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{B as qr}from"./vendor-utils-CUs2ebe7.js";import{p as ae}from"./vendor-react-CTtPmzVP.js";import{bJ as Se,c_ as jr,i as xr,c$ as Nr,d0 as _r,d1 as Kr,h as Sr,d2 as Tr,d3 as ke,d4 as Ur,aQ as Br,bG as Dr,d5 as Mr}from"./vendor-ux-DjXlxcvL.js";import{cI as Or,bv as Lr,bz as Cr}from"./index-
|
|
1
|
+
import{B as qr}from"./vendor-utils-CUs2ebe7.js";import{p as ae}from"./vendor-react-CTtPmzVP.js";import{bJ as Se,c_ as jr,i as xr,c$ as Nr,d0 as _r,d1 as Kr,h as Sr,d2 as Tr,d3 as ke,d4 as Ur,aQ as Br,bG as Dr,d5 as Mr}from"./vendor-ux-DjXlxcvL.js";import{cI as Or,bv as Lr,bz as Cr}from"./index-DI4CWTXR.js";import{r as Vr}from"./index-0ZSFNH-D.js";var Pe={exports:{}},Re={},Je;function Ar(){if(Je)return Re;Je=1;function h(u){"@babel/helpers - typeof";return h=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(p){return typeof p}:function(p){return p&&typeof Symbol=="function"&&p.constructor===Symbol&&p!==Symbol.prototype?"symbol":typeof p},h(u)}function g(u,p,S){return Object.defineProperty(u,"prototype",{writable:!1}),u}function s(u,p){if(!(u instanceof p))throw new TypeError("Cannot call a class as a function")}function b(u,p){if(typeof p!="function"&&p!==null)throw new TypeError("Super expression must either be null or a function");u.prototype=Object.create(p&&p.prototype,{constructor:{value:u,writable:!0,configurable:!0}}),Object.defineProperty(u,"prototype",{writable:!1}),p&&_(u,p)}function _(u,p){return _=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(N,B){return N.__proto__=B,N},_(u,p)}function L(u){var p=n();return function(){var N=e(u),B;if(p){var K=e(this).constructor;B=Reflect.construct(N,arguments,K)}else B=N.apply(this,arguments);return E(this,B)}}function E(u,p){if(p&&(h(p)==="object"||typeof p=="function"))return p;if(p!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return f(u)}function f(u){if(u===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return u}function n(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function e(u){return e=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(S){return S.__proto__||Object.getPrototypeOf(S)},e(u)}var r={},d,y;function l(u,p,S){S||(S=Error);function N(K,H,V){return typeof p=="string"?p:p(K,H,V)}var B=function(K){b(V,K);var H=L(V);function V(W,te,Z){var J;return s(this,V),J=H.call(this,N(W,te,Z)),J.code=u,J}return g(V)}(S);r[u]=B}function q(u,p){if(Array.isArray(u)){var S=u.length;return u=u.map(function(N){return String(N)}),S>2?"one of ".concat(p," ").concat(u.slice(0,S-1).join(", "),", or ")+u[S-1]:S===2?"one of ".concat(p," ").concat(u[0]," or ").concat(u[1]):"of ".concat(p," ").concat(u[0])}else return"of ".concat(p," ").concat(String(u))}function O(u,p,S){return u.substr(0,p.length)===p}function A(u,p,S){return(S===void 0||S>u.length)&&(S=u.length),u.substring(S-p.length,S)===p}function j(u,p,S){return typeof S!="number"&&(S=0),S+p.length>u.length?!1:u.indexOf(p,S)!==-1}return l("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError),l("ERR_INVALID_ARG_TYPE",function(u,p,S){d===void 0&&(d=We()),d(typeof u=="string","'name' must be a string");var N;typeof p=="string"&&O(p,"not ")?(N="must not be",p=p.replace(/^not /,"")):N="must be";var B;if(A(u," argument"))B="The ".concat(u," ").concat(N," ").concat(q(p,"type"));else{var K=j(u,".")?"property":"argument";B='The "'.concat(u,'" ').concat(K," ").concat(N," ").concat(q(p,"type"))}return B+=". Received type ".concat(h(S)),B},TypeError),l("ERR_INVALID_ARG_VALUE",function(u,p){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"is invalid";y===void 0&&(y=Se());var N=y.inspect(p);return N.length>128&&(N="".concat(N.slice(0,128),"...")),"The argument '".concat(u,"' ").concat(S,". Received ").concat(N)},TypeError),l("ERR_INVALID_RETURN_VALUE",function(u,p,S){var N;return S&&S.constructor&&S.constructor.name?N="instance of ".concat(S.constructor.name):N="type ".concat(h(S)),"Expected ".concat(u,' to be returned from the "').concat(p,'"')+" function but got ".concat(N,".")},TypeError),l("ERR_MISSING_ARGS",function(){for(var u=arguments.length,p=new Array(u),S=0;S<u;S++)p[S]=arguments[S];d===void 0&&(d=We()),d(p.length>0,"At least one arg needs to be specified");var N="The ",B=p.length;switch(p=p.map(function(K){return'"'.concat(K,'"')}),B){case 1:N+="".concat(p[0]," argument");break;case 2:N+="".concat(p[0]," and ").concat(p[1]," arguments");break;default:N+=p.slice(0,B-1).join(", "),N+=", and ".concat(p[B-1]," arguments");break}return"".concat(N," must be specified")},TypeError),Re.codes=r,Re}var Ie,Qe;function Fr(){if(Qe)return Ie;Qe=1;function h(v,m){var U=Object.keys(v);if(Object.getOwnPropertySymbols){var x=Object.getOwnPropertySymbols(v);m&&(x=x.filter(function(C){return Object.getOwnPropertyDescriptor(v,C).enumerable})),U.push.apply(U,x)}return U}function g(v){for(var m=1;m<arguments.length;m++){var U=arguments[m]!=null?arguments[m]:{};m%2?h(Object(U),!0).forEach(function(x){s(v,x,U[x])}):Object.getOwnPropertyDescriptors?Object.defineProperties(v,Object.getOwnPropertyDescriptors(U)):h(Object(U)).forEach(function(x){Object.defineProperty(v,x,Object.getOwnPropertyDescriptor(U,x))})}return v}function s(v,m,U){return m=E(m),m in v?Object.defineProperty(v,m,{value:U,enumerable:!0,configurable:!0,writable:!0}):v[m]=U,v}function b(v,m){if(!(v instanceof m))throw new TypeError("Cannot call a class as a function")}function _(v,m){for(var U=0;U<m.length;U++){var x=m[U];x.enumerable=x.enumerable||!1,x.configurable=!0,"value"in x&&(x.writable=!0),Object.defineProperty(v,E(x.key),x)}}function L(v,m,U){return m&&_(v.prototype,m),Object.defineProperty(v,"prototype",{writable:!1}),v}function E(v){var m=f(v,"string");return u(m)==="symbol"?m:String(m)}function f(v,m){if(u(v)!=="object"||v===null)return v;var U=v[Symbol.toPrimitive];if(U!==void 0){var x=U.call(v,m);if(u(x)!=="object")return x;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(v)}function n(v,m){if(typeof m!="function"&&m!==null)throw new TypeError("Super expression must either be null or a function");v.prototype=Object.create(m&&m.prototype,{constructor:{value:v,writable:!0,configurable:!0}}),Object.defineProperty(v,"prototype",{writable:!1}),m&&A(v,m)}function e(v){var m=q();return function(){var x=j(v),C;if(m){var a=j(this).constructor;C=Reflect.construct(x,arguments,a)}else C=x.apply(this,arguments);return r(this,C)}}function r(v,m){if(m&&(u(m)==="object"||typeof m=="function"))return m;if(m!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return d(v)}function d(v){if(v===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return v}function y(v){var m=typeof Map=="function"?new Map:void 0;return y=function(x){if(x===null||!O(x))return x;if(typeof x!="function")throw new TypeError("Super expression must either be null or a function");if(typeof m<"u"){if(m.has(x))return m.get(x);m.set(x,C)}function C(){return l(x,arguments,j(this).constructor)}return C.prototype=Object.create(x.prototype,{constructor:{value:C,enumerable:!1,writable:!0,configurable:!0}}),A(C,x)},y(v)}function l(v,m,U){return q()?l=Reflect.construct.bind():l=function(C,a,i){var c=[null];c.push.apply(c,a);var R=Function.bind.apply(C,c),w=new R;return i&&A(w,i.prototype),w},l.apply(null,arguments)}function q(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function O(v){return Function.toString.call(v).indexOf("[native code]")!==-1}function A(v,m){return A=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(x,C){return x.__proto__=C,x},A(v,m)}function j(v){return j=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(U){return U.__proto__||Object.getPrototypeOf(U)},j(v)}function u(v){"@babel/helpers - typeof";return u=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(m){return typeof m}:function(m){return m&&typeof Symbol=="function"&&m.constructor===Symbol&&m!==Symbol.prototype?"symbol":typeof m},u(v)}var p=Se(),S=p.inspect,N=Ar(),B=N.codes.ERR_INVALID_ARG_TYPE;function K(v,m,U){return(U===void 0||U>v.length)&&(U=v.length),v.substring(U-m.length,U)===m}function H(v,m){if(m=Math.floor(m),v.length==0||m==0)return"";var U=v.length*m;for(m=Math.floor(Math.log(m)/Math.log(2));m;)v+=v,m--;return v+=v.substring(0,U-v.length),v}var V="",W="",te="",Z="",J={deepStrictEqual:"Expected values to be strictly deep-equal:",strictEqual:"Expected values to be strictly equal:",strictEqualObject:'Expected "actual" to be reference-equal to "expected":',deepEqual:"Expected values to be loosely deep-equal:",equal:"Expected values to be loosely equal:",notDeepStrictEqual:'Expected "actual" not to be strictly deep-equal to:',notStrictEqual:'Expected "actual" to be strictly unequal to:',notStrictEqualObject:'Expected "actual" not to be reference-equal to "expected":',notDeepEqual:'Expected "actual" not to be loosely deep-equal to:',notEqual:'Expected "actual" to be loosely unequal to:',notIdentical:"Values identical but not reference-equal:"},he=10;function de(v){var m=Object.keys(v),U=Object.create(Object.getPrototypeOf(v));return m.forEach(function(x){U[x]=v[x]}),Object.defineProperty(U,"message",{value:v.message}),U}function oe(v){return S(v,{compact:!1,customInspect:!1,depth:1e3,maxArrayLength:1/0,showHidden:!1,breakLength:1/0,showProxy:!1,sorted:!0,getters:!0})}function ye(v,m,U){var x="",C="",a=0,i="",c=!1,R=oe(v),w=R.split(`
|
|
2
2
|
`),I=oe(m).split(`
|
|
3
3
|
`),D=0,z="";if(U==="strictEqual"&&u(v)==="object"&&u(m)==="object"&&v!==null&&m!==null&&(U="strictEqualObject"),w.length===1&&I.length===1&&w[0]!==I[0]){var k=w[0].length+I[0].length;if(k<=he){if((u(v)!=="object"||v===null)&&(u(m)!=="object"||m===null)&&(v!==0||m!==0))return"".concat(J[U],`
|
|
4
4
|
|