@abtnode/blocklet-services 1.17.3-beta-20251125-042047-1bcefd39 → 1.17.3-beta-20251127-063055-94957209
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/api/libs/connect/session.js +9 -3
- package/api/middlewares/verify-sig.js +5 -2
- package/api/routes/user-session.js +17 -3
- package/api/services/auth/connect/gen-access-key.js +1 -0
- package/api/services/auth/connect/verify-destroy.js +32 -31
- package/api/services/auth/connect/verify-elevated.js +1 -0
- package/api/services/auth/session.js +65 -6
- package/dist/assets/{AdapterDayjs-BlYfODzx.js → AdapterDayjs-DlsssqYa.js} +1 -1
- package/dist/assets/{Google-BOjQI1aW.js → Google-D0eQfUdH.js} +1 -1
- package/dist/assets/{access-control-BYpTK1Jx.js → access-control-Danf5ySk.js} +1 -1
- package/dist/assets/{actions-DlChK31K.js → actions-DHp-gk7h.js} +1 -1
- package/dist/assets/{add-component-core-D0oHC7fD.js → add-component-core-Daobxf3I.js} +35 -35
- package/dist/assets/add-resource-C2oX_-Zz.js +1 -0
- package/dist/assets/{addon-BqtpB9zm.js → addon-Be4T3QjT.js} +2 -2
- package/dist/assets/{advanced-DOG5xuC6.js → advanced-kv_eujfj.js} +2 -2
- package/dist/assets/{aigne-Riqgm3Lb.js → aigne-vYtZdhdi.js} +1 -1
- package/dist/assets/api-C1vNuLNj.js +1 -0
- package/dist/assets/{appearance-CXwP8Jne.js → appearance-D_x7BGc3.js} +1 -1
- package/dist/assets/{arrow-down.svg-HIktmc0V.js → arrow-down.svg-OnWcVrr5.js} +1 -1
- package/dist/assets/{audit-logs-CW2G54hG.js → audit-logs-BnoJxxOA.js} +2 -2
- package/dist/assets/{authorize-BhLJa4gf.js → authorize-CEopc1Jx.js} +1 -1
- package/dist/assets/{base-chart-DkkGeB5D.js → base-chart-Cn6zWpXN.js} +1 -1
- package/dist/assets/{base32-DJEJY-PH.js → base32-DmEq36OL.js} +1 -1
- package/dist/assets/bind-account-CNpaY2P8.js +1 -0
- package/dist/assets/{branding-DTSiDrBa.js → branding-B4_lA6sS.js} +1 -1
- package/dist/assets/{branding-DBSJc5kU.js → branding-DQ5FtHfK.js} +5 -5
- package/dist/assets/branding-DW4NsL1y.js +1 -0
- package/dist/assets/{bundle-avatar-BDafezYn.js → bundle-avatar-mI1l0Wbs.js} +1 -1
- package/dist/assets/button-CX931aAr.js +1 -0
- package/dist/assets/click-to-copy-Cq4W-wkJ.js +1 -0
- package/dist/assets/{cloneDeep-C11iVb3m.js → cloneDeep-D_9o-MDF.js} +1 -1
- package/dist/assets/{collapse-Cqxx6nMG.js → collapse-DL7FXe7i.js} +1 -1
- package/dist/assets/{complete-CXzJOrTx.js → complete-CoMp3K_K.js} +2 -2
- package/dist/assets/{component-BULea2QE.js → component-DqnOhVec.js} +2 -2
- package/dist/assets/{config-DZ1Y7Xq7.js → config-BNoxsDyj.js} +1 -1
- package/dist/assets/{config-DCtQn6vd.js → config-DIElb3ko.js} +5 -5
- package/dist/assets/{config-BcSJ1q1-.js → config-l8EZr5wV.js} +1 -1
- package/dist/assets/{config-navigation-ByBnHQHM.js → config-navigation-CvEqeTCm.js} +2 -2
- package/dist/assets/{config-space-C_mTIBZt.js → config-space-D-JrZNQP.js} +1 -1
- package/dist/assets/{confirm-Dbm1_K3V.js → confirm-7CqzZykT.js} +1 -1
- package/dist/assets/connect-CL9-wlU7.js +1 -0
- package/dist/assets/{connect-CXsVfMPz.js → connect-HC_-YXp4.js} +1 -1
- package/dist/assets/connect-to-DNIdRfZG.js +1 -0
- package/dist/assets/{content-layout-DpoiOm37.js → content-layout-dv29oUBd.js} +1 -1
- package/dist/assets/{create-passport-svg-k1mCsufD.js → create-passport-svg-CESSejlW.js} +1 -1
- package/dist/assets/createClass-bIxJZr1p.js +1 -0
- package/dist/assets/{dashboard-d3oO4-H7.js → dashboard-D4m3zfEM.js} +2 -2
- package/dist/assets/{delete-confirm-B7aTZIom.js → delete-confirm-D1LtCumr.js} +1 -1
- package/dist/assets/{did-address-BKqL0vbP.js → did-address-gjwvc_rF.js} +1 -1
- package/dist/assets/domain-BSIx6Jyu.js +9 -0
- package/dist/assets/domain-action-card-uJMlNbM4.js +28 -0
- package/dist/assets/domains-DPyPBivZ.js +1 -0
- package/dist/assets/{email-BePrl9bL.js → email-ua9HtNUU.js} +1 -1
- package/dist/assets/{empty-spinner-CveVktQP.js → empty-spinner-v7NQTJhv.js} +1 -1
- package/dist/assets/engine-cCWGwlN6.js +1 -0
- package/dist/assets/{exchange-passport-BDqV_u7J.js → exchange-passport-ClnnHBna.js} +1 -1
- package/dist/assets/{form-B9hkpxrU.js → form-DswlznpT.js} +3 -3
- package/dist/assets/{form-text-input-gTokKFc6.js → form-text-input-BdG6b7xY.js} +1 -1
- package/dist/assets/{form-wrapper-BxqO_YSO.js → form-wrapper-D4szSlOw.js} +1 -1
- package/dist/assets/{fuel-C6dmw1cw.js → fuel-whr3Ilmj.js} +1 -1
- package/dist/assets/{gen-access-key-Cjv8m7fR.js → gen-access-key-DAhMUU-d.js} +1 -1
- package/dist/assets/{gen-simple-access-key-eehxq854.js → gen-simple-access-key-DS0CA98s.js} +1 -1
- package/dist/assets/get-safe-url-DFrG9umg.js +1 -0
- package/dist/assets/{home-CwhAaIFo.js → home-Co102dWk.js} +1 -1
- package/dist/assets/{iframe-DEV2d5VF.js → iframe-COJHAFfh.js} +1 -1
- package/dist/assets/{index-DDc9u4Rr.js → index-AgA4sW48.js} +1 -1
- package/dist/assets/{index-BIur1cqW.js → index-B7aKP8pi.js} +133 -131
- package/dist/assets/{index-JqMHvzVF.js → index-BKN6q696.js} +1 -1
- package/dist/assets/{index-BHAa27yd.js → index-BNDeY87F.js} +2 -2
- package/dist/assets/{index-DO0bEcmC.js → index-BbKEZuXu.js} +1 -1
- package/dist/assets/index-BbXRGcZW.js +7 -0
- package/dist/assets/{index-CnqI9e6Y.js → index-BgHe98gK.js} +1 -1
- package/dist/assets/{index-Bm3mNpuQ.js → index-BxqQFCR8.js} +1 -1
- package/dist/assets/{index-4y23Ltxs.js → index-C0q0zQTI.js} +4 -4
- package/dist/assets/{index-C4kgQ8sF.js → index-C9kZHU28.js} +13 -13
- package/dist/assets/{index-BojWO9M6.js → index-CCVrpeOq.js} +4 -4
- package/dist/assets/index-CEz-byBA.js +1 -0
- package/dist/assets/{index-BjgDA6OD.js → index-CIxFbeb7.js} +1 -1
- package/dist/assets/{index-B7KG9373.js → index-CcXTlGtY.js} +1 -1
- package/dist/assets/index-ClXbSPXF.js +6 -0
- package/dist/assets/{index-hlBFhmKM.js → index-CqjGrKtg.js} +11 -11
- package/dist/assets/index-CzmL_Hvj.js +30 -0
- package/dist/assets/{index-C3X2Qt8p.js → index-D1fu_Ebn.js} +6 -6
- package/dist/assets/{index-CrVvptJv.js → index-DIDsL1O1.js} +1 -1
- package/dist/assets/index-DJFOLfX2.js +120 -0
- package/dist/assets/{index-BnfMaesI.js → index-DMxyBvNb.js} +2 -2
- package/dist/assets/{index-BDvewqjE.js → index-DYMBrhSA.js} +1 -1
- package/dist/assets/{index-DwkwZleK.js → index-DgXRGMR4.js} +1 -1
- package/dist/assets/{index-BNrs0qJE.js → index-DmGYWcz-.js} +1 -1
- package/dist/assets/{index-BQCe_Idq.js → index-Dspz6jcA.js} +7 -7
- package/dist/assets/{index-D_y60Y0w.js → index-DwhuhEAl.js} +2 -2
- package/dist/assets/index-KEP7l6E2.js +124 -0
- package/dist/assets/{index-CM_wIB2i.js → index-Np46kKLW.js} +5 -5
- package/dist/assets/{index-0wVxGFHL.js → index-XWTmneBy.js} +1 -1
- package/dist/assets/index-ZUT_Qafk.js +1 -0
- package/dist/assets/index-cUf5_jCs.js +55 -0
- package/dist/assets/{index-Bqc4K0v7.js → index-it0t1NhB.js} +8 -8
- package/dist/assets/{index-CqaM-EOG.js → index-uV0wgve2.js} +1 -1
- package/dist/assets/{invitation-kL0fwsbQ.js → invitation-C_tg_ETR.js} +2 -2
- package/dist/assets/{invitations-BvSEdJgK.js → invitations-DfUvBLlf.js} +1 -1
- package/dist/assets/{invite--GT60aaK.js → invite-nGN9Oyh4.js} +1 -1
- package/dist/assets/{isURL-BxH0AREx.js → isURL-C5WG5wCh.js} +2 -2
- package/dist/assets/{issue-passport-CTdhlhaA.js → issue-passport-D9X0hPuR.js} +1 -1
- package/dist/assets/{item-Dc6RMbfp.js → item-CLLsRigr.js} +1 -1
- package/dist/assets/{landing-page-DhS1Z20a.js → landing-page-BCWLCQCC.js} +1 -1
- package/dist/assets/{launch-result-message-5HOBRYMn.js → launch-result-message-cNLFIi7R.js} +1 -1
- package/dist/assets/{layout-DHRHQ6Ja.js → layout-C7kocIsT.js} +1 -1
- package/dist/assets/list-CTOAY-ou.js +103 -0
- package/dist/assets/{list-Ck77b7zr.js → list-CoA75USb.js} +1 -1
- package/dist/assets/{list-header-Q-5QUSB8.js → list-header-C3sqYJbQ.js} +1 -1
- package/dist/assets/localization-B-Y1B8LC.js +1 -0
- package/dist/assets/{log-CItlTDaI.js → log-By5AyjAO.js} +1 -1
- package/dist/assets/logger-d9jkFx-x.js +1 -0
- package/dist/assets/login-DthiGxzS.js +1 -0
- package/dist/assets/{login-oauth-callback-2FXYOU0v.js → login-oauth-callback-1zhw-LOq.js} +1 -1
- package/dist/assets/{logo-uploader-ePo6dEBe.js → logo-uploader-BrImw7s9.js} +1 -1
- package/dist/assets/{lost-passport-ByGQpAao.js → lost-passport-BB122NeD.js} +2 -2
- package/dist/assets/{observability-BrLAcYkS.js → observability-BtYD0ieN.js} +1 -1
- package/dist/assets/{omit-CPVfFmp-.js → omit-BSwpPhgW.js} +1 -1
- package/dist/assets/{open-window-B9a2n1ab.js → open-window-DVvGcPv8.js} +1 -1
- package/dist/assets/over-due-invoice-payment-BDO7_XVI.js +1 -0
- package/dist/assets/{overview-Bz-93aQu.js → overview-DAMKF9mI.js} +2 -2
- package/dist/assets/{page-header-bY0dwe6y.js → page-header-DbMN84ZK.js} +1 -1
- package/dist/assets/passport-UxiDT8mW.js +1 -0
- package/dist/assets/{passport-item-02XietY5.js → passport-item-B2H7GQg8.js} +1 -1
- package/dist/assets/{permission-DonMH4GO.js → permission-D6_WOpI3.js} +1 -1
- package/dist/assets/{playground-QvTAmNqS.js → playground-NSs9sx7X.js} +1 -1
- package/dist/assets/preferences-DexmqT2T.js +1 -0
- package/dist/assets/profile-embed-z9JSgirN.js +1 -0
- package/dist/assets/publish-resource-TLVbUo-x.js +1 -0
- package/dist/assets/{react-beautiful-dnd.esm-DQ9oGom7.js → react-beautiful-dnd.esm-CK4sWF8a.js} +1 -1
- package/dist/assets/{react-stripe.esm-CT6ZhpE7.js → react-stripe.esm-DtEXX2jp.js} +1 -1
- package/dist/assets/{required-BuZo1JHj.js → required-Cwbcx6Cg.js} +1 -1
- package/dist/assets/runtime-CnztHx23.js +1 -0
- package/dist/assets/{sanitize-C43KM91h.js → sanitize-aIE75FMz.js} +1 -1
- package/dist/assets/sdk-CLOiRS-Q.js +1 -0
- package/dist/assets/{section-DDyoFT-o.js → section-Bq6cqwD2.js} +1 -1
- package/dist/assets/{security-FyECMbS9.js → security-4cho6HAg.js} +3 -3
- package/dist/assets/{session-BTb8wl7v.js → session-4l80Me2P.js} +1 -1
- package/dist/assets/{setup-ypEbm4Eq.js → setup-BtaOnq1y.js} +1 -1
- package/dist/assets/{shorten-label-BiZLRE-N.js → shorten-label-BugTCYOF.js} +1 -1
- package/dist/assets/{simple-select-DtG1nFIX.js → simple-select-BueAriVl.js} +1 -1
- package/dist/assets/{spaces-DYs0OAYx.js → spaces-iftz1eYH.js} +1 -1
- package/dist/assets/{start-C4TxbQLy.js → start-AVZVc08V.js} +1 -1
- package/dist/assets/{starting-progress-Chj0CxY0.js → starting-progress-KDLYjvJ9.js} +1 -1
- package/dist/assets/status-DfnitO-x.js +1 -0
- package/dist/assets/{step-actions-DH38z3VU.js → step-actions-CFyLVUSC.js} +1 -1
- package/dist/assets/{studio-Bp0H4t0T.js → studio-CuikMk9t.js} +1 -1
- package/dist/assets/{switch-control-DwAlFBVc.js → switch-control-tVHoI5QM.js} +1 -1
- package/dist/assets/{table-tips-Ccm9jBpV.js → table-tips-AK8Y4Q8i.js} +1 -1
- package/dist/assets/team-CsIX00_k.js +146 -0
- package/dist/assets/traffic-hGNEG2UT.js +1 -0
- package/dist/assets/{transfer-BG7xWrub.js → transfer-dv44R-B9.js} +1 -1
- package/dist/assets/{unsubscribe-DSkyz2VM.js → unsubscribe-B_7KhKwO.js} +1 -1
- package/dist/assets/{use-app-logo-BFST6ES5.js → use-app-logo-BebTliBo.js} +1 -1
- package/dist/assets/{use-mobile-BGG7EyYb.js → use-mobile-CbzGNuhc.js} +1 -1
- package/dist/assets/{use-mobile-yOnqxyr6.js → use-mobile-D-631edY.js} +1 -1
- package/dist/assets/{use-server-logo-CTR2UZFf.js → use-server-logo-BqPWSS3F.js} +1 -1
- package/dist/assets/{use-window-close-dG-tZxWF.js → use-window-close-Tv5rDlUk.js} +1 -1
- package/dist/assets/{useAsync-5gLXHIip.js → useAsync-CuuTq_2R.js} +1 -1
- package/dist/assets/{useAsync-tRHUJQgE.js → useAsync-Di_jotad.js} +1 -1
- package/dist/assets/{useAsyncRetry-MDM8jCoS.js → useAsyncRetry-D33rBUak.js} +1 -1
- package/dist/assets/{useLocalStorage-CbmitI3m.js → useLocalStorage-CNRBVDFF.js} +1 -1
- package/dist/assets/user-center-xqAXQ-SZ.js +126 -0
- package/dist/assets/{user-follower-C1piDLU7.js → user-follower-Dv6JnrUr.js} +1 -1
- package/dist/assets/{util-f7MvL9Y1.js → util-Cd42TaWI.js} +1 -1
- package/dist/assets/{util-DnwVtCGM.js → util-DzML57Qs.js} +1 -1
- package/dist/assets/{vendor-arcblock-DBEMYjVA.js → vendor-arcblock-D5spFpjt.js} +115 -114
- package/dist/assets/{vendor-hooks-L8kZVRUL.js → vendor-hooks-BeI8hpF9.js} +1 -1
- package/dist/assets/{vendor-mui-core-___CiWHn.js → vendor-mui-core-Et2SVbGP.js} +1 -1
- package/dist/assets/{vendor-mui-x-CYSdP1E1.js → vendor-mui-x-BIXAJqK8.js} +1 -1
- package/dist/assets/vendor-utils-DZwtp8ph.js +213 -0
- package/dist/assets/vendor-ux-Y094QNTK.js +1563 -0
- package/dist/assets/{wait-connect-DZgpTTEq.js → wait-connect-5-eiabIl.js} +1 -1
- package/dist/assets/{wizard-CJ7BZCtb.js → wizard-_JfH9fOz.js} +1 -1
- package/dist/assets/{wizard-components-B76v6J06.js → wizard-components-C_0333Fa.js} +1 -1
- package/dist/assets/wrap-locale-DFgLH2rd.js +1 -0
- package/dist/assets/{zh-DKry4WX-.js → zh-Czp7XVra.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/service-worker.js +1 -1
- package/package.json +49 -49
- package/dist/assets/add-resource-B2xSNzcX.js +0 -1
- package/dist/assets/api-DcGGeMWE.js +0 -1
- package/dist/assets/bind-account-D4LwpF_n.js +0 -1
- package/dist/assets/branding-9cA3lKG-.js +0 -1
- package/dist/assets/button-CjoOMC5b.js +0 -1
- package/dist/assets/click-to-copy-BiDS_MtA.js +0 -1
- package/dist/assets/connect-C-r3BWeJ.js +0 -1
- package/dist/assets/connect-to-CCVzHwv5.js +0 -1
- package/dist/assets/createClass-Bp8GWzB3.js +0 -1
- package/dist/assets/domain-action-card-EkcmMw2k.js +0 -28
- package/dist/assets/domain-m8Huj4md.js +0 -9
- package/dist/assets/domains-CAsFW9_K.js +0 -1
- package/dist/assets/engine-gKAOz9e-.js +0 -1
- package/dist/assets/get-safe-url-Co2dWyCH.js +0 -1
- package/dist/assets/index-B0WqCWI-.js +0 -120
- package/dist/assets/index-B0rTBLoN.js +0 -124
- package/dist/assets/index-B6xBjnTX.js +0 -7
- package/dist/assets/index-BBwCodqz.js +0 -29
- package/dist/assets/index-B_fIpHt1.js +0 -1
- package/dist/assets/index-DQzM4GY2.js +0 -1
- package/dist/assets/index-DqFnyJKg.js +0 -6
- package/dist/assets/index-dtMLN8cM.js +0 -55
- package/dist/assets/list-T1fFhSa4.js +0 -103
- package/dist/assets/localization-CAOwdbCu.js +0 -1
- package/dist/assets/logger-QD2VS2Mb.js +0 -1
- package/dist/assets/login-D1WURf8R.js +0 -1
- package/dist/assets/over-due-invoice-payment-jpkjPsJv.js +0 -1
- package/dist/assets/passport-07OMj8Ls.js +0 -1
- package/dist/assets/preferences-BmgCps_-.js +0 -1
- package/dist/assets/profile-embed-CPAhwziI.js +0 -1
- package/dist/assets/publish-resource-Dh5_JPm1.js +0 -1
- package/dist/assets/runtime-DUjTUa1p.js +0 -1
- package/dist/assets/sdk-CsmOR8Bd.js +0 -1
- package/dist/assets/status-Cui710vU.js +0 -1
- package/dist/assets/team-CHzBr-zx.js +0 -146
- package/dist/assets/traffic-Bqz8iC_Z.js +0 -1
- package/dist/assets/user-center-B8WTEd4Q.js +0 -126
- package/dist/assets/vendor-utils-Doa0RxLS.js +0 -213
- package/dist/assets/vendor-ux-pxYpYMxD.js +0 -1563
- package/dist/assets/wrap-locale-Dhik76XD.js +0 -1
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import{g as Bt,r as v}from"./vendor-react-CUXIiAnY.js";import{j as e,ak as S,z as X,b6 as me,bg as qe,y as V,am as ut,d8 as Wt,bn as qt,at as ie,b1 as mt,W as p,T as ee,U as Je,d9 as pt,b5 as Ke,a5 as Me,Q as Pe,da as Ge,aN as Ue,a6 as ft,D as ht,ci as Kt,ad as xt,db as Mt,dc as Ut,c2 as st,n as Ht,J as $t,x as Vt,bc as Jt,M as it,cx as Gt,I as Yt,dd as Qt}from"./vendor-mui-core-Et2SVbGP.js";import{A as gt,J as Xt,C as Zt,e as oe,F as en,a3 as je}from"./vendor-utils-DZwtp8ph.js";import{V as te,H as K,n as le,s as tn,A as bt,a2 as nn,aI as sn,m as jt,$ as vt,x as yt,aJ as ke,q as St,J as an,a9 as rn}from"./vendor-ux-Y094QNTK.js";import{aL as on,_ as Ye,ac as Ct,aA as wt,K as _e,c as B,a1 as Z,o as ln,aT as at}from"./index-B7aKP8pi.js";import{g as ye,b as $,a as se}from"./vendor-hooks-BeI8hpF9.js";import{u as Rt,C as Y}from"./index.esm-DTmS4tth.js";import{i as He}from"./isURL-C5WG5wCh.js";import{S as Q}from"./section-Bq6cqwD2.js";import{A as cn,a as dn,b as un}from"./collapse-DL7FXe7i.js";import{S as Se}from"./shorten-label-BugTCYOF.js";import{v as Tt}from"./index-XWTmneBy.js";import{R as Nt,A as mn,S as pn,a as fn,B as hn}from"./list-CTOAY-ou.js";import{j as xn,c as gn,N as bn}from"./team-CsIX00_k.js";import{W as jn}from"./did-address-gjwvc_rF.js";import{p as It}from"./util-Cd42TaWI.js";import{D as vn,g as yn}from"./traffic-hGNEG2UT.js";import{B as Et}from"./bundle-avatar-mI1l0Wbs.js";import{u as Sn}from"./use-mobile-D-631edY.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-D5spFpjt.js";import"./required-Cwbcx6Cg.js";import"./server-logo-notext.svg-DHxZ1bRk.js";import"./session-4l80Me2P.js";import"./use-app-logo-BebTliBo.js";import"./base32-DmEq36OL.js";import"./useAsyncRetry-D33rBUak.js";import"./useAsync-Di_jotad.js";import"./iframe-COJHAFfh.js";import"./index-ZUT_Qafk.js";import"./index-DBs9Ljax.js";import"./base-chart-Cn6zWpXN.js";import"./index-DYMBrhSA.js";import"./vendor-mui-x-BIXAJqK8.js";import"./AdapterDayjs-DlsssqYa.js";var Re={exports:{}},Te={exports:{}},Ne={exports:{}},rt;function Cn(){return rt||(rt=1,function(t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=n;function n(r){return r==null}t.exports=s.default,t.exports.default=s.default}(Ne,Ne.exports)),Ne.exports}var ot;function wn(){return ot||(ot=1,function(t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=f;var n=o(on()),r=o(Cn());function o(u){return u&&u.__esModule?u:{default:u}}var l=/^(?:[-+]?(?:0|[1-9][0-9]*))$/,j=/^[-+]?[0-9]+$/;function f(u,a){(0,n.default)(u),a=a||{};var y=a.allow_leading_zeroes===!1?l:j,R=!a.hasOwnProperty("min")||(0,r.default)(a.min)||u>=a.min,w=!a.hasOwnProperty("max")||(0,r.default)(a.max)||u<=a.max,b=!a.hasOwnProperty("lt")||(0,r.default)(a.lt)||u<a.lt,E=!a.hasOwnProperty("gt")||(0,r.default)(a.gt)||u>a.gt;return y.test(u)&&R&&w&&b&&E}t.exports=s.default,t.exports.default=s.default}(Te,Te.exports)),Te.exports}var lt;function Rn(){return lt||(lt=1,function(t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=o;var n=r(wn());function r(l){return l&&l.__esModule?l:{default:l}}function o(l){return(0,n.default)(l,{allow_leading_zeroes:!1,min:0,max:65535})}t.exports=s.default,t.exports.default=s.default}(Re,Re.exports)),Re.exports}var Tn=Rn();const Nn=Bt(Tn),ze={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:"",companyName:"",companyLink:"",companyAddress:"",supportEmail:""};function In(){const{api:t}=Ye(),{blocklet:s}=Ct(),{t:n}=te(),{confirmApi:r,confirmHolder:o}=wt(),l=s?.meta?.did,j=Object.assign({...ze},s?.settings?.notification?.email||{}),{handleSubmit:f,control:u,formState:a,watch:y,reset:R}=Rt({defaultValues:gt(j,Object.keys(ze))}),w=ye({testReceiver:"",testReceiverError:""}),b=y("enabled"),E=$(async(i,C,D=!0)=>{try{const{blocklet:O}=await t.configNotification({input:{did:l,notification:JSON.stringify({email:i})}}),ae=Object.assign({...ze},O?.settings?.notification?.email||{});R(ae),D&&K.success(n("oauth.saveSuccess"))}catch(O){if(D)K.error(O.message||n("oauth.saveFailed"));else throw O}}),J=$(async(i,C,D)=>{try{a.isDirty&&await E(i,C,!1),await t.sendEmail({input:{did:l,receiver:D,email:JSON.stringify({body:"Your SMTP configuration is correct!",title:"Test email",type:"notification",attachments:[{type:"link",data:{url:"https://community.arcblock.io",title:"Community",image:"https://community.arcblock.io/.well-known/service/blocklet/logo-rect-dark",utm:{campaign:"test-campaign"}}}],utm:{content:"test-email-button"}})}}),K.success(n("notification.email.testSuccess"))}catch(O){K.error(O.message||n("notification.email.testfailed"))}}),M=$((i,C)=>{w.testReceiver=localStorage.getItem("test-receiver")||"",w.testReceiverError="",r.open({title:n("notification.email.testSendEmail"),content:()=>e.jsx(S,{sx:{width:"300px"},children:e.jsx(X,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:n("notification.email.inputTestReceiver"),value:w.testReceiver,onChange:D=>{w.testReceiver=D.target.value},error:!!w.testReceiverError,helperText:w.testReceiverError||" "})}),confirmButtonText:n("common.confirm"),cancelButtonText:n("common.cancel"),async onConfirm(D){const O=w.testReceiver?.trim();if(!O){w.testReceiverError=n("notification.email.receiverRequired");return}if(!_e(O)){w.testReceiverError=n("notification.email.receiverInvalid");return}w.testReceiverError="",await J(i,C,O),D()}})}),P=$(i=>{const C=i?.trim();return C?_e(C)?!0:n("notification.email.fromInvalid"):n("notification.email.fromRequired")}),F=$(i=>{const C=i?.trim();return C?He(C,{require_host:!1,protocols:[]})?!0:n("notification.email.hostInvalid"):n("notification.email.hostRequired")}),N=$(i=>i?Nn(i)?!0:n("notification.email.portInvalid"):n("notification.email.portRequired")),W=$(i=>i?.trim()?!0:n("notification.email.userRequired")),q=$(i=>i?.trim()?!0:n("notification.email.passwordRequired")),h=$(i=>i?.trim()&&!He(i,{protocols:["http","https"],require_protocol:!0})?n("notification.email.linkInvalid"):!0),T=$(i=>i?.trim()&&!_e(i)?n("notification.email.emailInvalid"):!0),k=$(()=>!0);return e.jsxs(S,{children:[e.jsxs(En,{component:"form",onSubmit:f(E),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(Q,{title:n("notification.email.enable"),my:2.5,children:e.jsx(Y,{name:"enabled",control:u,render:({field:i})=>e.jsx(me,{control:e.jsx(qe,{checked:i.value,...i})})})}),e.jsx(Q,{title:n("notification.email.from"),children:e.jsx(Y,{name:"from",control:u,rules:{validate:b?P:k},render:({field:i})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...i,size:"small",required:!0,label:n("notification.email.from"),error:!!a.errors[i.name],helperText:a.errors[i.name]?.message||" ",disabled:!b})})})}),e.jsx(Q,{title:n("notification.email.host"),children:e.jsx(Y,{name:"host",control:u,rules:{validate:b?F:k},render:({field:i})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...i,size:"small",required:!0,error:!!a.errors[i.name],label:n("notification.email.host"),helperText:a.errors[i.name]?.message||" ",disabled:!b})})})}),e.jsx(Q,{title:n("notification.email.port"),children:e.jsx(Y,{name:"port",control:u,rules:{validate:b?N:k},render:({field:i})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...i,size:"small",required:!0,type:"number",error:!!a.errors[i.name],label:n("notification.email.port"),helperText:a.errors[i.name]?.message||" ",disabled:!b})})})}),e.jsx(Q,{title:n("notification.email.user"),children:e.jsx(Y,{name:"user",control:u,rules:{validate:b?W:k},render:({field:i})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...i,size:"small",required:!0,error:!!a.errors[i.name],label:n("notification.email.user"),helperText:a.errors[i.name]?.message||" ",disabled:!b})})})}),e.jsx(Q,{title:n("notification.email.password"),children:e.jsx(Y,{name:"password",control:u,rules:{validate:b?q:k},render:({field:i})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...i,size:"small",required:!0,type:"password",error:!!a.errors[i.name],label:n("notification.email.password"),helperText:a.errors[i.name]?.message||" ",disabled:!b})})})}),e.jsx(Q,{title:n("notification.email.secure"),children:e.jsx(Y,{name:"secure",control:u,rules:{validate:k},render:({field:i})=>e.jsx(V,{fullWidth:!0,children:e.jsx(me,{control:e.jsx(qe,{checked:i.value,...i,disabled:!b})})})})}),e.jsxs(cn,{children:[e.jsxs(dn,{expandIcon:e.jsx(qt,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:[n("notification.email.signature"),e.jsx(ut,{title:n("notification.email.signatureTooltip"),children:e.jsx(Wt,{fontSize:"small",sx:{ml:1,cursor:"help"}})})]}),e.jsxs(un,{children:[e.jsx(Q,{title:n("notification.email.companyName"),children:e.jsx(Y,{name:"companyName",control:u,rules:{validate:k},render:({field:i})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...i,size:"small",error:!!a.errors[i.name],label:n("notification.email.companyName"),helperText:a.errors[i.name]?.message||" ",disabled:!b})})})}),e.jsx(Q,{title:n("notification.email.companyLink"),children:e.jsx(Y,{name:"companyLink",control:u,rules:{validate:b?h:k},render:({field:i})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...i,size:"small",error:!!a.errors[i.name],label:n("notification.email.companyLink"),helperText:a.errors[i.name]?.message||" ",disabled:!b})})})}),e.jsx(Q,{title:n("notification.email.companyAddress"),children:e.jsx(Y,{name:"companyAddress",control:u,rules:{validate:k},render:({field:i})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...i,size:"small",error:!!a.errors[i.name],label:n("notification.email.companyAddress"),helperText:a.errors[i.name]?.message||" ",disabled:!b})})})}),e.jsx(Q,{title:n("notification.email.supportEmail"),children:e.jsx(Y,{name:"supportEmail",control:u,rules:{validate:b?T:k},render:({field:i})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...i,size:"small",type:"email",error:!!a.errors[i.name],label:n("notification.email.supportEmail"),helperText:a.errors[i.name]?.message||" ",disabled:!b})})})})]})]}),e.jsxs(S,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(le,{variant:"outlined",color:"warning",onClick:f(M),disabled:!b,children:n("oauth.runTest")}),e.jsx(le,{type:"submit",variant:"contained",disabled:!a.isDirty,children:n("oauth.save")})]})]}),o]})}const En=ie(mt)``,Be={enabled:!1,endpoint:"",did:void 0,pushPath:void 0};function kn(){const{api:t}=Ye(),{blocklet:s}=Ct(),{t:n}=te(),{confirmApi:r,confirmHolder:o}=wt(),l=s?.meta?.did,j=Object.assign({...Be},s?.settings?.notification?.pushKit||{}),{handleSubmit:f,control:u,formState:a,watch:y,reset:R}=Rt({defaultValues:gt(j,Object.keys(Be))}),w=ye({testReceiver:"",testReceiverError:""}),b=y("enabled"),E=$(async(N,W,q=!0)=>{try{const{blocklet:h}=await t.configNotification({input:{did:l,notification:JSON.stringify({pushKit:N})}}),T=Object.assign({...Be},h?.settings?.notification?.pushKit||{});R(T),q&&K.success(n("oauth.saveSuccess"))}catch(h){if(q)K.error(h.message||n("oauth.saveFailed"));else throw h}}),J=$(async(N,W)=>{try{a.isDirty&&await E(N,W,!1);const q=(s?.configs||[]).find(k=>k.key==="BLOCKLET_APP_URL")?.value,h=Xt(Zt(q,B.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo"),{v:s?.meta?.version,t:new Date(s?.updatedAt||0).getTime()}),T={type:"passthrough",passthroughType:"messageStatus",data:{message:{title:"Test push-kit notification",body:"This is message from push-kit config test",sender:{did:s?.appDid,fullName:s?.meta?.title,avatar:h}}}};await t.sendPush({input:{did:l,receiver:w.testReceiver,notification:JSON.stringify(T)}}),K.success(n("notification.pushKit.testSuccess"))}catch(q){K.error(q.message||n("notification.pushKit.testfailed"))}}),M=$((N,W)=>{w.testReceiverError="",r.open({title:n("notification.pushKit.testSend"),content:()=>e.jsx(S,{sx:{width:"450px",maxWidth:"100%"},children:e.jsx(X,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:n("notification.pushKit.inputTestReceiver"),value:w.testReceiver,onChange:q=>{w.testReceiver=q.target.value},error:!!w.testReceiverError,helperText:w.testReceiverError||" "})}),confirmButtonText:n("common.confirm"),cancelButtonText:n("common.cancel"),async onConfirm(q){if(!w.testReceiver?.trim()){w.testReceiverError=n("notification.pushKit.receiverRequired");return}w.testReceiverError="",await J(N,W),q()}})}),P=$(N=>{const W=N?.trim();return W?He(W)?!0:n("notification.pushKit.endpointInvalid"):n("notification.pushKit.endpointRequired")}),F=$(()=>!0);return e.jsxs(S,{children:[e.jsxs(An,{component:"form",onSubmit:f(E),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(Q,{title:n("notification.pushKit.enable"),my:2.5,children:e.jsx(Y,{name:"enabled",control:u,render:({field:N})=>e.jsx(me,{control:e.jsx(qe,{checked:N.value,...N})})})}),e.jsx(Q,{title:n("notification.pushKit.endpoint"),children:e.jsx(Y,{name:"endpoint",control:u,rules:{validate:b?P:F},render:({field:N})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...N,size:"small",required:!0,label:n("notification.pushKit.endpoint"),error:!!a.errors[N.name],helperText:a.errors[N.name]?.message||" ",disabled:!b})})})}),e.jsxs(Q,{title:n("notification.pushKit.customOptions"),children:[e.jsx(Y,{name:"did",control:u,render:({field:N})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...N,size:"small",label:n("notification.pushKit.did"),error:!!a.errors[N.name],helperText:a.errors[N.name]?.message||" ",disabled:!b})})}),e.jsx(Y,{name:"pushPath",control:u,render:({field:N})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...N,size:"small",label:n("notification.pushKit.pushPath"),error:!!a.errors[N.name],helperText:a.errors[N.name]?.message||" ",disabled:!b})})})]}),e.jsxs(S,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(le,{variant:"outlined",color:"warning",onClick:f(M),disabled:!b,children:n("oauth.runTest")}),e.jsx(le,{type:"submit",variant:"contained",disabled:!a.isDirty,children:n("oauth.save")})]})]}),o]})}const An=ie(mt)``,ct=[{label:e.jsx(S,{sx:{textAlign:"center",width:"100%"},children:"Email"}),value:"email"},{label:e.jsx(S,{sx:{textAlign:"center",width:"100%"},children:"Push Kit"}),value:"pushKit"}];function On(){const[t,s]=v.useState(ct[0].value),{locale:n}=v.useContext(tn),r=se(()=>({email:e.jsx(In,{}),pushKit:e.jsx(kn,{})}),[n]),o=v.useMemo(()=>({padding:"10px 0"}),[]);return e.jsxs(S,{children:[e.jsx(bt,{tabs:ct,current:t,onChange:s}),e.jsx(S,{style:o,children:r[t]})]})}const kt=v.createContext({}),{Provider:Dn,Consumer:Bs}=kt;function Ln({children:t,blocklet:s=""}){const{api:n,inService:r,ws:{useSubscription:o}}=Ye(),[l,j]=v.useState([]),[f,u]=v.useState({total:0,pageSize:20,pageCount:0,page:1}),a=se(()=>s.meta?.did,[s]),[y,R]=v.useState([]),[w,b]=v.useState({}),E=se(()=>l.length?new Set(l.map(h=>h.id)):new Set,[l]),J=async({page:h=1,pageSize:T=20,...k}={})=>{if(!a)return[];try{const i={paging:{page:h,pageSize:T},...k,teamDid:a,dateRange:k.dateRange?[Z(k.dateRange[0]).toISOString(),Z(k.dateRange[1]).toISOString()]:void 0},{dids:C,...D}=i;let O="";C&&C.includes("system")&&(O="system");const ae=C?C.filter(pe=>pe!=="system"):[],de={...D,source:O,componentDids:ae},re=await n.getNotificationSendLog({input:de});return b(de),j(re.list),u(re.paging),re.list}catch(i){return K.error(i.message),[]}},M=async()=>{const h=await n.getNotificationComponents({input:{teamDid:a}});R(h.componentDids)},P=v.useCallback(h=>{const T=s.children.find(k=>k.meta?.did===h);if(T)return T.ancestors=[s],T},[s]),F=async({notificationId:h,receivers:T,channels:k,...i})=>{await n.resendNotification({input:{teamDid:a,notificationId:h,receivers:T,channels:k.map(C=>C==="wallet"?B.NOTIFICATION_SEND_CHANNEL.WALLET:C==="pushKit"?B.NOTIFICATION_SEND_CHANNEL.PUSH:C),...i}})},N=v.useCallback(async h=>(await n.getUser({input:{teamDid:a,user:{did:h},options:{enableConnectedAccount:!0}}})).user,[n,a]),W=v.useCallback(async({page:h=1,pageSize:T=20,...k}={})=>{try{const i={paging:{page:h,pageSize:T},...k,userName:k.searchText||"",teamDid:a,dateRange:k.dateRange?[Z(k.dateRange[0]).toISOString(),Z(k.dateRange[1]).toISOString()]:void 0};return await n.getReceivers({input:i})}catch(i){throw K.error(i.message),i}},[n,a]);v.useEffect(()=>{a&&M()},[a]),o(B.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,h=>{E.has(h.notificationId)&&J(w)},[E,w]),o(B.EVENTS.NOTIFICATION_BLOCKLET_CREATE,h=>{E.has(h.id)||J(w)},[E,w]);const q={fetch:J,data:l,paging:f,blocklet:s,getComponent:P,resendNotification:F,getUser:N,componentDids:y,getReceivers:W,inService:r,teamDid:a};return e.jsx(Dn,{value:{notificationRecords:q},children:t})}function Qe(){const{notificationRecords:t}=v.useContext(kt);return t}Ce.propTypes={severity:p.oneOf(Object.values(["info","success","error","warning"])).isRequired};const Pn={info:"primary",success:"success",error:"error",warning:"warning"};function Ce({severity:t="info"}){return e.jsx(nn,{type:Pn[t],children:t})}const Fn=(t,s,n="")=>{if(!n||!s)return"";switch(n){case B.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:s});case B.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:s});case B.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:s});case B.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return n}};function At(t,s,n={}){const{status:r,updatedAt:o,reason:l="",channel:j="wallet"}=n,f=o?t("notification.sendStatus.sentTime",{date:ln(o,s)}):"",u=Fn(t,j,l);return r===B.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:f,reason:u}:r===B.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:f}:{status:"pending",title:t("notification.sendStatus.pending"),reason:u,sentTime:f}}const $e={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Ve=["wallet","pushKit","email"],dt=["info","success","error","warning"],Ot=t=>{const{settings:s}=t;return s?.notification?.email?.enabled},Dt=t=>{const{settings:s}=t;return s?.notification?.pushKit?.enabled},_n=(t,s)=>{const n=oe(s,"extra.notifications.email",!0);return{available:Ot(t),enabled:n}},zn=(t,s)=>{const n=oe(s,"extra.notifications.push",!0);return{available:Dt(t),enabled:n}},Bn=t=>({enabled:oe(t,"extra.notifications.wallet",!0)}),Wn=t=>({enabled:oe(t,"extra.webhooks",[]).length>0}),Ie=(t=3)=>new Promise(s=>{setTimeout(()=>{s()},t*1e3)}),qn=(t,s)=>s==="wallet"||s==="webhook"?[{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:s==="pushKit"||s==="email"?[{channel:s,type:"available",pass:t("notification.sendStatus.reason.available",{channel:s}),fail:t("notification.sendStatus.reason.unavailable",{channel:s})},{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:[],Ee=(t=[])=>{const s=Z().startOf("day");return t.filter(n=>Z(n.sendAt).isSame(s,"day")).length},Kn=(t,s="")=>{if(s&&Ve.includes(s)){const l=`${s}SendRecord`,j=oe(t,l,[]);return Ee(j)}const n=oe(t,"webhook",{}),r=Object.keys(n??{})??[];if(s&&r.includes(s)){const l=n[s]??[];return Ee(l)}const o={};return Ve.forEach(l=>{const j=`${l}SendRecord`,f=oe(t,j,[]),u=Ee(f);o[l]=u}),r.length>0&&r.forEach(l=>{const j=n[l]??[],f=Ee(j);o[l]=f}),o},Ae=(t,s,n)=>{if(!Array.isArray(t))throw new Error("Invalid filterList or index");return t[n].splice(s,1),t},Oe=(t,s)=>{if(!Array.isArray(s))throw new Error("filters must be an array");return s.length?!s.includes(t):!1},Mn=t=>{switch(t){case B.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case B.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case B.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case B.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},Lt=()=>({components:{MUIDataTableFilter:{styleOverrides:{header:{marginBottom:0,p:{margin:0}},root:{"& .MuiGrid-container":{marginTop:0,"& .MuiGrid-item":{paddingTop:0}}}}},MuiPopover:{styleOverrides:{root:{"&.MuiPopover-root":{"& .MuiPaper-root:has(.filter-container)":{width:"420px"}}}}}}});function ce({config:t,enableTooltip:s=!0,showTitle:n=!1,children:r=null}){const{status:o,title:l="",sentTime:j="",reason:f=""}=t,u=[l,f].filter(Boolean).join(", ");return e.jsx(ut,{title:s?e.jsxs(e.Fragment,{children:[e.jsx(ee,{color:"inherit",sx:{fontSize:12},children:u}),e.jsx("span",{children:j})]}):null,arrow:!0,placement:"top",children:e.jsxs(S,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(S,{sx:{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx(S,{style:{opacity:.15},sx:{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:$e[o]}}),e.jsx(S,{sx:{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:$e[o]}})]}),e.jsx(ee,{color:"inherit",sx:{fontSize:12},children:n?l:r})]})})}ce.propTypes={config:p.object.isRequired,enableTooltip:p.bool,showTitle:p.bool,children:p.node};De.propTypes={list:p.array.isRequired,label:p.string.isRequired,onDelete:p.func};function De({list:t,label:s,onDelete:n=()=>{}}){const{t:r,locale:o}=te();return e.jsxs(S,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsxs(ee,{children:[s,": "]}),t.map(l=>{const j=At(r,o,{status:l});return e.jsx(Je,{size:"small",label:e.jsx(S,{sx:{display:"flex",alignItems:"center",gap:"4px"},children:e.jsx(ce,{config:j,enableTooltip:!1,children:j.title})}),onDelete:f=>n(f,l)},l)})]})}Xe.propTypes={filterList:p.array.isRequired,onChange:p.func.isRequired,index:p.number.isRequired,column:p.object.isRequired,filterValues:p.array.isRequired,label:p.string.isRequired,renderLabel:p.func.isRequired};function Xe({filterList:t,onChange:s,index:n,column:r,filterValues:o,label:l,renderLabel:j}){return e.jsxs(V,{className:"filter-container",children:[e.jsx(pt,{component:"legend",children:l}),e.jsx(Ke,{row:!0,children:o.map(f=>e.jsx(me,{control:e.jsx(Me,{checked:t[n].indexOf(f.value??f)>-1,onChange:u=>{const a=[...t];u.target.checked?a[n]=[...a[n],f.value??f]:a[n]=a[n].filter(y=>y!==(f.value??f)),s(a[n],n,r)},name:f.value??f}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:j(f)})},f.value??f))})]})}function We(t){return e.jsx(Xe,{...t,renderLabel:s=>e.jsx(ce,{enableTooltip:!1,config:{status:s.status},children:s.label})})}xe.propTypes={status:p.number.isRequired,updatedAt:p.string.isRequired,reason:p.string,channel:p.string,onResend:p.func};function xe({status:t,updatedAt:s,reason:n="",channel:r="wallet",onResend:o}){const{t:l,locale:j}=te(),f=At(l,j,{status:t,updatedAt:s,reason:n,channel:r});return e.jsxs(S,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(ce,{config:f,showTitle:!0}),f.status!=="success"&&e.jsx(Pe,{className:"resend-btn",size:"small",startIcon:e.jsx(Ge,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:o,children:l("notification.resend")})]})}Ze.propTypes={value:p.array.isRequired,onChange:p.func};function Ze({value:t,onChange:s}){const{locale:n}=te(),r=Z().toDate(),[o,l]=v.useState(null),j=v.useCallback(a=>{l(o?null:a.currentTarget)},[o]),f=!!o,u=v.useCallback(a=>{if(!a.startDate||!a.endDate){K.error("Please select a date range");return}if(Z(a.startDate).isAfter(a.endDate)||!Z(a.startDate).isValid()||!Z(a.endDate).isValid()){K.error("Invalid date range");return}s([a.startDate,a.endDate]),l(null)},[s]);return e.jsxs("div",{children:[e.jsx(ee,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},sx:{mb:0},children:e.jsxs(Pe,{onClick:j,variant:"outlined",size:"small",color:"inherit",children:[at(t[0],n)," - ",at(t[1],n)]})}),e.jsx(Ue,{open:f,anchorEl:o,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(vn,{open:!0,maxDate:r,initialDateRange:{startDate:t[0],endDate:t[1]},toggle:j,definedRanges:yn(r),onChange:u})})]})}et.propTypes={itemComponent:p.elementType.isRequired};function et({itemComponent:t,...s}){const{t:n}=te();return!s?.filterList?.filter(o=>o.length).length?null:e.jsxs(S,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsx("div",{className:"toolbar-filter-title",children:n("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(sn.TableFilterList,{...s,ItemComponent:t})})]})}function tt({label:t,onDelete:s,canDelete:n=()=>!0,...r}){const o=s&&typeof s=="function"?s:void 0;let l=!0;return n&&typeof n=="function"&&(l=n({label:t,...r})),e.jsx(Je,{label:t,variant:"outlined",...o&&l?{onDelete:o}:{}})}tt.propTypes={label:p.string.isRequired,onDelete:p.func,canDelete:p.func};const Un=[{label:"Wallet",value:"app",checked:!0},{label:"Email",value:"email",checked:!0},{label:"Push Kit",value:"push",checked:!0},{label:"Webhook",value:"webhook",checked:!0}];Pt.propTypes={loading:p.bool,onCancel:p.func,onConfirm:p.func};function Pt({loading:t=!1,onCancel:s=()=>{},onConfirm:n=()=>{}}){const{t:r}=te(),[o,l]=v.useState(Un),[j,f]=v.useState(!0),u=(y,R)=>{R.checked=y.target.checked;const w=o.map(b=>({...b,checked:b.value===R.value?R.checked:b.checked}));l(w)},a=y=>{y.stopPropagation(),n({channels:o.filter(R=>R.checked).map(R=>R.value),isResendFailedOnly:j})};return e.jsxs(S,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(ee,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(S,{className:"choose-channel",children:e.jsxs(V,{component:"fieldset",variant:"standard",children:[e.jsx(pt,{component:"legend",children:r("notification.selectChannels")}),e.jsx(Ke,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:o.map(y=>e.jsx(me,{control:e.jsx(Me,{checked:y.checked,onChange:R=>u(R,y),name:y.value}),label:y.label},y.value))})]})}),e.jsx(S,{className:"resend-config-footer",children:e.jsx(Ke,{children:e.jsx(me,{control:e.jsx(Me,{checked:j,onChange:y=>f(y.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(S,{className:"resend-config-footer-tip",sx:{display:"flex",justifyContent:"flex-end",gap:1},children:[e.jsx(Pe,{onClick:y=>{y.stopPropagation(),s()},color:"inherit",children:r("common.cancel")}),e.jsxs(Pe,{onClick:a,color:"primary",disabled:t,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[t&&e.jsx(ft,{size:16}),r("common.confirm")]})]})]})}Ft.propTypes={notificationId:p.string.isRequired,handleResend:p.func,resending:p.bool};function Ft({notificationId:t,handleResend:s,resending:n=!1}){const{t:r,locale:o}=te(),l=ht(),j=v.useMemo(()=>jt(l,Lt()),[l]),{getReceivers:f,inService:u,teamDid:a,getUser:y,blocklet:R}=Qe(),[w,b]=v.useState(!1),[E,J]=v.useState([]),M=ye({anchorEl:null,position:null}),P=ye({anchorEl:null,position:null}),[F,N]=v.useState(null),[W,q]=v.useState({total:0,pageSize:10,pageCount:0,page:1}),[h,T]=v.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[Z().subtract(1,"month").startOf("day").toDate(),Z().endOf("day").toDate()]}),[k,i]=v.useState([]),C=[{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"}],D=async()=>{if(!w&&t)try{b(!0);const c=await f({notificationId:t,...h}),d=c.list.map(m=>({...m,receiverUser:{...m.receiverUser,avatar:It(m.receiverUser.avatar,a,u)}}));J(d),q(c.paging),b(!1)}catch(c){K.error(c.message),b(!1)}};v.useEffect(()=>{D()},[h]);const O=c=>{c.stopPropagation();const d=c.currentTarget;P.anchorEl=d;const m=d.getBoundingClientRect();P.position={top:m.top+window.scrollY,left:m.left+window.scrollX}},ae=c=>c.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(le,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(Ge,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:O,children:r("notification.resend")})}):null,de={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:W.page-1,rowsPerPage:W.pageSize,count:W.total,searchText:h.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:k,onRowSelectionChange:(c,d)=>{i(d.map(m=>m.dataIndex))},customToolbarSelect:ae},re=({page:c,rowsPerPage:d,searchText:m,filterList:A})=>{const[,U=[],ne=[],G=[]]=A;h.pageSize!==d?T(H=>({...H,pageSize:d,page:1})):h.page!==c+1?T(H=>({...H,page:c+1})):h.searchText!==m?T(H=>({...H,searchText:m,page:1})):je(U,h.walletSendStatus)?je(ne,h.pushKitSendStatus)?je(G,h.emailSendStatus)||T(H=>({...H,emailSendStatus:G,page:1})):T(H=>({...H,pushKitSendStatus:ne,page:1})):T(H=>({...H,walletSendStatus:U,page:1}))},pe=v.useCallback(async(c,d)=>{if(!d)return!1;const m=await y(d);return m?c==="wallet"?Bn(m):c==="email"?_n(R,m):c==="pushKit"?zn(R,m):c==="webhook"?Wn(m):!0:!1},[y,R]),Fe=v.useCallback(c=>qn(r,c),[r]),ue=()=>{M.anchorEl=null,M.position=null,N(null)},fe=()=>{P.anchorEl=null,P.position=null},we=async(c,d,m=!0,A="")=>{if(!(!d.length||!c.length))try{s(c,d,m,A),P.anchorEl||(await Ie(.5),ue())}catch(U){console.error("handleResend error",{error:U})}},g=async({channels:c,isResendFailedOnly:d})=>{const m=k.map(A=>E[A].receiver);await we(c,m,d),await Ie(.5),fe(),i([])},x=async(c,d=[],m=!0)=>{try{await we(["webhook"],[c.receiver],m,d)}catch(A){K.error(A.response?A.response.statusText:A.message)}},I=async(c,d,m,A=[],U=!0)=>{if(c.stopPropagation(),Kn(d,m)>=4){K.warning(r("notification.resendLimit"));return}if(!Ve.includes(m)){await x(d,A,U);return}if(c){const G=c.currentTarget,H=G.getBoundingClientRect();M.anchorEl=G,M.position={top:H.top+window.scrollY,left:H.left+window.scrollX}}N({channel:m});try{const G=await pe(m,d.receiver);await Ie(1),N({channel:m,result:G}),(typeof G=="boolean"&&G||en(G)&&Object.values(G).every(H=>!!H))&&(await s([m],[d.receiver],U),P.anchorEl||(await Ie(.5),ue()))}catch(G){K.error(G.message)}},_=c=>{T(d=>({...d,dateRange:c,page:1}))},z=(c,d,m,A)=>{c.stopPropagation();const U=m.filter(ne=>ne!==d);T(ne=>({...ne,[A]:U,page:1}))},L=se(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:c=>{const{receiverUser:d,receiver:m}=E[c];return d?e.jsxs(S,{"data-cy":`member-name-${d.fullName}`,sx:{display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start"},children:[e.jsx(vt,{src:`${d.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:m,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(Se,{children:d.fullName})]},m):e.jsx(jn,{size:14,responsive:!1,compact:!0,copyable:!1,did:m})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:h.walletSendStatus??[],customFilterListOptions:{render:c=>e.jsx(De,{list:c,label:"Wallet",onDelete:(d,m)=>{d.stopPropagation(),z(d,m,L[1].options.filterList,"walletSendStatus")}}),update:Ae},filterOptions:{names:C,fullWidth:!0,logic:Oe,display:(c,d,m,A)=>e.jsx(We,{label:"Wallet",filterList:c,onChange:d,index:m,column:A,filterValues:C})},customBodyRenderLite:c=>{const{walletSendStatus:d,walletSendAt:m,walletSendFailedReason:A}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:A,channel:"wallet",onResend:U=>I(U,E[c],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{pushKitSendStatus:d,pushKitSendAt:m,pushKitSendFailedReason:A}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:A,channel:"pushkit",onResend:U=>I(U,E[c],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:h.pushKitSendStatus??[],customFilterListOptions:{render:c=>e.jsx(De,{list:c,label:"Push Kit",onDelete:(d,m)=>{d.stopPropagation(),z(d,m,L[2].options.filterList,"pushKitSendStatus")}}),update:Ae},filterOptions:{names:C,fullWidth:!0,logic:Oe,display:(c,d,m,A)=>e.jsx(We,{label:"Push Kit",filterList:c,onChange:d,index:m,column:A,filterValues:C})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{emailSendStatus:d,emailSendAt:m,emailSendFailedReason:A}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:A,channel:"email",onResend:U=>I(U,E[c],"email",[],!1)})},filter:!0,filterType:"custom",filterList:h.emailSendStatus??[],customFilterListOptions:{render:c=>e.jsx(De,{list:c,label:"Email",onDelete:(d,m)=>{d.stopPropagation(),z(d,m,L[3].options.filterList,"emailSendStatus")}}),update:Ae},filterOptions:{names:C,fullWidth:!0,logic:Oe,display:(c,d,m,A)=>e.jsx(We,{label:"Email",filterList:c,onChange:d,index:m,column:A,filterValues:C})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{webhook:d}=E[c];if(!d)return null;const m=Object.entries(d)[0];if(!m)return null;const[A,U]=m,ne=U[0];return e.jsx(S,{sx:{display:"flex",flexDirection:"column",gap:1},children:e.jsxs(S,{className:"webhook-item",sx:{fontSize:12},children:[e.jsx(Se,{maxLength:30,children:A},A),e.jsx(xe,{status:ne.status,updatedAt:ne.sendAt,reason:ne.failedReason,channel:"webhook",onResend:G=>I(G,E[c],"webhook",[A],!1)})]},A)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:c=>{const{createdAt:d}=E[c];return e.jsx(Nt,{value:d,locale:o,shouldUpdate:!0})}}}],[E,o,h,r]),he=[e.jsx(Ze,{value:h.dateRange,onChange:_},"date-picker"),e.jsx(le,{variant:"contained",size:"small",color:"primary",loading:w,startIcon:e.jsx(Kt,{}),onClick:()=>D(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(S,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx($n,{children:e.jsxs(xt,{theme:j,children:[e.jsx(yt,{className:"receivers-table",locale:o,loading:w,columns:L,data:E,onChange:re,options:de,customButtons:he,components:{TableFilterList:c=>e.jsx(et,{...c,itemComponent:d=>e.jsx(tt,{...d,canDelete:()=>!1})})}}),M.anchorEl&&e.jsx(Ue,{open:!!M.anchorEl,anchorReference:"anchorPosition",anchorPosition:M.position,onClose:ue,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(Vn,{children:[e.jsxs(ee,{variant:"body1",component:"div",className:"check-title",children:[F?.channel," Checking"]}),e.jsx(S,{sx:{display:"flex",flexDirection:"column",gap:"4px"},children:Fe(F?.channel).map(c=>{const{type:d,pass:m,fail:A}=c;return!F?.result||F?.result?.[d]?e.jsxs(ee,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:F?.result?.[d]?ke.success.main:"inherit"},children:[F?.result?e.jsx(Mt,{}):e.jsx(ft,{size:12,sx:{color:ke.primary.main}}),e.jsx("span",{children:m})]},d):e.jsxs(ee,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:ke.error.main},children:[e.jsx(Ut,{}),e.jsx("span",{children:A})]},d)})})]})}),P.anchorEl&&e.jsx(Ue,{open:!!P.anchorEl,anchorReference:"anchorPosition",anchorPosition:P.position,onClose:fe,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(Pt,{loading:n,onCancel:fe,onConfirm:g})})]})})})}const Hn=v.memo(Ft),$n=ie.div`
|
|
2
|
+
td.MuiTableCell-footer {
|
|
3
|
+
border: none !important;
|
|
4
|
+
}
|
|
5
|
+
.sent-status-cell {
|
|
6
|
+
.resend-btn {
|
|
7
|
+
display: none;
|
|
8
|
+
}
|
|
9
|
+
&:hover {
|
|
10
|
+
.resend-btn {
|
|
11
|
+
display: flex;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
`,Vn=ie.div`
|
|
16
|
+
padding: 8px 16px;
|
|
17
|
+
.check-title {
|
|
18
|
+
font-weight: 500;
|
|
19
|
+
margin-bottom: 8px;
|
|
20
|
+
&::first-letter {
|
|
21
|
+
text-transform: uppercase;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
.check-item {
|
|
25
|
+
svg {
|
|
26
|
+
font-size: 16px;
|
|
27
|
+
}
|
|
28
|
+
font-size: 12px;
|
|
29
|
+
}
|
|
30
|
+
`,ve=t=>t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t;function Jn(t){const{wallet:s,push:n,email:r,webhook:o}=t;return[{name:"Wallet",value:e.jsx(ge,{item:s})},{name:"Push",value:e.jsx(ge,{item:n})},{name:"Email",value:e.jsx(ge,{item:r})},...o.total>0?[{name:"Webhook",value:e.jsx(ge,{item:o,isWebhook:!0})}]:[]]}function Gn(t,s,n){const{wallet:r,push:o,email:l,webhook:j}=t;return[{name:"Wallet",value:e.jsx(be,{loading:n,channel:B.NOTIFICATION_SEND_CHANNEL.WALLET,item:r,onResend:s})},{name:"Push",value:e.jsx(be,{loading:n,channel:B.NOTIFICATION_SEND_CHANNEL.PUSH,item:o,onResend:s})},{name:"Email",value:e.jsx(be,{loading:n,channel:B.NOTIFICATION_SEND_CHANNEL.EMAIL,item:l,onResend:s})},...j.total>0?[{name:"Webhook",value:e.jsx(be,{loading:n,channel:B.NOTIFICATION_SEND_CHANNEL.WEBHOOK,item:j,isWebhook:!0,onResend:s})}]:[]]}nt.propTypes={statistics:p.object.isRequired,onResend:p.func,mode:p.oneOf(["simple","detail"]),resending:p.bool};ge.propTypes={item:p.object.isRequired,isWebhook:p.bool};function ge({item:t,isWebhook:s=!1}){const{t:n}=te(),r=s?t.success.length:t.success,o=t.total,l=r===o?"success":"failed";return e.jsx(S,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:2},children:e.jsx(S,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsxs(ce,{config:{status:l},enableTooltip:!1,children:[ve(r)," / ",ve(o)," ",n("notification.sendStatus.success")]})})})}be.propTypes={item:p.object.isRequired,isWebhook:p.bool,channel:p.string,onResend:p.func,loading:p.bool};function be({channel:t=B.NOTIFICATION_SEND_CHANNEL.WALLET,item:s,isWebhook:n=!1,onResend:r=()=>{},loading:o=!1}){const{t:l}=te(),{success:j,failed:f,pending:u}=s,a=Mn(t),y=n?j.length:j,R=n?f.length:f,w=n?u.length:u,b=async P=>{P.stopPropagation();const F=n?[...new Set([...j,...f].map(N=>N))]:[];await r([t],[],!0,F)},E=y+R,J=E>0?y/E*100:0,M=E>0?R/E*100:0;return e.jsxs(Yn,{successRatio:J,failedRatio:M,children:[e.jsxs(ee,{variant:"h6",children:[a," (",s.total,")"]}),e.jsxs(ee,{variant:"body1",sx:{mb:2},children:[e.jsx("span",{style:{color:$e.success,fontWeight:600,fontSize:24},children:ve(y)}),e.jsx("small",{style:{paddingLeft:4},children:l("notification.sendStatus.success")})]}),e.jsxs(S,{className:"unsent-area",children:[e.jsxs(S,{children:[e.jsxs(ce,{config:{status:"failed"},enableTooltip:!1,children:[ve(R)," ",l("notification.sendStatus.failed")]}),e.jsxs(ce,{config:{status:"pending"},enableTooltip:!1,children:[ve(w)," ",l("notification.sendStatus.pending")]})]}),R>0&&e.jsx(S,{className:"resend-btn",children:e.jsx(le,{size:"small",color:"primary",loading:o,variant:"contained",startIcon:e.jsx(Ge,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:b,children:l("notification.resend")})})]})]})}function nt({statistics:t,mode:s="simple",onResend:n=()=>{},resending:r=!1}){const o=se(()=>s==="simple"?Jn(t):Gn(t,n,r),[t,s]);return s==="simple"?e.jsx("div",{children:o.map(l=>e.jsx(Tt,{style:{alignItems:"flex-start",marginBottom:s==="simple"?0:16},valueComponent:"div",nameWidth:100,name:l.name,children:l.value},l.name))}):e.jsx(st,{container:!0,spacing:2,children:o.map(l=>e.jsx(st,{size:{md:4,sm:6,xs:12},children:l.value},l.name))})}const Yn=ie(S)`
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
align-items: flex-start;
|
|
34
|
+
padding: 16px;
|
|
35
|
+
border-radius: 8px;
|
|
36
|
+
background: ${({successRatio:t,failedRatio:s,theme:n})=>t===0&&s===0?n.palette.grey[300]:`linear-gradient(to right, ${Ht(n.palette.success.light,.4)} ${t}%, ${n.palette.grey[100]} ${t}%)`};
|
|
37
|
+
transition: 'background 0.5s ease';
|
|
38
|
+
cursor: pointer;
|
|
39
|
+
.unsent-area {
|
|
40
|
+
width: 100%;
|
|
41
|
+
position: relative;
|
|
42
|
+
.resend-btn {
|
|
43
|
+
position: absolute;
|
|
44
|
+
right: 0;
|
|
45
|
+
bottom: 0;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
`;_t.propTypes={notification:p.object.isRequired,onCancel:p.func,blocklet:p.object.isRequired,tab:p.string};function _t({notification:t,onCancel:s=()=>{},blocklet:n,tab:r="info"}){const{t:o,locale:l}=te(),{getComponent:j,resendNotification:f}=Qe(),[u,a]=v.useState(!1),y=se(()=>j(t.componentDid)||n,[n,t.componentDid]),R=ye({tab:r||"info"}),w=v.useCallback(async(h,T,k=!0,i=[])=>{if(!h.length||!t.id)return;const C=T.length>0?T:t?.receivers?.map(O=>O.receiver);if(!C.length)return;let D=[...h];if(D.includes(B.NOTIFICATION_SEND_CHANNEL.PUSH)&&!Dt(n)&&(K.warning(o("notification.sendStatus.reason.unavailable",{channel:"Push Kit"})),D=D.filter(O=>O!==B.NOTIFICATION_SEND_CHANNEL.PUSH)),D.includes(B.NOTIFICATION_SEND_CHANNEL.EMAIL)&&!Ot(n)&&(K.warning(o("notification.sendStatus.reason.unavailable",{channel:"Email"})),D=D.filter(O=>O!==B.NOTIFICATION_SEND_CHANNEL.EMAIL)),!!D.length)try{a(!0),await f({notificationId:t.id,receivers:C,channels:D,resendFailedOnly:k,...D.includes("webhook")&&i.length?{webhookUrls:i}:{}}),K.success("Message has been sent!")}catch(O){console.error("handleResend error",{error:O}),K.error(O.response?O.response.statusText:O.message)}finally{a(!1)}},[n,t.id,t?.receivers,f,o]),b=se(()=>xn(t),[t]),E=se(()=>gn(t),[t]),J=se(()=>b?t?.actorInfo:[],[t]),M=se(()=>n?.did||n?.meta?.did||"",[n]);function P(){return[{name:o("notification.from"),value:b&&E?e.jsx(mn,{actors:J,teamDid:M,size:32,showName:!0}):e.jsx(pn,{size:32,blocklet:y,showName:!0,hideDot:!0})},{name:o("notification.notificationTitle"),value:e.jsx(Se,{maxLength:50,children:t.title})},{name:o("notification.body"),value:b?e.jsx(fn,{notification:t,blocklet:n}):e.jsx(bn,{notification:t,rows:0})},{name:o("notification.severity"),value:e.jsx(Ce,{severity:t.severity})},{name:o("notification.createdAt"),value:e.jsx(an,{value:t.createdAt,locale:l,shouldUpdate:!0,type:"all"})}].map(T=>e.jsx(Tt,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:120,name:T.name,children:T.value},T.name))}const F={info:{label:o("common.basicInfo"),value:"info",component:P},receivers:{label:o("notification.receiver"),value:"receivers"},statistics:{label:o("notification.statistics"),value:"statistics"}},N=Object.values(F).map(({label:h,value:T})=>({label:h,value:T})),W=F[R.tab]||F.info,q=h=>{R.tab=h};return e.jsx(St,{title:o("notification.notificationDetails"),fullWidth:!0,maxWidth:"lg",onClose:()=>{R.tab="info",s()},open:!0,actionsPosition:"left",sx:{".ux-dialog_header":{paddingBottom:0},".MuiDialogContent-root":{paddingTop:0}},children:e.jsxs(Xn,{children:[e.jsx(S,{className:"tabs",sx:{mx:3},children:e.jsx(bt,{tabs:N,current:R.tab,onChange:q,scrollButtons:"auto"})}),e.jsxs("div",{className:"body",children:[R.tab==="receivers"&&e.jsx(Hn,{notificationId:t.id,resending:u,handleResend:w}),R.tab==="statistics"&&e.jsx(nt,{statistics:t.statistics,mode:"detail",resending:u,onResend:w}),R.tab==="info"&&e.jsx(W.component,{})]})]})})}const Qn=v.memo(_t),Xn=ie.div`
|
|
49
|
+
& > .notification-row {
|
|
50
|
+
padding: 0;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.tabs {
|
|
54
|
+
margin: 0;
|
|
55
|
+
}
|
|
56
|
+
.body {
|
|
57
|
+
margin-top: 16px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.channel-item {
|
|
61
|
+
display: flex;
|
|
62
|
+
padding: 4px;
|
|
63
|
+
justify-content: flex-start;
|
|
64
|
+
align-items: center;
|
|
65
|
+
gap: 8px;
|
|
66
|
+
> p {
|
|
67
|
+
font-size: 15px;
|
|
68
|
+
}
|
|
69
|
+
.resend-btn {
|
|
70
|
+
svg {
|
|
71
|
+
font-size: 16px;
|
|
72
|
+
}
|
|
73
|
+
display: flex;
|
|
74
|
+
align-items: center;
|
|
75
|
+
font-size: 12px;
|
|
76
|
+
cursor: pointer;
|
|
77
|
+
&.disabled {
|
|
78
|
+
cursor: not-allowed;
|
|
79
|
+
color: ${ke.text.disabled};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
`;Le.propTypes={blocklet:p.object,label:p.string};const Zn=ie.div`
|
|
84
|
+
display: flex;
|
|
85
|
+
justify-items: flex-start;
|
|
86
|
+
align-items: center;
|
|
87
|
+
gap: 8px;
|
|
88
|
+
.name {
|
|
89
|
+
display: block;
|
|
90
|
+
max-width: 260px;
|
|
91
|
+
white-space: nowrap;
|
|
92
|
+
overflow: hidden;
|
|
93
|
+
text-overflow: ellipsis;
|
|
94
|
+
}
|
|
95
|
+
`;function Le({blocklet:t=null,label:s=""}){return e.jsx(Zn,{children:t?e.jsxs(e.Fragment,{children:[e.jsx(Et,{size:24,blocklet:t,ancestors:t.ancestors}),e.jsx("span",{className:"name",children:t.title||t.meta?.title})]}):e.jsx("span",{className:"name",children:s})})}zt.propTypes={list:p.array.isRequired,label:p.string.isRequired,onDelete:p.func};function zt({list:t,label:s,onDelete:n=()=>{}}){return e.jsxs(S,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsxs(ee,{children:[s,": "]}),t.map(r=>e.jsx(Je,{size:"small",label:e.jsx(S,{sx:{display:"flex",alignItems:"center",gap:"4px"},children:e.jsx(Ce,{severity:r})}),onDelete:o=>n(o,r)},r))]})}function es(t){return e.jsx(Xe,{...t,renderLabel:s=>e.jsx(Ce,{severity:s})})}function ts({customTableButtons:t}){const{t:s,locale:n}=te(),r=ht(),o=$t(r.breakpoints.down("sm")),l=v.useMemo(()=>jt(r,Lt()),[r]),[j,f]=v.useState(!1),{data:u,paging:a,blocklet:y,fetch:R,getComponent:w,componentDids:b,inService:E,teamDid:J}=Qe(),M=v.useRef(null),[P,F]=v.useState(null),[N,W]=v.useState("info"),q=Sn(),[h,T]=v.useState(!1),k=`notification-records-${y.meta?.did}`,i=rn(k),[C,D]=v.useState({pageSize:i.rowsPerPage||10,page:i.page?i.page+1:1,dids:i.dids||[],dateRange:i.dateRange||[Z().subtract(1,"month").startOf("day").toDate(),Z().endOf("day").toDate()]}),O=se(()=>{if(!y.children||!y.children.length)return[];const g=[];return y.children.forEach(x=>{const I=x.did||x.meta?.did;b.includes(I)&&(x.ancestors=[y],g.push(x))}),g},[b,y]),ae=async g=>{try{f(!0),await R(g),f(!1)}finally{f(!1)}};v.useEffect(()=>{ae(C)},[C]),v.useEffect(()=>{const g=u.find(x=>x.id===P?.id);P&&g&&F({...g})},[u]);const de=(g,x,I,_)=>{g.stopPropagation();const z=I.filter(L=>L!==x);D(L=>({...L,[_]:z,page:1}))},re=({page:g,rowsPerPage:x,filterList:I})=>{const[_=[],,,,z=[]]=I;C.pageSize!==x?D(L=>({...L,pageSize:x,page:1})):C.page!==g+1?D(L=>({...L,page:g+1})):je(C.dids,_)?je(C.severities,z)||D(L=>({...L,severities:z,page:1})):D(L=>({...L,dids:_,page:1}))},pe=v.useCallback(()=>{F(null),W("info")},[]),Fe=v.useCallback(()=>{R(C)},[R,C]),ue=[{label:s("notification.from"),name:"sender",width:400,options:{filter:!0,filterType:"custom",customFilterListOptions:{render:g=>g.map((x,I)=>{if(x==="system")return e.jsx("span",{children:s("notification.system")},`system-${I}`);const _=O.find(z=>(z.did||z.meta?.did)===x);return e.jsx(Le,{blocklet:_,label:_?.title||_?.meta?.title},x)}),update:(g,x,I)=>(g[I].splice(x,1),g)},filterOptions:{names:O,logic:(g,x)=>x.length?!x.includes(g):!1,display:(g,x,I,_)=>e.jsxs(V,{style:{width:"380px"},children:[e.jsx(Vt,{id:"demo-simple-select-label",style:{background:"#ffffff"},children:"Sender"}),e.jsxs(Jt,{multiple:!0,value:g[I],renderValue:z=>e.jsx(S,{style:{overflow:"hidden",textOverflow:"ellipsis"},sx:{display:"flex",gap:1,alignItems:"center"},children:z.map(L=>{if(L==="system")return e.jsx("span",{children:s("notification.system")},L);const he=O.find(c=>(c.did||c.meta?.did)===L);return e.jsx(Le,{blocklet:he,label:he?.title||he?.meta?.title},L)})}),onChange:z=>{g[I]=z.target.value,x(g[I],I,_)},children:[e.jsx(it,{value:"system",children:s("notification.system")}),O.map(z=>{const L=z.did||z.meta?.did;return e.jsx(it,{value:L,children:e.jsx(Le,{blocklet:z,label:z.title||z.meta?.title})},L)})]})]})},customBodyRenderLite:g=>{const x=u[g],I=w(x.componentDid);return e.jsxs(S,{sx:{display:"flex",alignItems:"center",gap:1},children:[I?e.jsx(Et,{size:32,blocklet:I,ancestors:I.ancestors??[]}):e.jsx(hn,{blocklet:y,size:32}),e.jsx(Se,{maxLength:50,children:I?.meta?.title||y?.meta?.title})]})}}},{label:s("notification.receiver"),name:"receivers",width:300,options:{filter:!1,customBodyRenderLite:g=>{const x=u[g],{receivers:I}=x;return e.jsx(Gt,{total:I.length,renderSurplus:_=>_<100?e.jsxs("span",{children:["+",_]}):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:_=>{_.stopPropagation(),F(x),W("receivers")},children:I.map(_=>{const{receiverUser:z}=_,L=It(z.avatar,J,E);return e.jsx(vt,{alt:z.fullName,src:`${L}?imageFilter=resize&w=48&h=48`,size:32,did:_.receiver,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}},_.receiver)})})}}},{label:s("notification.statistics"),name:"statistics",width:400,options:{filter:!1,customBodyRenderLite:g=>{const x=u[g];return e.jsx(S,{onClick:I=>{I.stopPropagation(),F(x),W("statistics")},children:e.jsx(nt,{statistics:x.statistics})})}}},{label:s("notification.notificationPreview"),name:"data",options:{filter:!1,customBodyRenderLite:g=>{const x=u[g];return e.jsx(Se,{maxLength:50,children:x.title})}}},{label:s("notification.severity"),name:"severity",width:200,options:{setCellProps:()=>({className:"severity-cell"}),customBodyRenderLite:g=>{const x=u[g];return e.jsx(Ce,{severity:x.severity})},filter:!0,filterType:"custom",filterList:C.severities??[],customFilterListOptions:{render:g=>e.jsx(zt,{list:g,label:s("notification.severity"),onDelete:(x,I)=>{x.stopPropagation(),de(x,I,ue[4].options.filterList,"severities")}}),update:Ae},filterOptions:{names:dt,fullWidth:!0,logic:Oe,display:(g,x,I,_)=>e.jsx(es,{label:s("notification.severity"),filterList:g,onChange:x,index:I,column:_,filterValues:dt})}}},{label:s("common.createdAt"),name:"createdAt",width:300,options:{filter:!1,customBodyRenderLite:g=>{const{createdAt:x}=u[g];return e.jsx(Nt,{value:x,locale:n,shouldUpdate:!0})}}}],fe=g=>{D(x=>({...x,dateRange:g,page:1}))},we=[e.jsxs(S,{sx:{display:"flex",alignItems:"center",gap:1.5},children:[e.jsx(Yt,{onClick:()=>T(!0),sx:{p:q?0:void 0},children:e.jsx(Qt,{})},"settings"),q?e.jsx(ee,{children:s("common.setting")}):null]}),...t||[]];return e.jsxs(S,{ref:M,sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:[e.jsx(ns,{isBreakpointsDownSm:o,children:e.jsx(xt,{theme:l,children:e.jsx(yt,{className:"main-table",verticalKeyWidth:100,loading:j,locale:n,columns:ue,data:u,durable:k,onChange:re,options:{sort:!1,download:!1,print:!1,search:!1,expandableRowsOnClick:!0,page:a.page-1,rowsPerPage:a.pageSize,count:a.total,...i,onRowClick:(g,{dataIndex:x})=>{F(u[x])}},title:e.jsx(Ze,{value:C.dateRange,onChange:fe}),customButtons:we,components:{TableFilterList:g=>e.jsx(et,{...g,itemComponent:x=>e.jsx(tt,{...x,canDelete:I=>I?.columnNames?.[I?.index||0]?.name==="sender"})})}})})}),P&&e.jsx(Qn,{refresh:Fe,onCancel:pe,notification:P,blocklet:y,tab:N}),e.jsx(St,{title:`${s("common.notification")} ${s("common.setting")}`,fullWidth:!0,maxWidth:"md",open:h,onClose:()=>T(!1),PaperProps:{style:{minHeight:"500px"}},children:e.jsx(S,{sx:{mt:"-16px",overflowY:"hidden"},children:e.jsx(On,{})})})]})}const ns=ie.div`
|
|
96
|
+
td.MuiTableCell-footer {
|
|
97
|
+
border: none !important;
|
|
98
|
+
}
|
|
99
|
+
.sent-status-cell {
|
|
100
|
+
.resend-btn {
|
|
101
|
+
display: none;
|
|
102
|
+
}
|
|
103
|
+
&:hover {
|
|
104
|
+
.resend-btn {
|
|
105
|
+
display: flex;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.custom-toobar-btns {
|
|
111
|
+
gap: 4px;
|
|
112
|
+
}
|
|
113
|
+
.custom-toobar-title-inner {
|
|
114
|
+
display: flex;
|
|
115
|
+
justify-content: ${({isBreakpointsDownSm:t})=>t?"space-between":"flex-end"};
|
|
116
|
+
padding-right: ${({isBreakpointsDownSm:t})=>t?"0":"8px"};
|
|
117
|
+
flex-wrap: wrap;
|
|
118
|
+
gap: 8px;
|
|
119
|
+
}
|
|
120
|
+
`;ss.propTypes={blocklet:p.object.isRequired,customTableButtons:p.array};function ss({blocklet:t={},customTableButtons:s=[]}){return e.jsx(Ln,{blocklet:t,children:e.jsx(ts,{customTableButtons:s})})}export{ss as default};
|