@abtnode/blocklet-services 1.16.44-beta-20250516-225119-c0b5ec8d → 1.16.44-beta-20250520-004606-6cd8a0d3
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/index.js +6 -0
- package/dist/assets/{AdapterDayjs-YbaNvT9I.js → AdapterDayjs-D2uo6EnV.js} +1 -1
- package/dist/assets/{ArrowDropDown-xgs4N3Rf.js → ArrowDropDown-PfUV1pZb.js} +1 -1
- package/dist/assets/{CheckCircle-JXD6tKIa.js → CheckCircle-zHdz-yvJ.js} +1 -1
- package/dist/assets/{ChevronLeft-D0eko_T8.js → ChevronLeft-3zBX65MM.js} +1 -1
- package/dist/assets/{ChevronRight-CQY9Ni7X.js → ChevronRight-BXgoqDfE.js} +1 -1
- package/dist/assets/{DeleteOutline-BEGOj_wq.js → DeleteOutline-BFB4Yy3c.js} +1 -1
- package/dist/assets/{Done-BUJJNjlP.js → Done-DboXobnH.js} +1 -1
- package/dist/assets/{Download-DdZEsxmZ.js → Download-X3XR698Z.js} +1 -1
- package/dist/assets/{Edit-vxeVwrqO.js → Edit-Cl3SK-FJ.js} +1 -1
- package/dist/assets/{Error-C-RD4e9g.js → Error-CPi5ht0i.js} +1 -1
- package/dist/assets/{ExpandLess-CmqG9SE7.js → ExpandLess-D7OENe4H.js} +1 -1
- package/dist/assets/{Google-B7PA4qF8.js → Google-Bl_7h7C7.js} +1 -1
- package/dist/assets/{InfoOutlined-BIr5nkjV.js → InfoOutlined-BGorl_CI.js} +1 -1
- package/dist/assets/{Launch-KvZQI_SA.js → Launch-5hxRq_We.js} +1 -1
- package/dist/assets/{LaunchOutlined-ClxZU_tj.js → LaunchOutlined-DCxTlWgy.js} +1 -1
- package/dist/assets/{MoreHoriz-H8rabTmY.js → MoreHoriz-Bncapj_R.js} +1 -1
- package/dist/assets/{PlayArrow-CmxnItFZ.js → PlayArrow-B19IPFeo.js} +1 -1
- package/dist/assets/{TuneOutlined-DmhFMgM-.js → TuneOutlined-OuRuIP5i.js} +1 -1
- package/dist/assets/{ViewList-DXk3qGFU.js → ViewList-Bj0HBob4.js} +1 -1
- package/dist/assets/{access-control-DfNk54C9.js → access-control-BVDJgnnG.js} +1 -1
- package/dist/assets/{actions-V9hjjowb.js → actions-B2RmHKJh.js} +1 -1
- package/dist/assets/{add-component-core-Dx4Ojnmk.js → add-component-core-BLsjc3lE.js} +15 -15
- package/dist/assets/add-resource-B0dZoJA8.js +1 -0
- package/dist/assets/{addon-DtaZ0TB3.js → addon-y9ZXCN0H.js} +1 -1
- package/dist/assets/{advanced-Ddtt8Hj-.js → advanced-5oQIoiUN.js} +2 -2
- package/dist/assets/appearance-58f9Dbcn.js +1 -0
- package/dist/assets/{ar-2yn9i2dw.js → ar-C_INBNFD.js} +1 -1
- package/dist/assets/{audit-logs-D9m5k0JB.js → audit-logs-fYqimPuZ.js} +3 -3
- package/dist/assets/{authorize-T5C3DfFM.js → authorize-DC-SAlai.js} +1 -1
- package/dist/assets/{base32-BPfgmw66.js → base32-B42OVABo.js} +1 -1
- package/dist/assets/{branding-BVm4-_4U.js → branding-DwHt5TFQ.js} +2 -2
- package/dist/assets/{branding-hFlZ2gIT.js → branding-eOJeN-jW.js} +1 -1
- package/dist/assets/{bundle-avatar-BEofqN1I.js → bundle-avatar-BoczFLNt.js} +1 -1
- package/dist/assets/{button-m03GMAJs.js → button-C6SqoOU8.js} +1 -1
- package/dist/assets/{click-to-copy-DmYkL7Ui.js → click-to-copy-ClNoTzk4.js} +1 -1
- package/dist/assets/{collapse-FsvH0gRe.js → collapse-Dz_izL9k.js} +1 -1
- package/dist/assets/complete-B4rMuRkI.js +39 -0
- package/dist/assets/{component-s7RjpIXH.js → component-BzBSZbVF.js} +1 -1
- package/dist/assets/{config-bdYGvEMY.js → config-CPFIXwk-.js} +2 -2
- package/dist/assets/{config-navigation-bI89qiN3.js → config-navigation-DdXZFw0Z.js} +3 -3
- package/dist/assets/{config-space-D1h9DQze.js → config-space-CSZvQTns.js} +1 -1
- package/dist/assets/{config-Dl_53WnU.js → config-tQft4lvg.js} +1 -1
- package/dist/assets/{confirm-zdbJI4Oz.js → confirm-hm6dpNbC.js} +1 -1
- package/dist/assets/{connect-BTGTAWj-.js → connect-BeFPxq9a.js} +1 -1
- package/dist/assets/{connect-to-DrS33AaQ.js → connect-to-Dwm_wvvo.js} +1 -1
- package/dist/assets/{connect-B2amNptu.js → connect-wIDYWNYf.js} +1 -1
- package/dist/assets/dashboard-BwU59vns.js +239 -0
- package/dist/assets/{de-CEKbJD3-.js → de-EYXdEi3Y.js} +1 -1
- package/dist/assets/{delete-confirm-CUNBU1J1.js → delete-confirm-BRkmB2tO.js} +1 -1
- package/dist/assets/{did-address-BI9LYTx-.js → did-address-Ddg6Is1P.js} +1 -1
- package/dist/assets/domain-action-card-BnxgZfnv.js +28 -0
- package/dist/assets/{domain-ER_Bg0qe.js → domain-hqA29r7o.js} +1 -1
- package/dist/assets/domains-BkjwRhdu.js +1 -0
- package/dist/assets/{dot-BB5occkV.js → dot-CdVWOAIG.js} +2 -2
- package/dist/assets/{email-BmZcVM-V.js → email-DhpxVPpg.js} +2 -2
- package/dist/assets/{es-dvMygD-W.js → es-3jqVamM8.js} +1 -1
- package/dist/assets/{exchange-passport-B5vniH8u.js → exchange-passport-3R6TCPya.js} +1 -1
- package/dist/assets/{fr-BvFd5xp9.js → fr-CUcR-yNv.js} +1 -1
- package/dist/assets/{fuel-DW3R8bWE.js → fuel-C3Ao9T8_.js} +1 -1
- package/dist/assets/{gen-access-key-h48ZchOb.js → gen-access-key-B5etX4Ba.js} +1 -1
- package/dist/assets/{get-safe-url-BcH2iukm.js → get-safe-url-DP-rZc23.js} +1 -1
- package/dist/assets/{get-safe-url-OaLLn0UN.js → get-safe-url-XcLmS0yc.js} +1 -1
- package/dist/assets/hi-DNldhMTl.js +5 -0
- package/dist/assets/{home-CJ28zTIJ.js → home-DtuKHXKD.js} +1 -1
- package/dist/assets/{id-B1Mq_eQI.js → id-CmSIFhX-.js} +1 -1
- package/dist/assets/iframe-BHwYGTAS.js +1 -0
- package/dist/assets/{index-CJpkpFKR.js → index-B6jePIag.js} +1 -1
- package/dist/assets/{index-D70ICXrC.js → index-BKdJfp9x.js} +1 -1
- package/dist/assets/{index-nBzxkc-e.js → index-BULZWXKq.js} +1 -1
- package/dist/assets/{index-DRCFOq4H.js → index-BzItMezw.js} +27 -27
- package/dist/assets/{index-DwswX2WL.js → index-C0w1ugDi.js} +1 -1
- package/dist/assets/{index-D-mbJPLJ.js → index-C5_3pYA_.js} +1 -1
- package/dist/assets/{index-D-X7HfwW.js → index-C61DBznM.js} +1 -1
- package/dist/assets/{index-tD3kWii2.js → index-CFtGBtAw.js} +1 -1
- package/dist/assets/{index-CNauVjuD.js → index-CVDucF7E.js} +7 -7
- package/dist/assets/{index-D3iGbfL9.js → index-Cb7iBSvd.js} +1 -1
- package/dist/assets/index-Cd3oZl-N.js +241 -0
- package/dist/assets/{index-C3bbolus.js → index-CmOE3ceE.js} +5 -5
- package/dist/assets/{index-C0te7llT.js → index-DAEEDx1o.js} +9 -9
- package/dist/assets/{index-CSbITcwB.js → index-DBsI6F1Z.js} +3 -3
- package/dist/assets/{index-BGat0zzz.js → index-DaoLXOw4.js} +8 -8
- package/dist/assets/{index-DwnC6XvN.js → index-Dm4t4XH1.js} +2 -2
- package/dist/assets/{index-C1rBJXFe.js → index-ND58NXzr.js} +1 -1
- package/dist/assets/index-ToeWiBUL.js +55 -0
- package/dist/assets/{index-BXdw6keY.js → index-kszsTfNH.js} +1 -1
- package/dist/assets/index-sAnn-Wqb.js +10 -0
- package/dist/assets/{invitation-CLUn7Gd4.js → invitation-qFWETxSc.js} +2 -2
- package/dist/assets/{invite-B1zBa8Gp.js → invite-Bg2Azggi.js} +1 -1
- package/dist/assets/{issue-passport-5n5uQFFQ.js → issue-passport-DtnZs7_A.js} +1 -1
- package/dist/assets/item-BYt6Ny1o.js +2 -0
- package/dist/assets/{ja-CCKVmbEX.js → ja-D-vAGmH7.js} +1 -1
- package/dist/assets/{ko-A_w8tIEg.js → ko-DpdamIdS.js} +1 -1
- package/dist/assets/{landing-page-CUrvCtHZ.js → landing-page-BiznyWTw.js} +1 -1
- package/dist/assets/{layout-Bs_rMuQ9.js → layout-DE99yYfx.js} +1 -1
- package/dist/assets/list-BkVwpX1t.js +236 -0
- package/dist/assets/{list-CFP3MiEI.js → list-UaF9rEdO.js} +2 -2
- package/dist/assets/localization-CTcPOuKl.js +1 -0
- package/dist/assets/{log-CcpvITx1.js → log-D-KC9F0b.js} +1 -1
- package/dist/assets/{logger-BYg6vYBA.js → logger-GX3OECJW.js} +1 -1
- package/dist/assets/{login-4G5grSod.js → login-D5-7Lt94.js} +1 -1
- package/dist/assets/{login-oauth-callback-DMou-vp-.js → login-oauth-callback-PDI2Klq3.js} +1 -1
- package/dist/assets/{logo-uploader-Bf6myR3q.js → logo-uploader-BNZB1sug.js} +3 -3
- package/dist/assets/{lost-passport-DWc6Kq0b.js → lost-passport-kNOXw46l.js} +1 -1
- package/dist/assets/{open-window-CuyFfntO.js → open-window-BEzzIgKH.js} +1 -1
- package/dist/assets/overview-qlJHwq1E.js +85 -0
- package/dist/assets/{page-header-DpNvpd52.js → page-header-D9UEVC59.js} +1 -1
- package/dist/assets/{passport-item-IDGIDfr4.js → passport-item-C7W2OqHa.js} +1 -1
- package/dist/assets/{permission-Cnn9EYOW.js → permission-KYy-A4oZ.js} +1 -1
- package/dist/assets/{preferences-Cqm2olsT.js → preferences-DXEo6kgA.js} +1 -1
- package/dist/assets/{profile-embed-CcuuyEXm.js → profile-embed-faK_BKhI.js} +1 -1
- package/dist/assets/pt-CEcOQeEC.js +5 -0
- package/dist/assets/publish-resource-D8YEMAlU.js +1 -0
- package/dist/assets/{react-beautiful-dnd.esm-cfY5JZV6.js → react-beautiful-dnd.esm-vpuu2z51.js} +1 -1
- package/dist/assets/ru-83xhwzPD.js +5 -0
- package/dist/assets/runtime-CKW1HKn_.js +1 -0
- package/dist/assets/sdk-B_abqbXe.js +1 -0
- package/dist/assets/{security-DFjq-0Qw.js → security-Dt3PKq-c.js} +4 -4
- package/dist/assets/{session-B2z_IWIe.js → session-CSqVp1zS.js} +1 -1
- package/dist/assets/setup-BlQH2Z6r.js +30 -0
- package/dist/assets/{spaces-DMMN97uo.js → spaces-rexKSkSX.js} +1 -1
- package/dist/assets/start-_8paEixr.js +187 -0
- package/dist/assets/{starting-progress-DeFtXRb_.js → starting-progress-CvmzmBMV.js} +2 -2
- package/dist/assets/{status-y-bc7cex.js → status-BDhcfo0L.js} +1 -1
- package/dist/assets/{step-actions-Btu6D6gk.js → step-actions-iPiCkXbU.js} +1 -1
- package/dist/assets/{studio-CiFHrC57.js → studio-A7rMh4Xk.js} +1 -1
- package/dist/assets/{switch-control-DnNP5DPe.js → switch-control-BmaFq4ZK.js} +1 -1
- package/dist/assets/{table-tips-hNIkakER.js → table-tips-DnNYXRDB.js} +1 -1
- package/dist/assets/th-BQLlyW1N.js +5 -0
- package/dist/assets/{traffic-BIrotm6H.js → traffic-BMZEqBnG.js} +2 -2
- package/dist/assets/{transfer-BeJGTbo1.js → transfer-2aML1rIB.js} +1 -1
- package/dist/assets/{unsubscribe-Bjxnpv_W.js → unsubscribe-BuBJl9gX.js} +1 -1
- package/dist/assets/use-blocklet-logo-2Y2A06qi.js +2 -0
- package/dist/assets/{useAsync-DnXpD472.js → useAsync-JBeeXlrl.js} +1 -1
- package/dist/assets/{useLocalStorage-BRd3tKN9.js → useLocalStorage-BFO9aBYY.js} +1 -1
- package/dist/assets/{user-center-DI0NPFtg.js → user-center-gbex4PJG.js} +2 -2
- package/dist/assets/{util-CVjZG67N.js → util-DMDaTiE0.js} +1 -1
- package/dist/assets/{util-C3FgySYN.js → util-xFBxHmZK.js} +1 -1
- package/dist/assets/{vendor-arcblock-DPRICUXM.js → vendor-arcblock-C99E80cF.js} +24 -24
- package/dist/assets/{vendor-hooks-Zkb4Ilbj.js → vendor-hooks-DpwFseeF.js} +1 -1
- package/dist/assets/{vendor-ux-did-connect-Ck9lzrbN.js → vendor-ux-did-connect-Qap4yrMu.js} +3 -3
- package/dist/assets/vi-DgWAr6FA.js +5 -0
- package/dist/assets/wrap-locale-C4cvZ4CE.js +1 -0
- package/dist/assets/{zh-Cti0XXui.js → zh-BL80PoOh.js} +2 -2
- package/dist/assets/{zh-tw-BLcDG99i.js → zh-tw-Dg5z1DFE.js} +1 -1
- package/dist/index.html +4 -4
- package/dist/service-worker.js +1 -1
- package/package.json +29 -29
- package/dist/assets/add-resource-CxXfKLfm.js +0 -1
- package/dist/assets/appearance-BrPMC4u8.js +0 -1
- package/dist/assets/complete-DwnM8k9G.js +0 -39
- package/dist/assets/dashboard-u-oRSlsi.js +0 -239
- package/dist/assets/domain-action-card-CYBXEnlZ.js +0 -28
- package/dist/assets/domains-CBYb9WvZ.js +0 -1
- package/dist/assets/hi-C51yBXa5.js +0 -5
- package/dist/assets/iframe-D0kv9-rE.js +0 -1
- package/dist/assets/index-DoCu_ga_.js +0 -10
- package/dist/assets/index-Up0XQY6f.js +0 -55
- package/dist/assets/index-VzeamwDR.js +0 -241
- package/dist/assets/item-BCYQnjF7.js +0 -2
- package/dist/assets/list-M2tV_ZYf.js +0 -236
- package/dist/assets/localization-Cl5vfs2R.js +0 -1
- package/dist/assets/overview-vcNUrQdk.js +0 -85
- package/dist/assets/pt-7HHecjdA.js +0 -5
- package/dist/assets/publish-resource-DGUHUINH.js +0 -1
- package/dist/assets/ru-Bw8FVC4M.js +0 -5
- package/dist/assets/runtime-efQyx-LE.js +0 -1
- package/dist/assets/sdk-CXaHNlMH.js +0 -1
- package/dist/assets/setup-CLYOmcmD.js +0 -30
- package/dist/assets/start-xHz18_Rr.js +0 -187
- package/dist/assets/th-DyW-mYrC.js +0 -5
- package/dist/assets/use-blocklet-logo-BoFa24A6.js +0 -2
- package/dist/assets/vi-bzer6J4H.js +0 -5
- package/dist/assets/wrap-locale-COcPskJ7.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as Ut,r as C}from"./vendor-react-DEoibe3W.js";import{ah as ue,al as ht,j as e,aa as T,O as te,bs as ge,bt as We,bo as Y,ad as xt,H as x,a9 as Je,T as ae,E as Qe,bz as gt,bQ as qe,bR as Ke,y as Le,b3 as Me,ab as bt,bI as jt,Y as vt,cp as yt,m as Ht,bb as dt,br as Vt,bn as Yt,q as ut,bY as Gt,I as Jt}from"./vendor-mui-core-Bh-qMRq3.js";import{J as St,z as Qt,A as Xt,e as fe,aB as ye,C as Zt}from"./vendor-utils-rHXShPKm.js";import{a as re,a5 as Ct,Z as K,bP as es,B as me,b1 as ts,ar as wt,j as W,b6 as ss,r as Xe,bQ as ns,Y as Tt,a6 as Rt,bm as Oe,al as Nt,W as is,bt as as}from"./vendor-ux-did-connect-Ck9lzrbN.js";import{z as Ze,C as Et,au as It,av as X,t as se,l as rs,G as pt}from"./index-DRCFOq4H.js";import{a as Te,u as V,f as ce}from"./vendor-hooks-Zkb4Ilbj.js";import{a as et,b as os}from"./dashboard-u-oRSlsi.js";import{l as ls,v as ke}from"./vendor-arcblock-DPRICUXM.js";import{f as $e,i as cs,d as ds}from"./use-blocklet-logo-BoFa24A6.js";import{A as us,a as ps,d as fs,b as ms}from"./collapse-FsvH0gRe.js";import{S as ee}from"./section-C1TPQFRq.js";import{S as Re}from"./shorten-label-Bf7YQUd6.js";import{I as Ot}from"./index-D3iGbfL9.js";import{R as At,A as hs,S as xs,a as gs,b as bs,B as js}from"./list-M2tV_ZYf.js";import{W as vs}from"./did-address-BI9LYTx-.js";import{p as Dt}from"./util-CVjZG67N.js";import{D as ys,g as Ss}from"./traffic-BIrotm6H.js";import{B as Lt}from"./bundle-avatar-BEofqN1I.js";import{u as Cs}from"./use-mobile-ZAS6Si4t.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-BRd3tKN9.js";import"./index-8eXqqyHQ.js";import"./confirm-zdbJI4Oz.js";import"./PlayArrow-CmxnItFZ.js";import"./get-safe-url-OaLLn0UN.js";import"./session-B2z_IWIe.js";import"./InfoOutlined-BIr5nkjV.js";import"./dot-BB5occkV.js";import"./useAsync-DnXpD472.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-JEGQfLZ2.js";import"./index-C849wD9b.js";import"./CheckCircle-JXD6tKIa.js";import"./index-DoCu_ga_.js";import"./Phone--BSu-btI.js";import"./Location-By12Z3Te.js";import"./Email-CdSNK0eA.js";import"./Timezone-YZ0dMUEr.js";import"./base32-BPfgmw66.js";import"./iframe-D0kv9-rE.js";import"./LaunchOutlined-ClxZU_tj.js";import"./ChevronLeft-D0eko_T8.js";import"./ChevronRight-CQY9Ni7X.js";import"./index-CmQOzzP8.js";import"./vendor-mui-x-CQTjfcpn.js";import"./AdapterDayjs-YbaNvT9I.js";var Ue={exports:{}},He={exports:{}},Ve={exports:{}};(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=s;function s(r){return r==null}n.exports=t.default,n.exports.default=t.default})(Ve,Ve.exports);var ws=Ve.exports;(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=p;var s=o(ls),r=o(ws);function o(h){return h&&h.__esModule?h:{default:h}}var l=/^(?:[-+]?(?:0|[1-9][0-9]*))$/,y=/^[-+]?[0-9]+$/;function p(h,i){(0,s.default)(h),i=i||{};var O=i.allow_leading_zeroes===!1?l:y,A=!i.hasOwnProperty("min")||(0,r.default)(i.min)||h>=i.min,R=!i.hasOwnProperty("max")||(0,r.default)(i.max)||h<=i.max,S=!i.hasOwnProperty("lt")||(0,r.default)(i.lt)||h<i.lt,D=!i.hasOwnProperty("gt")||(0,r.default)(i.gt)||h>i.gt;return O.test(h)&&A&&R&&S&&D}n.exports=t.default,n.exports.default=t.default})(He,He.exports);var Ts=He.exports;(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var s=r(Ts);function r(l){return l&&l.__esModule?l:{default:l}}function o(l){return(0,s.default)(l,{allow_leading_zeroes:!1,min:0,max:65535})}n.exports=t.default,n.exports.default=t.default})(Ue,Ue.exports);var Rs=Ue.exports;const Ns=Ut(Rs),Fe={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:"",companyName:"",companyLink:"",companyAddress:"",supportEmail:""};function Es(){var N,E,P;const{api:n}=Ze(),{blocklet:t}=Et(),{t:s}=re(),{confirmApi:r,confirmHolder:o}=Ct(),l=(N=t==null?void 0:t.meta)==null?void 0:N.did,y=Object.assign({...Fe},((P=(E=t==null?void 0:t.settings)==null?void 0:E.notification)==null?void 0:P.email)||{}),{handleSubmit:p,control:h,formState:i,watch:O,reset:A}=It({defaultValues:St(y,Object.keys(Fe))}),R=Te({testReceiver:"",testReceiverError:""}),S=O("enabled"),D=V(async(a,m,$=!0)=>{var U,oe;try{const{blocklet:le}=await n.configNotification({input:{did:l,notification:JSON.stringify({email:a})}}),pe=Object.assign({...Fe},((oe=(U=le==null?void 0:le.settings)==null?void 0:U.notification)==null?void 0:oe.email)||{});A(pe),$&&K.success(s("oauth.saveSuccess"))}catch(le){if($)K.error(le.message||s("oauth.saveFailed"));else throw le}}),G=V(async(a,m,$)=>{try{i.isDirty&&await D(a,m,!1),await n.sendEmail({input:{did:l,receiver:$,email:JSON.stringify({body:"Your SMTP configuration is correct!",title:"Test email",type:"notification"})}}),K.success(s("notification.email.testSuccess"))}catch(U){K.error(U.message||s("notification.email.testfailed"))}}),B=V((a,m)=>{R.testReceiver="",R.testReceiverError="",r.open({title:s("notification.email.testSendEmail"),content:()=>e.jsx(T,{sx:{width:"300px"},children:e.jsx(te,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:s("notification.email.inputTestReceiver"),value:R.testReceiver,onChange:$=>{R.testReceiver=$.target.value},error:!!R.testReceiverError,helperText:R.testReceiverError||" "})}),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),async onConfirm($){var oe;const U=(oe=R.testReceiver)==null?void 0:oe.trim();if(!U){R.testReceiverError=s("notification.email.receiverRequired");return}if(!ke(U)){R.testReceiverError=s("notification.email.receiverInvalid");return}R.testReceiverError="",await G(a,m,U),$()}})}),z=V(a=>{const m=a==null?void 0:a.trim();return m?ke(m)?!0:s("notification.email.fromInvalid"):s("notification.email.fromRequired")}),_=V(a=>{const m=a==null?void 0:a.trim();return m?$e(m,{require_host:!1,protocols:[]})?!0:s("notification.email.hostInvalid"):s("notification.email.hostRequired")}),M=V(a=>a?Ns(a)?!0:s("notification.email.portInvalid"):s("notification.email.portRequired")),J=V(a=>a!=null&&a.trim()?!0:s("notification.email.userRequired")),ie=V(a=>a!=null&&a.trim()?!0:s("notification.email.passwordRequired")),c=V(a=>a!=null&&a.trim()&&!$e(a,{protocols:["http","https"],require_protocol:!0})?s("notification.email.linkInvalid"):!0),g=V(a=>a!=null&&a.trim()&&!ke(a)?s("notification.email.emailInvalid"):!0),j=V(()=>!0);return e.jsxs(T,{children:[e.jsxs(Is,{component:"form",onSubmit:p(D),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(ee,{title:s("notification.email.enable"),my:2.5,children:e.jsx(X,{name:"enabled",control:h,render:({field:a})=>e.jsx(ge,{control:e.jsx(We,{checked:a.value,...a})})})}),e.jsx(ee,{title:s("notification.email.from"),children:e.jsx(X,{name:"from",control:h,rules:{validate:S?z:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,label:s("notification.email.from"),error:!!i.errors[a.name],helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.host"),children:e.jsx(X,{name:"host",control:h,rules:{validate:S?_:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:s("notification.email.host"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.port"),children:e.jsx(X,{name:"port",control:h,rules:{validate:S?M:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,type:"number",error:!!i.errors[a.name],label:s("notification.email.port"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.user"),children:e.jsx(X,{name:"user",control:h,rules:{validate:S?J:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:s("notification.email.user"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.password"),children:e.jsx(X,{name:"password",control:h,rules:{validate:S?ie:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,type:"password",error:!!i.errors[a.name],label:s("notification.email.password"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.secure"),children:e.jsx(X,{name:"secure",control:h,rules:{validate:j},render:({field:a})=>e.jsx(Y,{fullWidth:!0,children:e.jsx(ge,{control:e.jsx(We,{checked:a.value,...a,disabled:!S})})})})}),e.jsxs(us,{children:[e.jsxs(ps,{expandIcon:e.jsx(fs,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:[s("notification.email.signature"),e.jsx(xt,{title:s("notification.email.signatureTooltip"),children:e.jsx(es,{fontSize:"small",sx:{ml:1,cursor:"help"}})})]}),e.jsxs(ms,{children:[e.jsx(ee,{title:s("notification.email.companyName"),children:e.jsx(X,{name:"companyName",control:h,rules:{validate:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",error:!!i.errors[a.name],label:s("notification.email.companyName"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.companyLink"),children:e.jsx(X,{name:"companyLink",control:h,rules:{validate:S?c:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",error:!!i.errors[a.name],label:s("notification.email.companyLink"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.companyAddress"),children:e.jsx(X,{name:"companyAddress",control:h,rules:{validate:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",error:!!i.errors[a.name],label:s("notification.email.companyAddress"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.supportEmail"),children:e.jsx(X,{name:"supportEmail",control:h,rules:{validate:S?g:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",type:"email",error:!!i.errors[a.name],label:s("notification.email.supportEmail"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})})]})]}),e.jsxs(T,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(me,{variant:"outlined",color:"warning",onClick:p(B),disabled:!S,children:s("oauth.runTest")}),e.jsx(me,{type:"submit",variant:"contained",disabled:!i.isDirty,children:s("oauth.save")})]})]}),o]})}const Is=ue(ht)``,ze={enabled:!1,endpoint:"",did:void 0,pushPath:void 0};function Os(){var M,J,ie;const{api:n}=Ze(),{blocklet:t}=Et(),{t:s}=re(),{confirmApi:r,confirmHolder:o}=Ct(),l=(M=t==null?void 0:t.meta)==null?void 0:M.did,y=Object.assign({...ze},((ie=(J=t==null?void 0:t.settings)==null?void 0:J.notification)==null?void 0:ie.pushKit)||{}),{handleSubmit:p,control:h,formState:i,watch:O,reset:A}=It({defaultValues:St(y,Object.keys(ze))}),R=Te({testReceiver:"",testReceiverError:""}),S=O("enabled"),D=V(async(c,g,j=!0)=>{var N,E;try{const{blocklet:P}=await n.configNotification({input:{did:l,notification:JSON.stringify({pushKit:c})}}),a=Object.assign({...ze},((E=(N=P==null?void 0:P.settings)==null?void 0:N.notification)==null?void 0:E.pushKit)||{});A(a),j&&K.success(s("oauth.saveSuccess"))}catch(P){if(j)K.error(P.message||s("oauth.saveFailed"));else throw P}}),G=V(async(c,g)=>{var j,N,E;try{i.isDirty&&await D(c,g,!1);const P=(j=((t==null?void 0:t.configs)||[]).find($=>$.key==="BLOCKLET_APP_URL"))==null?void 0:j.value,a=Qt(Xt(P,"/.well-known/service/blocklet/logo"),{v:(N=t==null?void 0:t.meta)==null?void 0:N.version,t:new Date((t==null?void 0:t.updatedAt)||0).getTime()}),m={type:"passthrough",passthroughType:"messageStatus",data:{message:{title:"Test push-kit notification",body:"This is message from push-kit config test",sender:{did:t==null?void 0:t.appDid,fullName:(E=t==null?void 0:t.meta)==null?void 0:E.title,avatar:a}}}};await n.sendPush({input:{did:l,receiver:R.testReceiver,notification:JSON.stringify(m)}}),K.success(s("notification.pushKit.testSuccess"))}catch(P){K.error(P.message||s("notification.pushKit.testfailed"))}}),B=V((c,g)=>{R.testReceiverError="",r.open({title:s("notification.pushKit.testSend"),content:()=>e.jsx(T,{sx:{width:"450px",maxWidth:"100%"},children:e.jsx(te,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:s("notification.pushKit.inputTestReceiver"),value:R.testReceiver,onChange:j=>{R.testReceiver=j.target.value},error:!!R.testReceiverError,helperText:R.testReceiverError||" "})}),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),async onConfirm(j){var E;if(!((E=R.testReceiver)==null?void 0:E.trim())){R.testReceiverError=s("notification.pushKit.receiverRequired");return}R.testReceiverError="",await G(c,g),j()}})}),z=V(c=>{const g=c==null?void 0:c.trim();return g?$e(g)?!0:s("notification.pushKit.endpointInvalid"):s("notification.pushKit.endpointRequired")}),_=V(()=>!0);return e.jsxs(T,{children:[e.jsxs(As,{component:"form",onSubmit:p(D),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(ee,{title:s("notification.pushKit.enable"),my:2.5,children:e.jsx(X,{name:"enabled",control:h,render:({field:c})=>e.jsx(ge,{control:e.jsx(We,{checked:c.value,...c})})})}),e.jsx(ee,{title:s("notification.pushKit.endpoint"),children:e.jsx(X,{name:"endpoint",control:h,rules:{validate:S?z:_},render:({field:c})=>{var g;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...c,size:"small",required:!0,label:s("notification.pushKit.endpoint"),error:!!i.errors[c.name],helperText:((g=i.errors[c.name])==null?void 0:g.message)||" ",disabled:!S})})}})}),e.jsxs(ee,{title:s("notification.pushKit.customOptions"),children:[e.jsx(X,{name:"did",control:h,render:({field:c})=>{var g;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...c,size:"small",label:s("notification.pushKit.did"),error:!!i.errors[c.name],helperText:((g=i.errors[c.name])==null?void 0:g.message)||" ",disabled:!S})})}}),e.jsx(X,{name:"pushPath",control:h,render:({field:c})=>{var g;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...c,size:"small",label:s("notification.pushKit.pushPath"),error:!!i.errors[c.name],helperText:((g=i.errors[c.name])==null?void 0:g.message)||" ",disabled:!S})})}})]}),e.jsxs(T,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(me,{variant:"outlined",color:"warning",onClick:p(B),disabled:!S,children:s("oauth.runTest")}),e.jsx(me,{type:"submit",variant:"contained",disabled:!i.isDirty,children:s("oauth.save")})]})]}),o]})}const As=ue(ht)``,ft=[{label:e.jsx(T,{textAlign:"center",width:"100%",children:"Email"}),value:"email"},{label:e.jsx(T,{textAlign:"center",width:"100%",children:"Push Kit"}),value:"pushKit"}];function Ds(){const[n,t]=C.useState(ft[0].value),{locale:s}=C.useContext(ts),r=ce(()=>({email:e.jsx(Es,{}),pushKit:e.jsx(Os,{})}),[s]),o=C.useMemo(()=>({padding:"10px 0"}),[]);return e.jsxs(T,{children:[e.jsx(wt,{tabs:ft,current:n,onChange:t}),e.jsx(T,{style:o,children:r[n]})]})}const Pt=C.createContext({}),{Provider:Ls,Consumer:ai}=Pt;function Ps({children:n,blocklet:t=""}){const{api:s,inService:r,ws:{useSubscription:o}}=Ze(),[l,y]=C.useState([]),[p,h]=C.useState({total:0,pageSize:20,pageCount:0,page:1}),i=ce(()=>{var c;return(c=t.meta)==null?void 0:c.did},[t]),[O,A]=C.useState([]),[R,S]=C.useState({}),D=ce(()=>l.length?new Set(l.map(c=>c.id)):new Set,[l]),G=async({page:c=1,pageSize:g=20,...j}={})=>{if(!i)return[];try{const N={paging:{page:c,pageSize:g},...j,teamDid:i,dateRange:j.dateRange?[se(j.dateRange[0]).toISOString(),se(j.dateRange[1]).toISOString()]:void 0},{dids:E,...P}=N;let a="";E&&E.includes("system")&&(a="system");const m=E?E.filter(oe=>oe!=="system"):[],$={...P,source:a,componentDids:m},U=await s.getNotificationSendLog({input:$});return S($),y(U.list),h(U.paging),U.list}catch(N){return K.error(N.message),[]}},B=async()=>{const c=await s.getNotificationComponents({input:{teamDid:i}});A(c.componentDids)},z=C.useCallback(c=>{const g=t.children.find(j=>{var N;return((N=j.meta)==null?void 0:N.did)===c});if(g)return g.ancestors=[t],g},[t]),_=async({notificationId:c,receivers:g,channels:j,...N})=>{await s.resendNotification({input:{teamDid:i,notificationId:c,receivers:g,channels:j.map(E=>E==="wallet"?W.NOTIFICATION_SEND_CHANNEL.WALLET:E==="pushKit"?W.NOTIFICATION_SEND_CHANNEL.PUSH:E),...N}})},M=C.useCallback(async c=>(await s.getUser({input:{teamDid:i,user:{did:c}}})).user,[s,i]),J=C.useCallback(async({page:c=1,pageSize:g=20,...j}={})=>{try{const N={paging:{page:c,pageSize:g},...j,userName:j.searchText||"",teamDid:i,dateRange:j.dateRange?[se(j.dateRange[0]).toISOString(),se(j.dateRange[1]).toISOString()]:void 0};return await s.getReceivers({input:N})}catch(N){throw K.error(N.message),N}},[s,i]);C.useEffect(()=>{i&&B()},[i]),o(W.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,c=>{D.has(c.notificationId)&&G(R)},[D,R]),o(W.EVENTS.NOTIFICATION_BLOCKLET_CREATE,c=>{D.has(c.id)||G(R)},[D,R]);const ie={fetch:G,data:l,paging:p,blocklet:t,getComponent:z,resendNotification:_,getUser:M,componentDids:O,getReceivers:J,inService:r,teamDid:i};return e.jsx(Ls,{value:{notificationRecords:ie},children:n})}function tt(){const{notificationRecords:n}=C.useContext(Pt);return n}Ne.propTypes={severity:x.oneOf(Object.values(["info","success","error","warning"])).isRequired};const _s={info:"primary",success:"success",error:"error",warning:"warning"};function Ne({severity:n="info"}){return e.jsx(ss,{type:_s[n],children:n})}var st={},ks=Je;Object.defineProperty(st,"__esModule",{value:!0});var _t=st.default=void 0,Fs=ks(Xe()),zs=e;_t=st.default=(0,Fs.default)((0,zs.jsx)("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"CheckCircleOutline");var nt={},Bs=Je;Object.defineProperty(nt,"__esModule",{value:!0});var kt=nt.default=void 0,Ws=Bs(Xe()),qs=e;kt=nt.default=(0,Ws.default)((0,qs.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 it={},Ks=Je;Object.defineProperty(it,"__esModule",{value:!0});var Ft=it.default=void 0,Ms=Ks(Xe()),$s=e;Ft=it.default=(0,Ms.default)((0,$s.jsx)("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"}),"Refresh");const Us=(n,t,s="")=>{if(!s||!t)return"";switch(s){case W.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return n("notification.sendStatus.reason.disabled",{channel:t});case W.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return n("notification.sendStatus.reason.unavailable",{channel:t});case W.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return n("notification.sendStatus.reason.notSent",{channel:t});case W.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return n("notification.sendStatus.reason.offline");default:return s}};function zt(n,t,s={}){const{status:r,updatedAt:o,reason:l="",channel:y="wallet"}=s,p=o?n("notification.sendStatus.sentTime",{date:rs(o,t)}):"",h=Us(n,y,l);return r===W.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:n("notification.sendStatus.failed"),sentTime:p,reason:h}:r===W.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:n("notification.sendStatus.success"),sentTime:p}:{status:"pending",title:n("notification.sendStatus.pending"),reason:h,sentTime:p}}const Ye={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Ge=["wallet","pushKit","email"],mt=["info","success","error","warning"],Bt=n=>{var s,r;const{settings:t}=n;return(r=(s=t==null?void 0:t.notification)==null?void 0:s.email)==null?void 0:r.enabled},Wt=n=>{var s,r;const{settings:t}=n;return(r=(s=t==null?void 0:t.notification)==null?void 0:s.pushKit)==null?void 0:r.enabled},Hs=(n,t)=>{const s=fe(t,"extra.notifications.email",!0);return{available:Bt(n),enabled:s}},Vs=(n,t)=>{const s=fe(t,"extra.notifications.push",!0);return{available:Wt(n),enabled:s}},Ys=n=>({enabled:fe(n,"extra.notifications.wallet",!0)}),Gs=n=>({enabled:fe(n,"extra.webhooks",[]).length>0}),Ee=(n=3)=>new Promise(t=>{setTimeout(()=>{t()},n*1e3)}),Js=(n,t)=>t==="wallet"||t==="webhook"?[{channel:t,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:t}),fail:n("notification.sendStatus.reason.disabled",{channel:t})}]:t==="pushKit"||t==="email"?[{channel:t,type:"available",pass:n("notification.sendStatus.reason.available",{channel:t}),fail:n("notification.sendStatus.reason.unavailable",{channel:t})},{channel:t,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:t}),fail:n("notification.sendStatus.reason.disabled",{channel:t})}]:[],Ie=(n=[])=>{const t=se().startOf("day");return n.filter(s=>se(s.sendAt).isSame(t,"day")).length},Qs=(n,t="")=>{if(t&&Ge.includes(t)){const l=`${t}SendRecord`,y=fe(n,l,[]);return Ie(y)}const s=fe(n,"webhook",{}),r=Object.keys(s??{})??[];if(t&&r.includes(t)){const l=s[t]??[];return Ie(l)}const o={};return Ge.forEach(l=>{const y=`${l}SendRecord`,p=fe(n,y,[]),h=Ie(p);o[l]=h}),r.length>0&&r.forEach(l=>{const y=s[l]??[],p=Ie(y);o[l]=p}),o},Ae=(n,t,s)=>{if(!Array.isArray(n))throw new Error("Invalid filterList or index");return n[s].splice(t,1),n},De=(n,t)=>{if(!Array.isArray(t))throw new Error("filters must be an array");return t.length?!t.includes(n):!1},Xs=n=>{switch(n){case W.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case W.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case W.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case W.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},qt=()=>({components:{MUIDataTableFilter:{styleOverrides:{header:{marginBottom:0,p:{margin:0}},root:{"& .MuiGrid-container":{marginTop:0,"& .MuiGrid-item":{paddingTop:0}}}}},MuiPopover:{styleOverrides:{root:{"&.MuiPopover-root":{"& .MuiPaper-root:has(.filter-container)":{width:"420px"}}}}}}});function de({config:n,enableTooltip:t=!0,showTitle:s=!1,children:r}){const{status:o,title:l="",sentTime:y="",reason:p=""}=n,h=[l,p].filter(Boolean).join(", ");return e.jsx(xt,{title:t?e.jsxs(e.Fragment,{children:[e.jsx(ae,{color:"inherit",sx:{fontSize:12},children:h}),e.jsx("span",{children:y})]}):null,arrow:!0,placement:"top",children:e.jsxs(T,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(T,{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center",children:[e.jsx(T,{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Ye[o],style:{opacity:.15}}),e.jsx(T,{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Ye[o]})]}),e.jsx(ae,{color:"inherit",sx:{fontSize:12},children:s?l:r})]})})}de.propTypes={config:x.object.isRequired,enableTooltip:x.bool,showTitle:x.bool,children:x.node};de.defaultProps={enableTooltip:!0,showTitle:!1,children:null};Se.propTypes={list:x.array.isRequired,label:x.string.isRequired,onDelete:x.func};Se.defaultProps={onDelete:()=>{}};function Se({list:n,label:t,onDelete:s}){const{t:r,locale:o}=re();return e.jsxs(T,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(ae,{children:[t,": "]}),n.map(l=>{const y=zt(r,o,{status:l});return e.jsx(Qe,{size:"small",label:e.jsx(T,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(de,{config:y,enableTooltip:!1,children:y.title})}),onDelete:p=>s(p,l)},l)})]})}at.propTypes={filterList:x.array.isRequired,onChange:x.func.isRequired,index:x.number.isRequired,column:x.object.isRequired,filterValues:x.array.isRequired,label:x.string.isRequired,renderLabel:x.func.isRequired};function at({filterList:n,onChange:t,index:s,column:r,filterValues:o,label:l,renderLabel:y}){return e.jsxs(Y,{className:"filter-container",children:[e.jsx(gt,{component:"legend",children:l}),e.jsx(qe,{row:!0,children:o.map(p=>e.jsx(ge,{control:e.jsx(Ke,{checked:n[s].indexOf(p.value??p)>-1,onChange:h=>{const i=[...n];h.target.checked?i[s]=[...i[s],p.value??p]:i[s]=i[s].filter(O=>O!==(p.value??p)),t(i[s],s,r)},name:p.value??p}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:y(p)})},p.value??p))})]})}function Be(n){return e.jsx(at,{...n,renderLabel:t=>e.jsx(de,{enableTooltip:!1,config:{status:t.status},children:t.label})})}ve.propTypes={status:x.number.isRequired,updatedAt:x.string.isRequired,reason:x.string,channel:x.string,onResend:x.func};function ve({status:n,updatedAt:t,reason:s="",channel:r="wallet",onResend:o}){const{t:l,locale:y}=re(),p=zt(l,y,{status:n,updatedAt:t,reason:s,channel:r});return e.jsxs(T,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(de,{config:p,showTitle:!0}),p.status!=="success"&&e.jsx(Le,{className:"resend-btn",size:"small",startIcon:e.jsx(et,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:o,children:l("notification.resend")})]})}rt.propTypes={value:x.array.isRequired,onChange:x.func};function rt({value:n,onChange:t}){const{locale:s}=re(),r=se().toDate(),[o,l]=C.useState(null),y=C.useCallback(i=>{l(o?null:i.currentTarget)},[o]),p=!!o,h=C.useCallback(i=>{if(!i.startDate||!i.endDate){K.error("Please select a date range");return}if(se(i.startDate).isAfter(i.endDate)||!se(i.startDate).isValid()||!se(i.endDate).isValid()){K.error("Invalid date range");return}t([i.startDate,i.endDate]),l(null)},[t]);return e.jsxs("div",{children:[e.jsx(ae,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:0,children:e.jsxs(Le,{onClick:y,variant:"outlined",size:"small",color:"inherit",children:[pt(n[0],s)," - ",pt(n[1],s)]})}),e.jsx(Me,{open:p,anchorEl:o,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(ys,{open:!0,maxDate:r,initialDateRange:{startDate:n[0],endDate:n[1]},toggle:y,definedRanges:Ss(r),onChange:h})})]})}ot.propTypes={itemComponent:x.elementType.isRequired};function ot({itemComponent:n,...t}){var o;const{t:s}=re();return!((o=t==null?void 0:t.filterList)!=null&&o.filter(l=>l.length).length)?null:e.jsxs(T,{display:"flex",gap:1,alignItems:"center",children:[e.jsx("div",{className:"toolbar-filter-title",children:s("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(ns.TableFilterList,{...t,ItemComponent:n})})]})}function Pe({label:n,onDelete:t,canDelete:s=()=>!0,...r}){const o=t&&typeof t=="function"?t:void 0;let l=!0;return s&&typeof s=="function"&&(l=s({label:n,...r})),e.jsx(Qe,{label:n,variant:"outlined",...o&&l?{onDelete:o}:{}})}Pe.propTypes={label:x.string.isRequired,onDelete:x.func,canDelete:x.func};Pe.defaultProps={canDelete:()=>!0};const Zs=[{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}];lt.propTypes={loading:x.bool,onCancel:x.func,onConfirm:x.func};lt.defaultProps={loading:!1,onCancel:()=>{},onConfirm:()=>{}};function lt({loading:n=!1,onCancel:t,onConfirm:s}){const{t:r}=re(),[o,l]=C.useState(Zs),[y,p]=C.useState(!0),h=(O,A)=>{A.checked=O.target.checked;const R=o.map(S=>({...S,checked:S.value===A.value?A.checked:S.checked}));l(R)},i=O=>{O.stopPropagation(),s({channels:o.filter(A=>A.checked).map(A=>A.value),isResendFailedOnly:y})};return e.jsxs(T,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(ae,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(T,{className:"choose-channel",children:e.jsxs(Y,{component:"fieldset",variant:"standard",children:[e.jsx(gt,{component:"legend",children:r("notification.selectChannels")}),e.jsx(qe,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:o.map(O=>e.jsx(ge,{control:e.jsx(Ke,{checked:O.checked,onChange:A=>h(A,O),name:O.value}),label:O.label},O.value))})]})}),e.jsx(T,{className:"resend-config-footer",children:e.jsx(qe,{children:e.jsx(ge,{control:e.jsx(Ke,{checked:y,onChange:O=>p(O.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(T,{display:"flex",justifyContent:"flex-end",gap:1,className:"resend-config-footer-tip",children:[e.jsx(Le,{onClick:O=>{O.stopPropagation(),t()},color:"inherit",children:r("common.cancel")}),e.jsxs(Le,{onClick:i,color:"primary",disabled:n,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[n&&e.jsx(bt,{size:16}),r("common.confirm")]})]})]})}Kt.propTypes={notificationId:x.string.isRequired,handleResend:x.func,resending:x.bool};function Kt({notificationId:n,handleResend:t,resending:s=!1}){const{t:r,locale:o}=re(),l=jt(),y=C.useMemo(()=>vt(l,qt()),[l]),{getReceivers:p,inService:h,teamDid:i,getUser:O,blocklet:A}=tt(),[R,S]=C.useState(!1),[D,G]=C.useState([]),B=Te({anchorEl:null,position:null}),z=Te({anchorEl:null,position:null}),[_,M]=C.useState(null),[J,ie]=C.useState({total:0,pageSize:10,pageCount:0,page:1}),[c,g]=C.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[se().subtract(1,"month").startOf("day").toDate(),se().endOf("day").toDate()]}),[j,N]=C.useState([]),E=[{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"}],P=async()=>{if(!R&&n)try{S(!0);const d=await p({notificationId:n,...c}),u=d.list.map(f=>({...f,receiverUser:{...f.receiverUser,avatar:Dt(f.receiverUser.avatar,i,h)}}));G(u),ie(d.paging),S(!1)}catch(d){K.error(d.message),S(!1)}};C.useEffect(()=>{P()},[c]);const a=d=>{d.stopPropagation();const u=d.currentTarget;z.anchorEl=u;const f=u.getBoundingClientRect();z.position={top:f.top+window.scrollY,left:f.left+window.scrollX}},m=d=>d.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(me,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(et,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:a,children:r("notification.resend")})}):null,$={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:J.page-1,rowsPerPage:J.pageSize,count:J.total,searchText:c.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:j,onRowSelectionChange:(d,u)=>{N(u.map(f=>f.dataIndex))},customToolbarSelect:m},U=({page:d,rowsPerPage:u,searchText:f,filterList:L})=>{const[,q=[],Z=[],Q=[]]=L;c.pageSize!==u?g(H=>({...H,pageSize:u,page:1})):c.page!==d+1?g(H=>({...H,page:d+1})):c.searchText!==f?g(H=>({...H,searchText:f,page:1})):ye(q,c.walletSendStatus)?ye(Z,c.pushKitSendStatus)?ye(Q,c.emailSendStatus)||g(H=>({...H,emailSendStatus:Q,page:1})):g(H=>({...H,pushKitSendStatus:Z,page:1})):g(H=>({...H,walletSendStatus:q,page:1}))},oe=C.useCallback(async(d,u)=>{if(!u)return!1;const f=await O(u);return f?d==="wallet"?Ys(f):d==="email"?Hs(A,f):d==="pushKit"?Vs(A,f):d==="webhook"?Gs(f):!0:!1},[O,A]),le=C.useCallback(d=>Js(r,d),[r]),pe=()=>{B.anchorEl=null,B.position=null,M(null)},be=()=>{z.anchorEl=null,z.position=null},je=async(d,u,f=!0,L="")=>{if(!(!u.length||!d.length))try{t(d,u,f,L),z.anchorEl||(await Ee(.5),pe())}catch(q){console.error("handleResend error",{error:q})}},v=async({channels:d,isResendFailedOnly:u})=>{const f=j.map(L=>D[L].receiver);await je(d,f,u),await Ee(.5),be(),N([])},b=async(d,u=[],f=!0)=>{try{await je(["webhook"],[d.receiver],f,u)}catch(L){K.error(L.response?L.response.statusText:L.message)}},w=async(d,u,f,L=[],q=!0)=>{if(d.stopPropagation(),Qs(u,f)>=4){K.warning(r("notification.resendLimit"));return}if(!Ge.includes(f)){await b(u,L,q);return}if(d){const Q=d.currentTarget,H=Q.getBoundingClientRect();B.anchorEl=Q,B.position={top:H.top+window.scrollY,left:H.left+window.scrollX}}M({channel:f});try{const Q=await oe(f,u.receiver);await Ee(1),M({channel:f,result:Q}),(typeof Q=="boolean"&&Q||Zt(Q)&&Object.values(Q).every(H=>!!H))&&(await t([f],[u.receiver],q),z.anchorEl||(await Ee(.5),pe()))}catch(Q){K.error(Q.message)}},I=d=>{g(u=>({...u,dateRange:d,page:1}))},k=(d,u,f,L)=>{d.stopPropagation();const q=f.filter(Z=>Z!==u);g(Z=>({...Z,[L]:q,page:1}))},F=ce(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:d=>{const{receiverUser:u,receiver:f}=D[d];return u?e.jsxs(T,{"data-cy":`member-name-${u.fullName}`,display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start",children:[e.jsx(Tt,{src:`${u.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:f,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(Re,{children:u.fullName})]},f):e.jsx(vs,{size:14,responsive:!1,compact:!0,copyable:!1,did:f})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:c.walletSendStatus??[],customFilterListOptions:{render:d=>e.jsx(Se,{list:d,label:"Wallet",onDelete:(u,f)=>{u.stopPropagation(),k(u,f,F[1].options.filterList,"walletSendStatus")}}),update:Ae},filterOptions:{names:E,fullWidth:!0,logic:De,display:(d,u,f,L)=>e.jsx(Be,{label:"Wallet",filterList:d,onChange:u,index:f,column:L,filterValues:E})},customBodyRenderLite:d=>{const{walletSendStatus:u,walletSendAt:f,walletSendFailedReason:L}=D[d];return e.jsx(ve,{status:u,updatedAt:f,reason:L,channel:"wallet",onResend:q=>w(q,D[d],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:d=>{const{pushKitSendStatus:u,pushKitSendAt:f,pushKitSendFailedReason:L}=D[d];return e.jsx(ve,{status:u,updatedAt:f,reason:L,channel:"pushkit",onResend:q=>w(q,D[d],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:c.pushKitSendStatus??[],customFilterListOptions:{render:d=>e.jsx(Se,{list:d,label:"Push Kit",onDelete:(u,f)=>{u.stopPropagation(),k(u,f,F[2].options.filterList,"pushKitSendStatus")}}),update:Ae},filterOptions:{names:E,fullWidth:!0,logic:De,display:(d,u,f,L)=>e.jsx(Be,{label:"Push Kit",filterList:d,onChange:u,index:f,column:L,filterValues:E})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:d=>{const{emailSendStatus:u,emailSendAt:f,emailSendFailedReason:L}=D[d];return e.jsx(ve,{status:u,updatedAt:f,reason:L,channel:"email",onResend:q=>w(q,D[d],"email",[],!1)})},filter:!0,filterType:"custom",filterList:c.emailSendStatus??[],customFilterListOptions:{render:d=>e.jsx(Se,{list:d,label:"Email",onDelete:(u,f)=>{u.stopPropagation(),k(u,f,F[3].options.filterList,"emailSendStatus")}}),update:Ae},filterOptions:{names:E,fullWidth:!0,logic:De,display:(d,u,f,L)=>e.jsx(Be,{label:"Email",filterList:d,onChange:u,index:f,column:L,filterValues:E})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:d=>{const{webhook:u}=D[d];if(!u)return null;const f=Object.entries(u)[0];if(!f)return null;const[L,q]=f,Z=q[0];return e.jsx(T,{display:"flex",flexDirection:"column",gap:1,children:e.jsxs(T,{className:"webhook-item",fontSize:12,children:[e.jsx(Re,{maxLength:30,children:L},L),e.jsx(ve,{status:Z.status,updatedAt:Z.sendAt,reason:Z.failedReason,channel:"webhook",onResend:Q=>w(Q,D[d],"webhook",[L],!1)})]},L)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:d=>{const{createdAt:u}=D[d];return e.jsx(At,{value:u,locale:o,shouldUpdate:!0})}}}],[D,o,c,r]),ne=[e.jsx(rt,{value:c.dateRange,onChange:I},"date-picker"),e.jsx(me,{variant:"contained",size:"small",color:"primary",loading:R,startIcon:e.jsx(Ft,{}),onClick:()=>P(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(T,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(tn,{children:e.jsxs(yt,{theme:y,children:[e.jsx(Rt,{className:"receivers-table",locale:o,loading:R,columns:F,data:D,onChange:U,options:$,customButtons:ne,components:{TableFilterList:d=>e.jsx(ot,{...d,itemComponent:u=>e.jsx(Pe,{...u,canDelete:()=>!1})})}}),B.anchorEl&&e.jsx(Me,{open:!!B.anchorEl,anchorReference:"anchorPosition",anchorPosition:B.position,onClose:pe,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(sn,{children:[e.jsxs(ae,{variant:"body1",component:"div",className:"check-title",children:[_==null?void 0:_.channel," Checking"]}),e.jsx(T,{display:"flex",flexDirection:"column",sx:{gap:"4px"},children:le(_==null?void 0:_.channel).map(d=>{var q,Z;const{type:u,pass:f,fail:L}=d;return!(_!=null&&_.result)||(q=_==null?void 0:_.result)!=null&&q[u]?e.jsxs(ae,{variant:"body1",component:"div",className:"check-item",display:"flex",alignItems:"center",sx:{gap:"4px",color:(Z=_==null?void 0:_.result)!=null&&Z[u]?Oe.success.main:"inherit"},children:[_!=null&&_.result?e.jsx(_t,{}):e.jsx(bt,{size:12,sx:{color:Oe.primary.main}}),e.jsx("span",{children:f})]},u):e.jsxs(ae,{variant:"body1",component:"div",display:"flex",alignItems:"center",className:"check-item",sx:{gap:"4px",color:Oe.error.main},children:[e.jsx(kt,{}),e.jsx("span",{children:L})]},u)})})]})}),z.anchorEl&&e.jsx(Me,{open:!!z.anchorEl,anchorReference:"anchorPosition",anchorPosition:z.position,onClose:be,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(lt,{loading:s,onCancel:be,onConfirm:v})})]})})})}const en=C.memo(Kt),tn=ue.div`
|
|
1
|
+
import{g as Ut,r as C}from"./vendor-react-DEoibe3W.js";import{ah as ue,al as ht,j as e,aa as T,O as te,bs as ge,bt as We,bo as Y,ad as xt,H as x,a9 as Je,T as ae,E as Qe,bz as gt,bQ as qe,bR as Ke,y as Le,b3 as Me,ab as bt,bI as jt,Y as vt,cp as yt,m as Ht,bb as dt,br as Vt,bn as Yt,q as ut,bY as Gt,I as Jt}from"./vendor-mui-core-Bh-qMRq3.js";import{J as St,z as Qt,A as Xt,e as fe,aB as ye,C as Zt}from"./vendor-utils-rHXShPKm.js";import{a as re,a4 as Ct,Y as K,bP as es,B as me,b1 as ts,aq as wt,j as W,b6 as ss,r as Xe,bQ as ns,X as Tt,a5 as Rt,bm as Ae,ak as Nt,V as is,bt as as}from"./vendor-ux-did-connect-Qap4yrMu.js";import{A as Ze,D as Et,ay as It,az as X,v as se,l as rs,H as pt}from"./index-BzItMezw.js";import{a as Te,u as V,f as ce}from"./vendor-hooks-DpwFseeF.js";import{a as et,b as os}from"./dashboard-BwU59vns.js";import{l as ls,v as ke}from"./vendor-arcblock-C99E80cF.js";import{f as $e,i as cs,d as ds}from"./use-blocklet-logo-2Y2A06qi.js";import{A as us,a as ps,d as fs,b as ms}from"./collapse-Dz_izL9k.js";import{S as ee}from"./section-C1TPQFRq.js";import{S as Re}from"./shorten-label-Bf7YQUd6.js";import{I as At}from"./index-Cb7iBSvd.js";import{R as Ot,A as hs,S as xs,a as gs,b as bs,B as js}from"./list-BkVwpX1t.js";import{W as vs}from"./did-address-Ddg6Is1P.js";import{p as Dt}from"./util-DMDaTiE0.js";import{D as ys,g as Ss}from"./traffic-BMZEqBnG.js";import{B as Lt}from"./bundle-avatar-BoczFLNt.js";import{u as Cs}from"./use-mobile-JEGQfLZ2.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-BFO9aBYY.js";import"./index-8eXqqyHQ.js";import"./confirm-hm6dpNbC.js";import"./PlayArrow-B19IPFeo.js";import"./get-safe-url-XcLmS0yc.js";import"./session-CSqVp1zS.js";import"./InfoOutlined-BGorl_CI.js";import"./dot-CdVWOAIG.js";import"./useAsync-JBeeXlrl.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-ZAS6Si4t.js";import"./index-C849wD9b.js";import"./CheckCircle-zHdz-yvJ.js";import"./index-sAnn-Wqb.js";import"./Phone--BSu-btI.js";import"./Location-By12Z3Te.js";import"./Email-CdSNK0eA.js";import"./Timezone-YZ0dMUEr.js";import"./base32-B42OVABo.js";import"./iframe-BHwYGTAS.js";import"./LaunchOutlined-DCxTlWgy.js";import"./ChevronLeft-3zBX65MM.js";import"./ChevronRight-BXgoqDfE.js";import"./index-CmQOzzP8.js";import"./vendor-mui-x-CQTjfcpn.js";import"./AdapterDayjs-D2uo6EnV.js";var Ue={exports:{}},He={exports:{}},Ve={exports:{}};(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=s;function s(r){return r==null}n.exports=t.default,n.exports.default=t.default})(Ve,Ve.exports);var ws=Ve.exports;(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=p;var s=o(ls),r=o(ws);function o(h){return h&&h.__esModule?h:{default:h}}var l=/^(?:[-+]?(?:0|[1-9][0-9]*))$/,y=/^[-+]?[0-9]+$/;function p(h,i){(0,s.default)(h),i=i||{};var A=i.allow_leading_zeroes===!1?l:y,O=!i.hasOwnProperty("min")||(0,r.default)(i.min)||h>=i.min,R=!i.hasOwnProperty("max")||(0,r.default)(i.max)||h<=i.max,S=!i.hasOwnProperty("lt")||(0,r.default)(i.lt)||h<i.lt,D=!i.hasOwnProperty("gt")||(0,r.default)(i.gt)||h>i.gt;return A.test(h)&&O&&R&&S&&D}n.exports=t.default,n.exports.default=t.default})(He,He.exports);var Ts=He.exports;(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var s=r(Ts);function r(l){return l&&l.__esModule?l:{default:l}}function o(l){return(0,s.default)(l,{allow_leading_zeroes:!1,min:0,max:65535})}n.exports=t.default,n.exports.default=t.default})(Ue,Ue.exports);var Rs=Ue.exports;const Ns=Ut(Rs),Fe={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:"",companyName:"",companyLink:"",companyAddress:"",supportEmail:""};function Es(){var N,E,P;const{api:n}=Ze(),{blocklet:t}=Et(),{t:s}=re(),{confirmApi:r,confirmHolder:o}=Ct(),l=(N=t==null?void 0:t.meta)==null?void 0:N.did,y=Object.assign({...Fe},((P=(E=t==null?void 0:t.settings)==null?void 0:E.notification)==null?void 0:P.email)||{}),{handleSubmit:p,control:h,formState:i,watch:A,reset:O}=It({defaultValues:St(y,Object.keys(Fe))}),R=Te({testReceiver:"",testReceiverError:""}),S=A("enabled"),D=V(async(a,m,$=!0)=>{var U,oe;try{const{blocklet:le}=await n.configNotification({input:{did:l,notification:JSON.stringify({email:a})}}),pe=Object.assign({...Fe},((oe=(U=le==null?void 0:le.settings)==null?void 0:U.notification)==null?void 0:oe.email)||{});O(pe),$&&K.success(s("oauth.saveSuccess"))}catch(le){if($)K.error(le.message||s("oauth.saveFailed"));else throw le}}),G=V(async(a,m,$)=>{try{i.isDirty&&await D(a,m,!1),await n.sendEmail({input:{did:l,receiver:$,email:JSON.stringify({body:"Your SMTP configuration is correct!",title:"Test email",type:"notification"})}}),K.success(s("notification.email.testSuccess"))}catch(U){K.error(U.message||s("notification.email.testfailed"))}}),B=V((a,m)=>{R.testReceiver="",R.testReceiverError="",r.open({title:s("notification.email.testSendEmail"),content:()=>e.jsx(T,{sx:{width:"300px"},children:e.jsx(te,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:s("notification.email.inputTestReceiver"),value:R.testReceiver,onChange:$=>{R.testReceiver=$.target.value},error:!!R.testReceiverError,helperText:R.testReceiverError||" "})}),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),async onConfirm($){var oe;const U=(oe=R.testReceiver)==null?void 0:oe.trim();if(!U){R.testReceiverError=s("notification.email.receiverRequired");return}if(!ke(U)){R.testReceiverError=s("notification.email.receiverInvalid");return}R.testReceiverError="",await G(a,m,U),$()}})}),z=V(a=>{const m=a==null?void 0:a.trim();return m?ke(m)?!0:s("notification.email.fromInvalid"):s("notification.email.fromRequired")}),_=V(a=>{const m=a==null?void 0:a.trim();return m?$e(m,{require_host:!1,protocols:[]})?!0:s("notification.email.hostInvalid"):s("notification.email.hostRequired")}),M=V(a=>a?Ns(a)?!0:s("notification.email.portInvalid"):s("notification.email.portRequired")),J=V(a=>a!=null&&a.trim()?!0:s("notification.email.userRequired")),ie=V(a=>a!=null&&a.trim()?!0:s("notification.email.passwordRequired")),c=V(a=>a!=null&&a.trim()&&!$e(a,{protocols:["http","https"],require_protocol:!0})?s("notification.email.linkInvalid"):!0),g=V(a=>a!=null&&a.trim()&&!ke(a)?s("notification.email.emailInvalid"):!0),j=V(()=>!0);return e.jsxs(T,{children:[e.jsxs(Is,{component:"form",onSubmit:p(D),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(ee,{title:s("notification.email.enable"),my:2.5,children:e.jsx(X,{name:"enabled",control:h,render:({field:a})=>e.jsx(ge,{control:e.jsx(We,{checked:a.value,...a})})})}),e.jsx(ee,{title:s("notification.email.from"),children:e.jsx(X,{name:"from",control:h,rules:{validate:S?z:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,label:s("notification.email.from"),error:!!i.errors[a.name],helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.host"),children:e.jsx(X,{name:"host",control:h,rules:{validate:S?_:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:s("notification.email.host"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.port"),children:e.jsx(X,{name:"port",control:h,rules:{validate:S?M:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,type:"number",error:!!i.errors[a.name],label:s("notification.email.port"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.user"),children:e.jsx(X,{name:"user",control:h,rules:{validate:S?J:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:s("notification.email.user"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.password"),children:e.jsx(X,{name:"password",control:h,rules:{validate:S?ie:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,type:"password",error:!!i.errors[a.name],label:s("notification.email.password"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.secure"),children:e.jsx(X,{name:"secure",control:h,rules:{validate:j},render:({field:a})=>e.jsx(Y,{fullWidth:!0,children:e.jsx(ge,{control:e.jsx(We,{checked:a.value,...a,disabled:!S})})})})}),e.jsxs(us,{children:[e.jsxs(ps,{expandIcon:e.jsx(fs,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:[s("notification.email.signature"),e.jsx(xt,{title:s("notification.email.signatureTooltip"),children:e.jsx(es,{fontSize:"small",sx:{ml:1,cursor:"help"}})})]}),e.jsxs(ms,{children:[e.jsx(ee,{title:s("notification.email.companyName"),children:e.jsx(X,{name:"companyName",control:h,rules:{validate:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",error:!!i.errors[a.name],label:s("notification.email.companyName"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.companyLink"),children:e.jsx(X,{name:"companyLink",control:h,rules:{validate:S?c:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",error:!!i.errors[a.name],label:s("notification.email.companyLink"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.companyAddress"),children:e.jsx(X,{name:"companyAddress",control:h,rules:{validate:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",error:!!i.errors[a.name],label:s("notification.email.companyAddress"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.supportEmail"),children:e.jsx(X,{name:"supportEmail",control:h,rules:{validate:S?g:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",type:"email",error:!!i.errors[a.name],label:s("notification.email.supportEmail"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})})]})]}),e.jsxs(T,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(me,{variant:"outlined",color:"warning",onClick:p(B),disabled:!S,children:s("oauth.runTest")}),e.jsx(me,{type:"submit",variant:"contained",disabled:!i.isDirty,children:s("oauth.save")})]})]}),o]})}const Is=ue(ht)``,ze={enabled:!1,endpoint:"",did:void 0,pushPath:void 0};function As(){var M,J,ie;const{api:n}=Ze(),{blocklet:t}=Et(),{t:s}=re(),{confirmApi:r,confirmHolder:o}=Ct(),l=(M=t==null?void 0:t.meta)==null?void 0:M.did,y=Object.assign({...ze},((ie=(J=t==null?void 0:t.settings)==null?void 0:J.notification)==null?void 0:ie.pushKit)||{}),{handleSubmit:p,control:h,formState:i,watch:A,reset:O}=It({defaultValues:St(y,Object.keys(ze))}),R=Te({testReceiver:"",testReceiverError:""}),S=A("enabled"),D=V(async(c,g,j=!0)=>{var N,E;try{const{blocklet:P}=await n.configNotification({input:{did:l,notification:JSON.stringify({pushKit:c})}}),a=Object.assign({...ze},((E=(N=P==null?void 0:P.settings)==null?void 0:N.notification)==null?void 0:E.pushKit)||{});O(a),j&&K.success(s("oauth.saveSuccess"))}catch(P){if(j)K.error(P.message||s("oauth.saveFailed"));else throw P}}),G=V(async(c,g)=>{var j,N,E;try{i.isDirty&&await D(c,g,!1);const P=(j=((t==null?void 0:t.configs)||[]).find($=>$.key==="BLOCKLET_APP_URL"))==null?void 0:j.value,a=Qt(Xt(P,"/.well-known/service/blocklet/logo"),{v:(N=t==null?void 0:t.meta)==null?void 0:N.version,t:new Date((t==null?void 0:t.updatedAt)||0).getTime()}),m={type:"passthrough",passthroughType:"messageStatus",data:{message:{title:"Test push-kit notification",body:"This is message from push-kit config test",sender:{did:t==null?void 0:t.appDid,fullName:(E=t==null?void 0:t.meta)==null?void 0:E.title,avatar:a}}}};await n.sendPush({input:{did:l,receiver:R.testReceiver,notification:JSON.stringify(m)}}),K.success(s("notification.pushKit.testSuccess"))}catch(P){K.error(P.message||s("notification.pushKit.testfailed"))}}),B=V((c,g)=>{R.testReceiverError="",r.open({title:s("notification.pushKit.testSend"),content:()=>e.jsx(T,{sx:{width:"450px",maxWidth:"100%"},children:e.jsx(te,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:s("notification.pushKit.inputTestReceiver"),value:R.testReceiver,onChange:j=>{R.testReceiver=j.target.value},error:!!R.testReceiverError,helperText:R.testReceiverError||" "})}),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),async onConfirm(j){var E;if(!((E=R.testReceiver)==null?void 0:E.trim())){R.testReceiverError=s("notification.pushKit.receiverRequired");return}R.testReceiverError="",await G(c,g),j()}})}),z=V(c=>{const g=c==null?void 0:c.trim();return g?$e(g)?!0:s("notification.pushKit.endpointInvalid"):s("notification.pushKit.endpointRequired")}),_=V(()=>!0);return e.jsxs(T,{children:[e.jsxs(Os,{component:"form",onSubmit:p(D),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(ee,{title:s("notification.pushKit.enable"),my:2.5,children:e.jsx(X,{name:"enabled",control:h,render:({field:c})=>e.jsx(ge,{control:e.jsx(We,{checked:c.value,...c})})})}),e.jsx(ee,{title:s("notification.pushKit.endpoint"),children:e.jsx(X,{name:"endpoint",control:h,rules:{validate:S?z:_},render:({field:c})=>{var g;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...c,size:"small",required:!0,label:s("notification.pushKit.endpoint"),error:!!i.errors[c.name],helperText:((g=i.errors[c.name])==null?void 0:g.message)||" ",disabled:!S})})}})}),e.jsxs(ee,{title:s("notification.pushKit.customOptions"),children:[e.jsx(X,{name:"did",control:h,render:({field:c})=>{var g;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...c,size:"small",label:s("notification.pushKit.did"),error:!!i.errors[c.name],helperText:((g=i.errors[c.name])==null?void 0:g.message)||" ",disabled:!S})})}}),e.jsx(X,{name:"pushPath",control:h,render:({field:c})=>{var g;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...c,size:"small",label:s("notification.pushKit.pushPath"),error:!!i.errors[c.name],helperText:((g=i.errors[c.name])==null?void 0:g.message)||" ",disabled:!S})})}})]}),e.jsxs(T,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(me,{variant:"outlined",color:"warning",onClick:p(B),disabled:!S,children:s("oauth.runTest")}),e.jsx(me,{type:"submit",variant:"contained",disabled:!i.isDirty,children:s("oauth.save")})]})]}),o]})}const Os=ue(ht)``,ft=[{label:e.jsx(T,{textAlign:"center",width:"100%",children:"Email"}),value:"email"},{label:e.jsx(T,{textAlign:"center",width:"100%",children:"Push Kit"}),value:"pushKit"}];function Ds(){const[n,t]=C.useState(ft[0].value),{locale:s}=C.useContext(ts),r=ce(()=>({email:e.jsx(Es,{}),pushKit:e.jsx(As,{})}),[s]),o=C.useMemo(()=>({padding:"10px 0"}),[]);return e.jsxs(T,{children:[e.jsx(wt,{tabs:ft,current:n,onChange:t}),e.jsx(T,{style:o,children:r[n]})]})}const Pt=C.createContext({}),{Provider:Ls,Consumer:ai}=Pt;function Ps({children:n,blocklet:t=""}){const{api:s,inService:r,ws:{useSubscription:o}}=Ze(),[l,y]=C.useState([]),[p,h]=C.useState({total:0,pageSize:20,pageCount:0,page:1}),i=ce(()=>{var c;return(c=t.meta)==null?void 0:c.did},[t]),[A,O]=C.useState([]),[R,S]=C.useState({}),D=ce(()=>l.length?new Set(l.map(c=>c.id)):new Set,[l]),G=async({page:c=1,pageSize:g=20,...j}={})=>{if(!i)return[];try{const N={paging:{page:c,pageSize:g},...j,teamDid:i,dateRange:j.dateRange?[se(j.dateRange[0]).toISOString(),se(j.dateRange[1]).toISOString()]:void 0},{dids:E,...P}=N;let a="";E&&E.includes("system")&&(a="system");const m=E?E.filter(oe=>oe!=="system"):[],$={...P,source:a,componentDids:m},U=await s.getNotificationSendLog({input:$});return S($),y(U.list),h(U.paging),U.list}catch(N){return K.error(N.message),[]}},B=async()=>{const c=await s.getNotificationComponents({input:{teamDid:i}});O(c.componentDids)},z=C.useCallback(c=>{const g=t.children.find(j=>{var N;return((N=j.meta)==null?void 0:N.did)===c});if(g)return g.ancestors=[t],g},[t]),_=async({notificationId:c,receivers:g,channels:j,...N})=>{await s.resendNotification({input:{teamDid:i,notificationId:c,receivers:g,channels:j.map(E=>E==="wallet"?W.NOTIFICATION_SEND_CHANNEL.WALLET:E==="pushKit"?W.NOTIFICATION_SEND_CHANNEL.PUSH:E),...N}})},M=C.useCallback(async c=>(await s.getUser({input:{teamDid:i,user:{did:c}}})).user,[s,i]),J=C.useCallback(async({page:c=1,pageSize:g=20,...j}={})=>{try{const N={paging:{page:c,pageSize:g},...j,userName:j.searchText||"",teamDid:i,dateRange:j.dateRange?[se(j.dateRange[0]).toISOString(),se(j.dateRange[1]).toISOString()]:void 0};return await s.getReceivers({input:N})}catch(N){throw K.error(N.message),N}},[s,i]);C.useEffect(()=>{i&&B()},[i]),o(W.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,c=>{D.has(c.notificationId)&&G(R)},[D,R]),o(W.EVENTS.NOTIFICATION_BLOCKLET_CREATE,c=>{D.has(c.id)||G(R)},[D,R]);const ie={fetch:G,data:l,paging:p,blocklet:t,getComponent:z,resendNotification:_,getUser:M,componentDids:A,getReceivers:J,inService:r,teamDid:i};return e.jsx(Ls,{value:{notificationRecords:ie},children:n})}function tt(){const{notificationRecords:n}=C.useContext(Pt);return n}Ne.propTypes={severity:x.oneOf(Object.values(["info","success","error","warning"])).isRequired};const _s={info:"primary",success:"success",error:"error",warning:"warning"};function Ne({severity:n="info"}){return e.jsx(ss,{type:_s[n],children:n})}var st={},ks=Je;Object.defineProperty(st,"__esModule",{value:!0});var _t=st.default=void 0,Fs=ks(Xe()),zs=e;_t=st.default=(0,Fs.default)((0,zs.jsx)("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"CheckCircleOutline");var nt={},Bs=Je;Object.defineProperty(nt,"__esModule",{value:!0});var kt=nt.default=void 0,Ws=Bs(Xe()),qs=e;kt=nt.default=(0,Ws.default)((0,qs.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 it={},Ks=Je;Object.defineProperty(it,"__esModule",{value:!0});var Ft=it.default=void 0,Ms=Ks(Xe()),$s=e;Ft=it.default=(0,Ms.default)((0,$s.jsx)("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"}),"Refresh");const Us=(n,t,s="")=>{if(!s||!t)return"";switch(s){case W.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return n("notification.sendStatus.reason.disabled",{channel:t});case W.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return n("notification.sendStatus.reason.unavailable",{channel:t});case W.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return n("notification.sendStatus.reason.notSent",{channel:t});case W.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return n("notification.sendStatus.reason.offline");default:return s}};function zt(n,t,s={}){const{status:r,updatedAt:o,reason:l="",channel:y="wallet"}=s,p=o?n("notification.sendStatus.sentTime",{date:rs(o,t)}):"",h=Us(n,y,l);return r===W.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:n("notification.sendStatus.failed"),sentTime:p,reason:h}:r===W.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:n("notification.sendStatus.success"),sentTime:p}:{status:"pending",title:n("notification.sendStatus.pending"),reason:h,sentTime:p}}const Ye={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Ge=["wallet","pushKit","email"],mt=["info","success","error","warning"],Bt=n=>{var s,r;const{settings:t}=n;return(r=(s=t==null?void 0:t.notification)==null?void 0:s.email)==null?void 0:r.enabled},Wt=n=>{var s,r;const{settings:t}=n;return(r=(s=t==null?void 0:t.notification)==null?void 0:s.pushKit)==null?void 0:r.enabled},Hs=(n,t)=>{const s=fe(t,"extra.notifications.email",!0);return{available:Bt(n),enabled:s}},Vs=(n,t)=>{const s=fe(t,"extra.notifications.push",!0);return{available:Wt(n),enabled:s}},Ys=n=>({enabled:fe(n,"extra.notifications.wallet",!0)}),Gs=n=>({enabled:fe(n,"extra.webhooks",[]).length>0}),Ee=(n=3)=>new Promise(t=>{setTimeout(()=>{t()},n*1e3)}),Js=(n,t)=>t==="wallet"||t==="webhook"?[{channel:t,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:t}),fail:n("notification.sendStatus.reason.disabled",{channel:t})}]:t==="pushKit"||t==="email"?[{channel:t,type:"available",pass:n("notification.sendStatus.reason.available",{channel:t}),fail:n("notification.sendStatus.reason.unavailable",{channel:t})},{channel:t,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:t}),fail:n("notification.sendStatus.reason.disabled",{channel:t})}]:[],Ie=(n=[])=>{const t=se().startOf("day");return n.filter(s=>se(s.sendAt).isSame(t,"day")).length},Qs=(n,t="")=>{if(t&&Ge.includes(t)){const l=`${t}SendRecord`,y=fe(n,l,[]);return Ie(y)}const s=fe(n,"webhook",{}),r=Object.keys(s??{})??[];if(t&&r.includes(t)){const l=s[t]??[];return Ie(l)}const o={};return Ge.forEach(l=>{const y=`${l}SendRecord`,p=fe(n,y,[]),h=Ie(p);o[l]=h}),r.length>0&&r.forEach(l=>{const y=s[l]??[],p=Ie(y);o[l]=p}),o},Oe=(n,t,s)=>{if(!Array.isArray(n))throw new Error("Invalid filterList or index");return n[s].splice(t,1),n},De=(n,t)=>{if(!Array.isArray(t))throw new Error("filters must be an array");return t.length?!t.includes(n):!1},Xs=n=>{switch(n){case W.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case W.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case W.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case W.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},qt=()=>({components:{MUIDataTableFilter:{styleOverrides:{header:{marginBottom:0,p:{margin:0}},root:{"& .MuiGrid-container":{marginTop:0,"& .MuiGrid-item":{paddingTop:0}}}}},MuiPopover:{styleOverrides:{root:{"&.MuiPopover-root":{"& .MuiPaper-root:has(.filter-container)":{width:"420px"}}}}}}});function de({config:n,enableTooltip:t=!0,showTitle:s=!1,children:r}){const{status:o,title:l="",sentTime:y="",reason:p=""}=n,h=[l,p].filter(Boolean).join(", ");return e.jsx(xt,{title:t?e.jsxs(e.Fragment,{children:[e.jsx(ae,{color:"inherit",sx:{fontSize:12},children:h}),e.jsx("span",{children:y})]}):null,arrow:!0,placement:"top",children:e.jsxs(T,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(T,{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center",children:[e.jsx(T,{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Ye[o],style:{opacity:.15}}),e.jsx(T,{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Ye[o]})]}),e.jsx(ae,{color:"inherit",sx:{fontSize:12},children:s?l:r})]})})}de.propTypes={config:x.object.isRequired,enableTooltip:x.bool,showTitle:x.bool,children:x.node};de.defaultProps={enableTooltip:!0,showTitle:!1,children:null};Se.propTypes={list:x.array.isRequired,label:x.string.isRequired,onDelete:x.func};Se.defaultProps={onDelete:()=>{}};function Se({list:n,label:t,onDelete:s}){const{t:r,locale:o}=re();return e.jsxs(T,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(ae,{children:[t,": "]}),n.map(l=>{const y=zt(r,o,{status:l});return e.jsx(Qe,{size:"small",label:e.jsx(T,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(de,{config:y,enableTooltip:!1,children:y.title})}),onDelete:p=>s(p,l)},l)})]})}at.propTypes={filterList:x.array.isRequired,onChange:x.func.isRequired,index:x.number.isRequired,column:x.object.isRequired,filterValues:x.array.isRequired,label:x.string.isRequired,renderLabel:x.func.isRequired};function at({filterList:n,onChange:t,index:s,column:r,filterValues:o,label:l,renderLabel:y}){return e.jsxs(Y,{className:"filter-container",children:[e.jsx(gt,{component:"legend",children:l}),e.jsx(qe,{row:!0,children:o.map(p=>e.jsx(ge,{control:e.jsx(Ke,{checked:n[s].indexOf(p.value??p)>-1,onChange:h=>{const i=[...n];h.target.checked?i[s]=[...i[s],p.value??p]:i[s]=i[s].filter(A=>A!==(p.value??p)),t(i[s],s,r)},name:p.value??p}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:y(p)})},p.value??p))})]})}function Be(n){return e.jsx(at,{...n,renderLabel:t=>e.jsx(de,{enableTooltip:!1,config:{status:t.status},children:t.label})})}ve.propTypes={status:x.number.isRequired,updatedAt:x.string.isRequired,reason:x.string,channel:x.string,onResend:x.func};function ve({status:n,updatedAt:t,reason:s="",channel:r="wallet",onResend:o}){const{t:l,locale:y}=re(),p=zt(l,y,{status:n,updatedAt:t,reason:s,channel:r});return e.jsxs(T,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(de,{config:p,showTitle:!0}),p.status!=="success"&&e.jsx(Le,{className:"resend-btn",size:"small",startIcon:e.jsx(et,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:o,children:l("notification.resend")})]})}rt.propTypes={value:x.array.isRequired,onChange:x.func};function rt({value:n,onChange:t}){const{locale:s}=re(),r=se().toDate(),[o,l]=C.useState(null),y=C.useCallback(i=>{l(o?null:i.currentTarget)},[o]),p=!!o,h=C.useCallback(i=>{if(!i.startDate||!i.endDate){K.error("Please select a date range");return}if(se(i.startDate).isAfter(i.endDate)||!se(i.startDate).isValid()||!se(i.endDate).isValid()){K.error("Invalid date range");return}t([i.startDate,i.endDate]),l(null)},[t]);return e.jsxs("div",{children:[e.jsx(ae,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:0,children:e.jsxs(Le,{onClick:y,variant:"outlined",size:"small",color:"inherit",children:[pt(n[0],s)," - ",pt(n[1],s)]})}),e.jsx(Me,{open:p,anchorEl:o,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(ys,{open:!0,maxDate:r,initialDateRange:{startDate:n[0],endDate:n[1]},toggle:y,definedRanges:Ss(r),onChange:h})})]})}ot.propTypes={itemComponent:x.elementType.isRequired};function ot({itemComponent:n,...t}){var o;const{t:s}=re();return!((o=t==null?void 0:t.filterList)!=null&&o.filter(l=>l.length).length)?null:e.jsxs(T,{display:"flex",gap:1,alignItems:"center",children:[e.jsx("div",{className:"toolbar-filter-title",children:s("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(ns.TableFilterList,{...t,ItemComponent:n})})]})}function Pe({label:n,onDelete:t,canDelete:s=()=>!0,...r}){const o=t&&typeof t=="function"?t:void 0;let l=!0;return s&&typeof s=="function"&&(l=s({label:n,...r})),e.jsx(Qe,{label:n,variant:"outlined",...o&&l?{onDelete:o}:{}})}Pe.propTypes={label:x.string.isRequired,onDelete:x.func,canDelete:x.func};Pe.defaultProps={canDelete:()=>!0};const Zs=[{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}];lt.propTypes={loading:x.bool,onCancel:x.func,onConfirm:x.func};lt.defaultProps={loading:!1,onCancel:()=>{},onConfirm:()=>{}};function lt({loading:n=!1,onCancel:t,onConfirm:s}){const{t:r}=re(),[o,l]=C.useState(Zs),[y,p]=C.useState(!0),h=(A,O)=>{O.checked=A.target.checked;const R=o.map(S=>({...S,checked:S.value===O.value?O.checked:S.checked}));l(R)},i=A=>{A.stopPropagation(),s({channels:o.filter(O=>O.checked).map(O=>O.value),isResendFailedOnly:y})};return e.jsxs(T,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(ae,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(T,{className:"choose-channel",children:e.jsxs(Y,{component:"fieldset",variant:"standard",children:[e.jsx(gt,{component:"legend",children:r("notification.selectChannels")}),e.jsx(qe,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:o.map(A=>e.jsx(ge,{control:e.jsx(Ke,{checked:A.checked,onChange:O=>h(O,A),name:A.value}),label:A.label},A.value))})]})}),e.jsx(T,{className:"resend-config-footer",children:e.jsx(qe,{children:e.jsx(ge,{control:e.jsx(Ke,{checked:y,onChange:A=>p(A.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(T,{display:"flex",justifyContent:"flex-end",gap:1,className:"resend-config-footer-tip",children:[e.jsx(Le,{onClick:A=>{A.stopPropagation(),t()},color:"inherit",children:r("common.cancel")}),e.jsxs(Le,{onClick:i,color:"primary",disabled:n,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[n&&e.jsx(bt,{size:16}),r("common.confirm")]})]})]})}Kt.propTypes={notificationId:x.string.isRequired,handleResend:x.func,resending:x.bool};function Kt({notificationId:n,handleResend:t,resending:s=!1}){const{t:r,locale:o}=re(),l=jt(),y=C.useMemo(()=>vt(l,qt()),[l]),{getReceivers:p,inService:h,teamDid:i,getUser:A,blocklet:O}=tt(),[R,S]=C.useState(!1),[D,G]=C.useState([]),B=Te({anchorEl:null,position:null}),z=Te({anchorEl:null,position:null}),[_,M]=C.useState(null),[J,ie]=C.useState({total:0,pageSize:10,pageCount:0,page:1}),[c,g]=C.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[se().subtract(1,"month").startOf("day").toDate(),se().endOf("day").toDate()]}),[j,N]=C.useState([]),E=[{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"}],P=async()=>{if(!R&&n)try{S(!0);const d=await p({notificationId:n,...c}),u=d.list.map(f=>({...f,receiverUser:{...f.receiverUser,avatar:Dt(f.receiverUser.avatar,i,h)}}));G(u),ie(d.paging),S(!1)}catch(d){K.error(d.message),S(!1)}};C.useEffect(()=>{P()},[c]);const a=d=>{d.stopPropagation();const u=d.currentTarget;z.anchorEl=u;const f=u.getBoundingClientRect();z.position={top:f.top+window.scrollY,left:f.left+window.scrollX}},m=d=>d.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(me,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(et,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:a,children:r("notification.resend")})}):null,$={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:J.page-1,rowsPerPage:J.pageSize,count:J.total,searchText:c.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:j,onRowSelectionChange:(d,u)=>{N(u.map(f=>f.dataIndex))},customToolbarSelect:m},U=({page:d,rowsPerPage:u,searchText:f,filterList:L})=>{const[,q=[],Z=[],Q=[]]=L;c.pageSize!==u?g(H=>({...H,pageSize:u,page:1})):c.page!==d+1?g(H=>({...H,page:d+1})):c.searchText!==f?g(H=>({...H,searchText:f,page:1})):ye(q,c.walletSendStatus)?ye(Z,c.pushKitSendStatus)?ye(Q,c.emailSendStatus)||g(H=>({...H,emailSendStatus:Q,page:1})):g(H=>({...H,pushKitSendStatus:Z,page:1})):g(H=>({...H,walletSendStatus:q,page:1}))},oe=C.useCallback(async(d,u)=>{if(!u)return!1;const f=await A(u);return f?d==="wallet"?Ys(f):d==="email"?Hs(O,f):d==="pushKit"?Vs(O,f):d==="webhook"?Gs(f):!0:!1},[A,O]),le=C.useCallback(d=>Js(r,d),[r]),pe=()=>{B.anchorEl=null,B.position=null,M(null)},be=()=>{z.anchorEl=null,z.position=null},je=async(d,u,f=!0,L="")=>{if(!(!u.length||!d.length))try{t(d,u,f,L),z.anchorEl||(await Ee(.5),pe())}catch(q){console.error("handleResend error",{error:q})}},v=async({channels:d,isResendFailedOnly:u})=>{const f=j.map(L=>D[L].receiver);await je(d,f,u),await Ee(.5),be(),N([])},b=async(d,u=[],f=!0)=>{try{await je(["webhook"],[d.receiver],f,u)}catch(L){K.error(L.response?L.response.statusText:L.message)}},w=async(d,u,f,L=[],q=!0)=>{if(d.stopPropagation(),Qs(u,f)>=4){K.warning(r("notification.resendLimit"));return}if(!Ge.includes(f)){await b(u,L,q);return}if(d){const Q=d.currentTarget,H=Q.getBoundingClientRect();B.anchorEl=Q,B.position={top:H.top+window.scrollY,left:H.left+window.scrollX}}M({channel:f});try{const Q=await oe(f,u.receiver);await Ee(1),M({channel:f,result:Q}),(typeof Q=="boolean"&&Q||Zt(Q)&&Object.values(Q).every(H=>!!H))&&(await t([f],[u.receiver],q),z.anchorEl||(await Ee(.5),pe()))}catch(Q){K.error(Q.message)}},I=d=>{g(u=>({...u,dateRange:d,page:1}))},k=(d,u,f,L)=>{d.stopPropagation();const q=f.filter(Z=>Z!==u);g(Z=>({...Z,[L]:q,page:1}))},F=ce(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:d=>{const{receiverUser:u,receiver:f}=D[d];return u?e.jsxs(T,{"data-cy":`member-name-${u.fullName}`,display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start",children:[e.jsx(Tt,{src:`${u.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:f,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(Re,{children:u.fullName})]},f):e.jsx(vs,{size:14,responsive:!1,compact:!0,copyable:!1,did:f})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:c.walletSendStatus??[],customFilterListOptions:{render:d=>e.jsx(Se,{list:d,label:"Wallet",onDelete:(u,f)=>{u.stopPropagation(),k(u,f,F[1].options.filterList,"walletSendStatus")}}),update:Oe},filterOptions:{names:E,fullWidth:!0,logic:De,display:(d,u,f,L)=>e.jsx(Be,{label:"Wallet",filterList:d,onChange:u,index:f,column:L,filterValues:E})},customBodyRenderLite:d=>{const{walletSendStatus:u,walletSendAt:f,walletSendFailedReason:L}=D[d];return e.jsx(ve,{status:u,updatedAt:f,reason:L,channel:"wallet",onResend:q=>w(q,D[d],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:d=>{const{pushKitSendStatus:u,pushKitSendAt:f,pushKitSendFailedReason:L}=D[d];return e.jsx(ve,{status:u,updatedAt:f,reason:L,channel:"pushkit",onResend:q=>w(q,D[d],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:c.pushKitSendStatus??[],customFilterListOptions:{render:d=>e.jsx(Se,{list:d,label:"Push Kit",onDelete:(u,f)=>{u.stopPropagation(),k(u,f,F[2].options.filterList,"pushKitSendStatus")}}),update:Oe},filterOptions:{names:E,fullWidth:!0,logic:De,display:(d,u,f,L)=>e.jsx(Be,{label:"Push Kit",filterList:d,onChange:u,index:f,column:L,filterValues:E})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:d=>{const{emailSendStatus:u,emailSendAt:f,emailSendFailedReason:L}=D[d];return e.jsx(ve,{status:u,updatedAt:f,reason:L,channel:"email",onResend:q=>w(q,D[d],"email",[],!1)})},filter:!0,filterType:"custom",filterList:c.emailSendStatus??[],customFilterListOptions:{render:d=>e.jsx(Se,{list:d,label:"Email",onDelete:(u,f)=>{u.stopPropagation(),k(u,f,F[3].options.filterList,"emailSendStatus")}}),update:Oe},filterOptions:{names:E,fullWidth:!0,logic:De,display:(d,u,f,L)=>e.jsx(Be,{label:"Email",filterList:d,onChange:u,index:f,column:L,filterValues:E})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:d=>{const{webhook:u}=D[d];if(!u)return null;const f=Object.entries(u)[0];if(!f)return null;const[L,q]=f,Z=q[0];return e.jsx(T,{display:"flex",flexDirection:"column",gap:1,children:e.jsxs(T,{className:"webhook-item",fontSize:12,children:[e.jsx(Re,{maxLength:30,children:L},L),e.jsx(ve,{status:Z.status,updatedAt:Z.sendAt,reason:Z.failedReason,channel:"webhook",onResend:Q=>w(Q,D[d],"webhook",[L],!1)})]},L)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:d=>{const{createdAt:u}=D[d];return e.jsx(Ot,{value:u,locale:o,shouldUpdate:!0})}}}],[D,o,c,r]),ne=[e.jsx(rt,{value:c.dateRange,onChange:I},"date-picker"),e.jsx(me,{variant:"contained",size:"small",color:"primary",loading:R,startIcon:e.jsx(Ft,{}),onClick:()=>P(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(T,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(tn,{children:e.jsxs(yt,{theme:y,children:[e.jsx(Rt,{className:"receivers-table",locale:o,loading:R,columns:F,data:D,onChange:U,options:$,customButtons:ne,components:{TableFilterList:d=>e.jsx(ot,{...d,itemComponent:u=>e.jsx(Pe,{...u,canDelete:()=>!1})})}}),B.anchorEl&&e.jsx(Me,{open:!!B.anchorEl,anchorReference:"anchorPosition",anchorPosition:B.position,onClose:pe,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(sn,{children:[e.jsxs(ae,{variant:"body1",component:"div",className:"check-title",children:[_==null?void 0:_.channel," Checking"]}),e.jsx(T,{display:"flex",flexDirection:"column",sx:{gap:"4px"},children:le(_==null?void 0:_.channel).map(d=>{var q,Z;const{type:u,pass:f,fail:L}=d;return!(_!=null&&_.result)||(q=_==null?void 0:_.result)!=null&&q[u]?e.jsxs(ae,{variant:"body1",component:"div",className:"check-item",display:"flex",alignItems:"center",sx:{gap:"4px",color:(Z=_==null?void 0:_.result)!=null&&Z[u]?Ae.success.main:"inherit"},children:[_!=null&&_.result?e.jsx(_t,{}):e.jsx(bt,{size:12,sx:{color:Ae.primary.main}}),e.jsx("span",{children:f})]},u):e.jsxs(ae,{variant:"body1",component:"div",display:"flex",alignItems:"center",className:"check-item",sx:{gap:"4px",color:Ae.error.main},children:[e.jsx(kt,{}),e.jsx("span",{children:L})]},u)})})]})}),z.anchorEl&&e.jsx(Me,{open:!!z.anchorEl,anchorReference:"anchorPosition",anchorPosition:z.position,onClose:be,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(lt,{loading:s,onCancel:be,onConfirm:v})})]})})})}const en=C.memo(Kt),tn=ue.div`
|
|
2
2
|
td.MuiTableCell-footer {
|
|
3
3
|
border: none !important;
|
|
4
4
|
}
|
|
@@ -27,7 +27,7 @@ import{g as Ut,r as C}from"./vendor-react-DEoibe3W.js";import{ah as ue,al as ht,
|
|
|
27
27
|
}
|
|
28
28
|
font-size: 12px;
|
|
29
29
|
}
|
|
30
|
-
`,Ce=n=>n>=1e6?`${(n/1e6).toFixed(1)}M`:n>=1e3?`${(n/1e3).toFixed(1)}K`:n;function nn(n){const{wallet:t,push:s,email:r,webhook:o}=n;return[{name:"Wallet",value:e.jsx(he,{item:t})},{name:"Push",value:e.jsx(he,{item:s})},{name:"Email",value:e.jsx(he,{item:r})},...o.total>0?[{name:"Webhook",value:e.jsx(he,{item:o,isWebhook:!0})}]:[]]}function an(n,t,s){const{wallet:r,push:o,email:l,webhook:y}=n;return[{name:"Wallet",value:e.jsx(xe,{loading:s,channel:W.NOTIFICATION_SEND_CHANNEL.WALLET,item:r,onResend:t})},{name:"Push",value:e.jsx(xe,{loading:s,channel:W.NOTIFICATION_SEND_CHANNEL.PUSH,item:o,onResend:t})},{name:"Email",value:e.jsx(xe,{loading:s,channel:W.NOTIFICATION_SEND_CHANNEL.EMAIL,item:l,onResend:t})},...y.total>0?[{name:"Webhook",value:e.jsx(xe,{loading:s,channel:W.NOTIFICATION_SEND_CHANNEL.WEBHOOK,item:y,isWebhook:!0,onResend:t})}]:[]]}_e.propTypes={statistics:x.object.isRequired,onResend:x.func,mode:x.oneOf(["simple","detail"]),resending:x.bool};_e.defaultProps={mode:"simple",onResend:()=>{},resending:!1};he.propTypes={item:x.object.isRequired,isWebhook:x.bool};he.defaultProps={isWebhook:!1};function he({item:n,isWebhook:t=!1}){const{t:s}=re(),r=t?n.success.length:n.success,o=n.total,l=r===o?"success":"failed";return e.jsx(T,{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:2,children:e.jsx(T,{display:"flex",alignItems:"center",gap:1,children:e.jsxs(de,{config:{status:l},enableTooltip:!1,children:[Ce(r)," / ",Ce(o)," ",s("notification.sendStatus.success")]})})})}xe.propTypes={item:x.object.isRequired,isWebhook:x.bool,channel:x.string,onResend:x.func,loading:x.bool};xe.defaultProps={isWebhook:!1,channel:W.NOTIFICATION_SEND_CHANNEL.WALLET,onResend:()=>{},loading:!1};function xe({channel:n,item:t,isWebhook:s=!1,onResend:r,loading:o}){const{t:l}=re(),{success:y,failed:p,pending:h}=t,i=Xs(n),
|
|
30
|
+
`,Ce=n=>n>=1e6?`${(n/1e6).toFixed(1)}M`:n>=1e3?`${(n/1e3).toFixed(1)}K`:n;function nn(n){const{wallet:t,push:s,email:r,webhook:o}=n;return[{name:"Wallet",value:e.jsx(he,{item:t})},{name:"Push",value:e.jsx(he,{item:s})},{name:"Email",value:e.jsx(he,{item:r})},...o.total>0?[{name:"Webhook",value:e.jsx(he,{item:o,isWebhook:!0})}]:[]]}function an(n,t,s){const{wallet:r,push:o,email:l,webhook:y}=n;return[{name:"Wallet",value:e.jsx(xe,{loading:s,channel:W.NOTIFICATION_SEND_CHANNEL.WALLET,item:r,onResend:t})},{name:"Push",value:e.jsx(xe,{loading:s,channel:W.NOTIFICATION_SEND_CHANNEL.PUSH,item:o,onResend:t})},{name:"Email",value:e.jsx(xe,{loading:s,channel:W.NOTIFICATION_SEND_CHANNEL.EMAIL,item:l,onResend:t})},...y.total>0?[{name:"Webhook",value:e.jsx(xe,{loading:s,channel:W.NOTIFICATION_SEND_CHANNEL.WEBHOOK,item:y,isWebhook:!0,onResend:t})}]:[]]}_e.propTypes={statistics:x.object.isRequired,onResend:x.func,mode:x.oneOf(["simple","detail"]),resending:x.bool};_e.defaultProps={mode:"simple",onResend:()=>{},resending:!1};he.propTypes={item:x.object.isRequired,isWebhook:x.bool};he.defaultProps={isWebhook:!1};function he({item:n,isWebhook:t=!1}){const{t:s}=re(),r=t?n.success.length:n.success,o=n.total,l=r===o?"success":"failed";return e.jsx(T,{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:2,children:e.jsx(T,{display:"flex",alignItems:"center",gap:1,children:e.jsxs(de,{config:{status:l},enableTooltip:!1,children:[Ce(r)," / ",Ce(o)," ",s("notification.sendStatus.success")]})})})}xe.propTypes={item:x.object.isRequired,isWebhook:x.bool,channel:x.string,onResend:x.func,loading:x.bool};xe.defaultProps={isWebhook:!1,channel:W.NOTIFICATION_SEND_CHANNEL.WALLET,onResend:()=>{},loading:!1};function xe({channel:n,item:t,isWebhook:s=!1,onResend:r,loading:o}){const{t:l}=re(),{success:y,failed:p,pending:h}=t,i=Xs(n),A=s?y.length:y,O=s?p.length:p,R=s?h.length:h,S=async z=>{z.stopPropagation();const _=s?[...new Set([...y,...p].map(M=>M))]:[];await r([n],[],!0,_)},D=A+O,G=D>0?A/D*100:0,B=D>0?O/D*100:0;return e.jsxs(rn,{successRatio:G,failedRatio:B,children:[e.jsxs(ae,{variant:"h6",children:[i," (",t.total,")"]}),e.jsxs(ae,{variant:"body1",sx:{mb:2},children:[e.jsx("span",{style:{color:Ye.success,fontWeight:600,fontSize:24},children:Ce(A)}),e.jsx("small",{style:{paddingLeft:4},children:l("notification.sendStatus.success")})]}),e.jsxs(T,{className:"unsent-area",children:[e.jsxs(T,{children:[e.jsxs(de,{config:{status:"failed"},enableTooltip:!1,children:[Ce(O)," ",l("notification.sendStatus.failed")]}),e.jsxs(de,{config:{status:"pending"},enableTooltip:!1,children:[Ce(R)," ",l("notification.sendStatus.pending")]})]}),O>0&&e.jsx(T,{className:"resend-btn",children:e.jsx(me,{size:"small",color:"primary",loading:o,variant:"contained",startIcon:e.jsx(et,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:S,children:l("notification.resend")})})]})]})}function _e({statistics:n,mode:t="simple",onResend:s,resending:r}){const o=ce(()=>t==="simple"?nn(n):an(n,s,r),[n,t]);return t==="simple"?e.jsx("div",{children:o.map(l=>e.jsx(At,{style:{alignItems:"flex-start",marginBottom:t==="simple"?0:16},valueComponent:"div",nameWidth:100,name:l.name,children:l.value},l.name))}):e.jsx(dt,{container:!0,spacing:2,children:o.map(l=>e.jsx(dt,{item:!0,md:4,sm:6,xs:12,children:l.value},l.name))})}const rn=ue(T)`
|
|
31
31
|
display: flex;
|
|
32
32
|
flex-direction: column;
|
|
33
33
|
align-items: flex-start;
|
|
@@ -45,7 +45,7 @@ import{g as Ut,r as C}from"./vendor-react-DEoibe3W.js";import{ah as ue,al as ht,
|
|
|
45
45
|
bottom: 0;
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
`;Mt.propTypes={notification:x.object.isRequired,onCancel:x.func,blocklet:x.object.isRequired,tab:x.string};function Mt({notification:n,onCancel:t=()=>{},blocklet:s,tab:r="info"}){const{t:o,locale:l}=re(),{getComponent:y,resendNotification:p}=tt(),[h,i]=C.useState(!1),
|
|
48
|
+
`;Mt.propTypes={notification:x.object.isRequired,onCancel:x.func,blocklet:x.object.isRequired,tab:x.string};function Mt({notification:n,onCancel:t=()=>{},blocklet:s,tab:r="info"}){const{t:o,locale:l}=re(),{getComponent:y,resendNotification:p}=tt(),[h,i]=C.useState(!1),A=ce(()=>y(n.componentDid)||s,[s,n.componentDid]),O=Te({tab:r||"info"}),R=C.useCallback(async(c,g,j=!0,N=[])=>{var a;if(!c.length||!n.id)return;const E=g.length>0?g:(a=n==null?void 0:n.receivers)==null?void 0:a.map(m=>m.receiver);if(!E.length)return;let P=[...c];if(P.includes(W.NOTIFICATION_SEND_CHANNEL.PUSH)&&!Wt(s)&&(K.warning(o("notification.sendStatus.reason.unavailable",{channel:"Push Kit"})),P=P.filter(m=>m!==W.NOTIFICATION_SEND_CHANNEL.PUSH)),P.includes(W.NOTIFICATION_SEND_CHANNEL.EMAIL)&&!Bt(s)&&(K.warning(o("notification.sendStatus.reason.unavailable",{channel:"Email"})),P=P.filter(m=>m!==W.NOTIFICATION_SEND_CHANNEL.EMAIL)),!!P.length)try{i(!0),await p({notificationId:n.id,receivers:E,channels:P,resendFailedOnly:j,...P.includes("webhook")&&N.length?{webhookUrls:N}:{}}),K.success("Message has been sent!")}catch(m){console.error("handleResend error",{error:m}),K.error(m.response?m.response.statusText:m.message)}finally{i(!1)}},[s,n.id,n==null?void 0:n.receivers,p,o]),S=ce(()=>cs(n),[n]),D=ce(()=>ds(n),[n]),G=ce(()=>S?n==null?void 0:n.actorInfo:[],[n]),B=ce(()=>{var c;return(s==null?void 0:s.did)||((c=s==null?void 0:s.meta)==null?void 0:c.did)||""},[s]);function z(){return[{name:o("notification.from"),value:S&&D?e.jsx(hs,{actors:G,teamDid:B,size:32,showName:!0}):e.jsx(xs,{size:32,blocklet:A,showName:!0,hideDot:!0})},{name:o("notification.notificationTitle"),value:e.jsx(Re,{maxLength:50,children:n.title})},{name:o("notification.body"),value:S?e.jsx(gs,{notification:n,blocklet:s}):e.jsx(bs,{notification:n,rows:0})},{name:o("notification.severity"),value:e.jsx(Ne,{severity:n.severity})},{name:o("notification.createdAt"),value:e.jsx(is,{value:n.createdAt,locale:l,shouldUpdate:!0,type:"all"})}].map(g=>e.jsx(At,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:120,name:g.name,children:g.value},g.name))}const _={info:{label:o("common.basicInfo"),value:"info",component:z},receivers:{label:o("notification.receiver"),value:"receivers"},statistics:{label:o("notification.statistics"),value:"statistics"}},M=Object.values(_).map(({label:c,value:g})=>({label:c,value:g})),J=_[O.tab]||_.info,ie=c=>{O.tab=c};return e.jsx(Nt,{title:o("notification.notificationDetails"),fullWidth:!0,maxWidth:"lg",onClose:()=>{O.tab="info",t()},open:!0,actionsPosition:"left",sx:{".ux-dialog_header":{paddingBottom:0},".MuiDialogContent-root":{paddingTop:0}},children:e.jsxs(ln,{children:[e.jsx(T,{mx:3,className:"tabs",children:e.jsx(wt,{tabs:M,current:O.tab,onChange:ie,scrollButtons:"auto"})}),e.jsxs("div",{className:"body",children:[O.tab==="receivers"&&e.jsx(en,{notificationId:n.id,resending:h,handleResend:R}),O.tab==="statistics"&&e.jsx(_e,{statistics:n.statistics,mode:"detail",resending:h,onResend:R}),O.tab==="info"&&e.jsx(J.component,{})]})]})})}const on=C.memo(Mt),ln=ue.div`
|
|
49
49
|
& > .notification-row {
|
|
50
50
|
padding: 0;
|
|
51
51
|
}
|
|
@@ -76,7 +76,7 @@ import{g as Ut,r as C}from"./vendor-react-DEoibe3W.js";import{ah as ue,al as ht,
|
|
|
76
76
|
cursor: pointer;
|
|
77
77
|
&.disabled {
|
|
78
78
|
cursor: not-allowed;
|
|
79
|
-
color: ${
|
|
79
|
+
color: ${Ae.text.disabled};
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
}
|
|
@@ -92,7 +92,7 @@ import{g as Ut,r as C}from"./vendor-react-DEoibe3W.js";import{ah as ue,al as ht,
|
|
|
92
92
|
overflow: hidden;
|
|
93
93
|
text-overflow: ellipsis;
|
|
94
94
|
}
|
|
95
|
-
`;function we({blocklet:n,label:t}){var s;return e.jsx(cn,{children:n?e.jsxs(e.Fragment,{children:[e.jsx(Lt,{size:24,blocklet:n,ancestors:n.ancestors}),e.jsx("span",{className:"name",children:n.title||((s=n.meta)==null?void 0:s.title)})]}):e.jsx("span",{className:"name",children:t})})}ct.propTypes={list:x.array.isRequired,label:x.string.isRequired,onDelete:x.func};ct.defaultProps={onDelete:()=>{}};function ct({list:n,label:t,onDelete:s}){return e.jsxs(T,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(ae,{children:[t,": "]}),n.map(r=>e.jsx(Qe,{size:"small",label:e.jsx(T,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(Ne,{severity:r})}),onDelete:o=>s(o,r)},r))]})}function dn(n){return e.jsx(at,{...n,renderLabel:t=>e.jsx(Ne,{severity:t})})}function un({customTableButtons:n}){var je;const{t,locale:s}=re(),r=jt(),o=C.useMemo(()=>vt(r,qt()),[r]),[l,y]=C.useState(!1),{data:p,paging:h,blocklet:i,fetch:
|
|
95
|
+
`;function we({blocklet:n,label:t}){var s;return e.jsx(cn,{children:n?e.jsxs(e.Fragment,{children:[e.jsx(Lt,{size:24,blocklet:n,ancestors:n.ancestors}),e.jsx("span",{className:"name",children:n.title||((s=n.meta)==null?void 0:s.title)})]}):e.jsx("span",{className:"name",children:t})})}ct.propTypes={list:x.array.isRequired,label:x.string.isRequired,onDelete:x.func};ct.defaultProps={onDelete:()=>{}};function ct({list:n,label:t,onDelete:s}){return e.jsxs(T,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(ae,{children:[t,": "]}),n.map(r=>e.jsx(Qe,{size:"small",label:e.jsx(T,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(Ne,{severity:r})}),onDelete:o=>s(o,r)},r))]})}function dn(n){return e.jsx(at,{...n,renderLabel:t=>e.jsx(Ne,{severity:t})})}function un({customTableButtons:n}){var je;const{t,locale:s}=re(),r=jt(),o=C.useMemo(()=>vt(r,qt()),[r]),[l,y]=C.useState(!1),{data:p,paging:h,blocklet:i,fetch:A,getComponent:O,componentDids:R,inService:S,teamDid:D}=tt(),G=C.useRef(null),[B,z]=C.useState(null),[_,M]=C.useState("info"),J=Cs(),[ie,c]=C.useState(!1),g=`notification-records-${(je=i.meta)==null?void 0:je.did}`,j=as(g),[N,E]=C.useState({pageSize:j.rowsPerPage||10,page:j.page?j.page+1:1,dids:j.dids||[],dateRange:j.dateRange||[se().subtract(1,"month").startOf("day").toDate(),se().endOf("day").toDate()]}),P=ce(()=>{if(!i.children||!i.children.length)return[];const v=[];return i.children.forEach(b=>{var I;const w=b.did||((I=b.meta)==null?void 0:I.did);R.includes(w)&&(b.ancestors=[i],v.push(b))}),v},[R,i]),a=async v=>{try{y(!0),await A(v),y(!1)}finally{y(!1)}};C.useEffect(()=>{a(N)},[N]),C.useEffect(()=>{const v=p.find(b=>b.id===(B==null?void 0:B.id));B&&v&&z({...v})},[p]);const m=(v,b,w,I)=>{v.stopPropagation();const k=w.filter(F=>F!==b);E(F=>({...F,[I]:k,page:1}))},$=({page:v,rowsPerPage:b,filterList:w})=>{const[I=[],,,,k=[]]=w;N.pageSize!==b?E(F=>({...F,pageSize:b,page:1})):N.page!==v+1?E(F=>({...F,page:v+1})):ye(N.dids,I)?ye(N.severities,k)||E(F=>({...F,severities:k,page:1})):E(F=>({...F,dids:I,page:1}))},U=C.useCallback(()=>{z(null),M("info")},[]),oe=C.useCallback(()=>{A(N)},[A,N]),le=[{label:t("notification.from"),name:"sender",width:400,options:{filter:!0,filterType:"custom",customFilterListOptions:{render:v=>v.map((b,w)=>{var k;if(b==="system")return e.jsx("span",{children:t("notification.system")},`system-${w}`);const I=P.find(F=>{var d;return(F.did||((d=F.meta)==null?void 0:d.did))===b});return e.jsx(we,{blocklet:I,label:(I==null?void 0:I.title)||((k=I==null?void 0:I.meta)==null?void 0:k.title)},b)}),update:(v,b,w)=>(v[w].splice(b,1),v)},filterOptions:{names:P,logic:(v,b)=>b.length?!b.includes(v):!1,display:(v,b,w,I)=>e.jsxs(Y,{style:{width:"380px"},children:[e.jsx(Vt,{id:"demo-simple-select-label",style:{background:"#ffffff"},children:"Sender"}),e.jsxs(Yt,{multiple:!0,value:v[w],renderValue:k=>e.jsx(T,{display:"flex",gap:1,alignItems:"center",style:{overflow:"hidden",textOverflow:"ellipsis"},children:k.map(F=>{var d;if(F==="system")return e.jsx("span",{children:t("notification.system")},F);const ne=P.find(u=>{var L;return(u.did||((L=u.meta)==null?void 0:L.did))===F});return e.jsx(we,{blocklet:ne,label:(ne==null?void 0:ne.title)||((d=ne==null?void 0:ne.meta)==null?void 0:d.title)},F)})}),onChange:k=>{v[w]=k.target.value,b(v[w],w,I)},children:[e.jsx(ut,{value:"system",children:t("notification.system")}),P.map(k=>{var ne,d;const F=k.did||((ne=k.meta)==null?void 0:ne.did);return e.jsx(ut,{value:F,children:e.jsx(we,{blocklet:k,label:k.title||((d=k.meta)==null?void 0:d.title)})},F)})]})]})},customBodyRenderLite:v=>{var I,k;const b=p[v],w=O(b.componentDid);return e.jsxs(T,{display:"flex",alignItems:"center",gap:1,children:[w?e.jsx(Lt,{size:32,blocklet:w,ancestors:w.ancestors??[]}):e.jsx(js,{blocklet:i,size:32}),e.jsx(Re,{maxLength:50,children:((I=w==null?void 0:w.meta)==null?void 0:I.title)||((k=i==null?void 0:i.meta)==null?void 0:k.title)})]})}}},{label:t("notification.receiver"),name:"receivers",width:300,options:{filter:!1,customBodyRenderLite:v=>{const b=p[v],{receivers:w}=b;return e.jsx(Gt,{total:w.length,renderSurplus:I=>I<100?e.jsxs("span",{children:["+",I]}):e.jsx("span",{children:"99+"}),max:3,sx:{justifyContent:"flex-end",height:"32px",".MuiAvatar-root":{width:"32px",height:"32px",fontSize:"12px",border:0,zIndex:2}},onClick:I=>{I.stopPropagation(),z(b),M("receivers")},children:w.map(I=>{const{receiverUser:k}=I,F=Dt(k.avatar,D,S);return e.jsx(Tt,{alt:k.fullName,src:`${F}?imageFilter=resize&w=48&h=48`,size:32,did:I.receiver,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}},I.receiver)})})}}},{label:t("notification.statistics"),name:"statistics",width:400,options:{filter:!1,customBodyRenderLite:v=>{const b=p[v];return e.jsx(T,{onClick:w=>{w.stopPropagation(),z(b),M("statistics")},children:e.jsx(_e,{statistics:b.statistics})})}}},{label:t("notification.notificationPreview"),name:"data",options:{filter:!1,customBodyRenderLite:v=>{const b=p[v];return e.jsx(Re,{maxLength:50,children:b.title})}}},{label:t("notification.severity"),name:"severity",width:200,options:{setCellProps:()=>({className:"severity-cell"}),customBodyRenderLite:v=>{const b=p[v];return e.jsx(Ne,{severity:b.severity})},filter:!0,filterType:"custom",filterList:N.severities??[],customFilterListOptions:{render:v=>e.jsx(ct,{list:v,label:t("notification.severity"),onDelete:(b,w)=>{b.stopPropagation(),m(b,w,le[4].options.filterList,"severities")}}),update:Oe},filterOptions:{names:mt,fullWidth:!0,logic:De,display:(v,b,w,I)=>e.jsx(dn,{label:t("notification.severity"),filterList:v,onChange:b,index:w,column:I,filterValues:mt})}}},{label:t("common.createdAt"),name:"createdAt",width:300,options:{filter:!1,customBodyRenderLite:v=>{const{createdAt:b}=p[v];return e.jsx(Ot,{value:b,locale:s,shouldUpdate:!0})}}}],pe=v=>{E(b=>({...b,dateRange:v,page:1}))},be=[e.jsxs(T,{display:"flex",alignItems:"center",gap:1.5,children:[e.jsx(Jt,{onClick:()=>c(!0),sx:{p:J?0:void 0},children:e.jsx(os,{})},"settings"),J?e.jsx(ae,{children:t("common.setting")}):null]}),...n||[]];return e.jsxs(T,{ref:G,sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:[e.jsx(pn,{children:e.jsx(yt,{theme:o,children:e.jsx(Rt,{className:"main-table",verticalKeyWidth:100,loading:l,locale:s,columns:le,data:p,durable:g,onChange:$,options:{sort:!1,download:!1,print:!1,search:!1,expandableRowsOnClick:!0,page:h.page-1,rowsPerPage:h.pageSize,count:h.total,...j,onRowClick:(v,{dataIndex:b})=>{z(p[b])}},customPreButtons:[e.jsx(rt,{value:N.dateRange,onChange:pe})],customButtons:be,components:{TableFilterList:v=>e.jsx(ot,{...v,itemComponent:b=>e.jsx(Pe,{...b,canDelete:w=>{var k;const I=(k=w==null?void 0:w.columnNames)==null?void 0:k[(w==null?void 0:w.index)||0];return(I==null?void 0:I.name)==="sender"}})})}})})}),B&&e.jsx(on,{refresh:oe,onCancel:U,notification:B,blocklet:i,tab:_}),e.jsx(Nt,{title:`${t("common.notification")} ${t("common.setting")}`,fullWidth:!0,maxWidth:"md",open:ie,onClose:()=>c(!1),PaperProps:{style:{minHeight:"500px"}},children:e.jsx(T,{sx:{mt:"-16px",overflowY:"hidden"},children:e.jsx(Ds,{})})})]})}const pn=ue.div`
|
|
96
96
|
td.MuiTableCell-footer {
|
|
97
97
|
border: none !important;
|
|
98
98
|
}
|