@abtnode/webapp 1.17.6-beta-20251218-120326-5b44dadf → 1.17.6-beta-20251219-114550-06c96cf5
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/blocklet.js +1 -1
- package/blocklet.yml +1 -1
- package/dist/assets/{AdapterDayjs-DbXM02a3.js → AdapterDayjs-BjFsoQ-w.js} +1 -1
- package/dist/assets/{Add-17-jFd7z.js → Add-DwgbzyUw.js} +1 -1
- package/dist/assets/ArrowDropDown-CbNJotqT.js +1 -0
- package/dist/assets/{Autocomplete-C8NhTbRF.js → Autocomplete-Dm1_2YSl.js} +1 -1
- package/dist/assets/{Breadcrumbs-8EmlaNJn.js → Breadcrumbs-CJg6cGOH.js} +1 -1
- package/dist/assets/{ButtonGroup-BI0yydFN.js → ButtonGroup-Td8BNrZx.js} +1 -1
- package/dist/assets/{CSSTransition-680AnN9b.js → CSSTransition-y8iKTN7d.js} +1 -1
- package/dist/assets/{CallMerge-BWum6aKS.js → CallMerge-KptmKwB4.js} +1 -1
- package/dist/assets/{CardContent-Be8HVTG5.js → CardContent-ewSbhAdG.js} +1 -1
- package/dist/assets/{ChevronLeft-Bqr4v0-x.js → ChevronLeft-nSrR9D_I.js} +1 -1
- package/dist/assets/{ChevronRight-C92WXl3G.js → ChevronRight-CRb5GVq5.js} +1 -1
- package/dist/assets/{Clear-BEIkQJ0G.js → Clear-CP-1JSsG.js} +1 -1
- package/dist/assets/{Delete-etfqa5ht.js → Delete-zum6vOfn.js} +1 -1
- package/dist/assets/{DeleteOutline-Cbw_xWxX.js → DeleteOutline-BRn6KXm4.js} +1 -1
- package/dist/assets/{Done-BmIqndwD.js → Done-BD3-Bno_.js} +1 -1
- package/dist/assets/{Edit-C2AKW3eS.js → Edit-fbuEYDWz.js} +1 -1
- package/dist/assets/{ErrorOutline-ClnZlnrx.js → ErrorOutline-eTinVSTi.js} +1 -1
- package/dist/assets/{FilterList-CZU1TLat.js → FilterList-CoptEImh.js} +1 -1
- package/dist/assets/{Google-P_iv8JkV.js → Google-DYe0WpSM.js} +1 -1
- package/dist/assets/{HelpOutline-OXFYzlS-.js → HelpOutline-CTq25q-V.js} +1 -1
- package/dist/assets/{KeyboardArrowDown-CPhWpi6G.js → KeyboardArrowDown-DBKPniSI.js} +1 -1
- package/dist/assets/{Launch-Cqfwr2jr.js → Launch-BMpdke3b.js} +1 -1
- package/dist/assets/{Link-3-c9oFLq.js → Link-Bum1u5am.js} +1 -1
- package/dist/assets/{ListItemButton-B_8LnCjp.js → ListItemButton-DAHFrrOj.js} +1 -1
- package/dist/assets/{ListSubheader-4ZgX-yqr.js → ListSubheader-DmTgdBz5.js} +1 -1
- package/dist/assets/{LoadingButton-DlIR2Kfo.js → LoadingButton-Hr-4vZXO.js} +1 -1
- package/dist/assets/{MoreVert-C4JPmAZs.js → MoreVert-Bs574HAx.js} +1 -1
- package/dist/assets/{OpenInNew-BIfjUAPQ.js → OpenInNew-Df7bSVHt.js} +1 -1
- package/dist/assets/{Refresh-Dpf0qLZl.js → Refresh-mfLuZ9Wj.js} +1 -1
- package/dist/assets/{Replay-B86FlV2V.js → Replay-CUAnOum2.js} +1 -1
- package/dist/assets/{Search-D5OHIH5t.js → Search-CCrESOjg.js} +1 -1
- package/dist/assets/{Stepper-k2fg0C07.js → Stepper-CDtZbh-4.js} +1 -1
- package/dist/assets/{TableSearch-DKi7Ktdg.js → TableSearch-hUcYhTcB.js} +1 -1
- package/dist/assets/{ToggleButtonGroup-DjxoDLGP.js → ToggleButtonGroup-B8Mjp9ll.js} +1 -1
- package/dist/assets/{UnfoldMore-BlVk7See.js → UnfoldMore-DDQ8EkCp.js} +1 -1
- package/dist/assets/{Verified-6JELqJq_.js → Verified-D2LDOD6a.js} +1 -1
- package/dist/assets/{VerifiedUser-Bglv4i1U.js → VerifiedUser-dJrRBh25.js} +1 -1
- package/dist/assets/{ViewList-YgHYVpVp.js → ViewList-Dd0smq67.js} +1 -1
- package/dist/assets/{_createAggregator-B12F8TpH.js → _createAggregator-Btgpq5ky.js} +1 -1
- package/dist/assets/{actions-BUAriJOB.js → actions-Bsd5QbHY.js} +1 -1
- package/dist/assets/{actions-DS_Ri_37.js → actions-PjGF5ddj.js} +1 -1
- package/dist/assets/{agreement-r1s2sh3Y.js → agreement-CR0Ele2A.js} +1 -1
- package/dist/assets/api-IHWlq8qW.js +1 -0
- package/dist/assets/{appearance-aM7wH57p.js → appearance-Dde_YYZa.js} +1 -1
- package/dist/assets/{audit-logs-zQaiGV7b.js → audit-logs-BA1_e5TT.js} +1 -1
- package/dist/assets/{base-chart-ADeRHccn.js → base-chart-DoQaNYbB.js} +1 -1
- package/dist/assets/{blocklet-BmfFK15q.js → blocklet-9wr_FD8g.js} +1 -1
- package/dist/assets/{chain-B7t_6AFd.js → chain-xcMn0w3E.js} +1 -1
- package/dist/assets/{click-to-copy-B1Ez8jE-.js → click-to-copy-BkgGJ2iu.js} +1 -1
- package/dist/assets/cloneDeep-DvQOj2-I.js +1 -0
- package/dist/assets/{config-navigation-B481mXc2.js → config-navigation-B8xULYAA.js} +21 -21
- package/dist/assets/{connect-to-CIL-wYnq.js → connect-to-D7kv9JZG.js} +2 -2
- package/dist/assets/{cssMode-Rm-CifKW.js → cssMode-CrKT5NTU.js} +1 -1
- package/dist/assets/{delete-confirm-CuK1fe0a.js → delete-confirm-DsbMbRAa.js} +1 -1
- package/dist/assets/{depsEqual-Cn18gXKK.js → depsEqual-BIKlqTyk.js} +1 -1
- package/dist/assets/{detail-IsCuaNgz.js → detail-Y8udUtll.js} +3 -3
- package/dist/assets/{domains-C6NvGCZC.js → domains-B-frEuQt.js} +1 -1
- package/dist/assets/{download-Bi8Vdh5L.js → download-DjEQp-4L.js} +1 -1
- package/dist/assets/{edit.svg-17FJ505g.js → edit.svg-_S0cvmEV.js} +1 -1
- package/dist/assets/emotion-cache.browser.esm-B4otC3_4.js +1 -0
- package/dist/assets/engine-B_GmO38d.js +1 -0
- package/dist/assets/{freemarker2-d8rE1704.js → freemarker2-DMLRgxDr.js} +1 -1
- package/dist/assets/{get-safe-url-CDPasMZR.js → get-safe-url-DcDP4eG0.js} +1 -1
- package/dist/assets/getValidReactChildren-DUKHPCTn.js +1 -0
- package/dist/assets/{graphqlMode-DBqrr_Ti.js → graphqlMode-BF3BGh5s.js} +2 -2
- package/dist/assets/{handlebars-cbZ5wMAy.js → handlebars-D79JLSFR.js} +1 -1
- package/dist/assets/{html-BQvWPc3p.js → html-BnBm7tse.js} +1 -1
- package/dist/assets/{html-title-DCtKzGAT.js → html-title-CFJOQU04.js} +1 -1
- package/dist/assets/{htmlMode-Cmym7gaz.js → htmlMode-Dbi5GsHR.js} +1 -1
- package/dist/assets/{iframe-Db5U2ou8.js → iframe-DTPDSES_.js} +1 -1
- package/dist/assets/{index-DExySHId.js → index-8vHqMMTo.js} +1 -1
- package/dist/assets/{index-YVUABogE.js → index-B3S0fIB2.js} +1 -1
- package/dist/assets/{index-CG4ppk8J.js → index-B3f37Bjf.js} +1 -1
- package/dist/assets/{index-B-CzffZS.js → index-B6CCglEp.js} +1 -1
- package/dist/assets/{index-DGikbjUL.js → index-BESOxZme.js} +1 -1
- package/dist/assets/{index-DWu1iSJu.js → index-BOjP8MFh.js} +1 -1
- package/dist/assets/{index-Cbdkr0wH.js → index-BprceCor.js} +1 -1
- package/dist/assets/{index-CNDdV4IL.js → index-Br_3Odot.js} +1 -1
- package/dist/assets/{index-CB511uzw.js → index-BruXFS68.js} +1 -1
- package/dist/assets/{index-Bm0XXN_O.js → index-C-G6LjU2.js} +1 -1
- package/dist/assets/{index-nv0vusfQ.js → index-C0xGIN2P.js} +1 -1
- package/dist/assets/{index-B8HlSswG.js → index-C4bxvfjr.js} +1 -1
- package/dist/assets/{index-BBX_ii_N.js → index-C6w6MwHd.js} +1 -1
- package/dist/assets/{index-uYv-1R7S.js → index-CSqb8yB_.js} +1 -1
- package/dist/assets/{index-CpezWuja.js → index-CZVZy3tE.js} +1 -1
- package/dist/assets/{index-BiJP3v8L.js → index-CaHbIkEa.js} +1 -1
- package/dist/assets/{index-Bzx8w-Mu.js → index-CeVw-yV4.js} +1 -1
- package/dist/assets/{index-688fVCdg.js → index-Cj3feFCu.js} +1 -1
- package/dist/assets/{index-DT3F-KxU.js → index-CnaB1RS2.js} +1 -1
- package/dist/assets/{index-B9EmgVee.js → index-Cqnb030V.js} +1 -1
- package/dist/assets/{index-BjARkkNc.js → index-Crh7ejXx.js} +3 -3
- package/dist/assets/{index-C2xdmced.js → index-CsR2mhWN.js} +1 -1
- package/dist/assets/{index-uT6ey1Ij.js → index-CusFNu14.js} +1 -1
- package/dist/assets/{index-D4-1sQAl.js → index-Cy1gRvjJ.js} +1 -1
- package/dist/assets/{index-CZSoNWI1.js → index-CySEKiOM.js} +1 -1
- package/dist/assets/{index-BT4EuDNg.js → index-D09yH344.js} +1 -1
- package/dist/assets/{index-C1ATBIiS.js → index-D49gl1dV.js} +1 -1
- package/dist/assets/{index-CpRoN1v3.js → index-DAIx6BU9.js} +9 -9
- package/dist/assets/{index-B4wihLhl.js → index-DAzO4vT3.js} +1 -1
- package/dist/assets/{index-CWj_8JE3.js → index-DKlmfMu8.js} +1 -1
- package/dist/assets/{index-CYbhWvbu.js → index-DSki-yHd.js} +3 -3
- package/dist/assets/index-DdF52dPT.js +1 -0
- package/dist/assets/{index-CiIX-HNp.js → index-DfO0PkR5.js} +2 -2
- package/dist/assets/{index-BzuzQ5ox.js → index-DkNsYHWd.js} +1 -1
- package/dist/assets/{index-CPCvlb_T.js → index-DmsOwDxy.js} +1 -1
- package/dist/assets/{index-DijM3Brt.js → index-DpFVufZF.js} +4 -4
- package/dist/assets/{index-CpDPXgfj.js → index-DqKWQ6lA.js} +1 -1
- package/dist/assets/{index-DhYO7LNp.js → index-Dter8RWU.js} +1 -1
- package/dist/assets/{index-COMjcH0c.js → index-DxeaApG7.js} +1 -1
- package/dist/assets/{index-owbIHPzo.js → index-FOfUOpKU.js} +1 -1
- package/dist/assets/{index-2wL8aZ8Y.js → index-TkRGX0aU.js} +1 -1
- package/dist/assets/{index-C7eGFDSn.js → index-_p9TGBvO.js} +1 -1
- package/dist/assets/{index-CndCNiXH.js → index-aQCP0zMr.js} +3 -3
- package/dist/assets/{index-B1nZmgB5.js → index-gW2LRVpQ.js} +3 -3
- package/dist/assets/{index-Ad8X02VO.js → index-gY5iKTIg.js} +1 -1
- package/dist/assets/{index.esm--uzTB2FV.js → index.esm-DNw2WsMP.js} +1 -1
- package/dist/assets/{install-from-url-C0_MJ6GL.js → install-from-url-ChxBmd8y.js} +1 -1
- package/dist/assets/{invitation-DSBhIqPu.js → invitation-CK-9fzay.js} +1 -1
- package/dist/assets/{is-path-prefix-equal-nx3bAefD.js → is-path-prefix-equal-z6rXFfWF.js} +1 -1
- package/dist/assets/{item-ZFwK1W_m.js → item-Bi4YOXoV.js} +1 -1
- package/dist/assets/{javascript-QDfkina6.js → javascript-gR9EmbFN.js} +1 -1
- package/dist/assets/{jsonMode-CByhSCCJ.js → jsonMode-C2iokhm3.js} +1 -1
- package/dist/assets/{liquid-BLsruGsx.js → liquid-DlmH91G9.js} +1 -1
- package/dist/assets/{list-header-C17aMDSV.js → list-header-CiZSpcHw.js} +1 -1
- package/dist/assets/{lock.svg-Ce14O-HS.js → lock.svg-D4RerwXL.js} +1 -1
- package/dist/assets/{log-BYBaL_HU.js → log-fHnfsRRc.js} +1 -1
- package/dist/assets/{lottie-react.esm-BT7Tc0ny.js → lottie-react.esm-DwGuMXwe.js} +1 -1
- package/dist/assets/{mdx-DGszQu-n.js → mdx-B4KL37qQ.js} +1 -1
- package/dist/assets/{memory-DEYeLtlR.js → memory-_jD3viB0.js} +1 -1
- package/dist/assets/{metric-CcZM7hMw.js → metric-D-n9wLBp.js} +1 -1
- package/dist/assets/omit-CPRZ0B0R.js +1 -0
- package/dist/assets/{overview-DNJ7u_wX.js → overview-DTGYE6TZ.js} +1 -1
- package/dist/assets/{permission-B57fakhN.js → permission-a5zDq7rM.js} +1 -1
- package/dist/assets/{preference-BdUFP7FH.js → preference-B-CYFAI3.js} +3 -3
- package/dist/assets/{python-DwNaTwnF.js → python-BM52WTwZ.js} +1 -1
- package/dist/assets/{raf-schd.esm-CnTVXaU3.js → raf-schd.esm-B5OMlrCf.js} +1 -1
- package/dist/assets/{razor-CYG0tniA.js → razor-DrYd4877.js} +1 -1
- package/dist/assets/{rotate-session-key-rywGtiKG.js → rotate-session-key-DETYEvOS.js} +1 -1
- package/dist/assets/{runtime-Br1BXdVa.js → runtime-C5Qv_-EQ.js} +1 -1
- package/dist/assets/schema-BpWVtFwc.js +1 -0
- package/dist/assets/sdk-BCvN9-9d.js +1 -0
- package/dist/assets/{service-JGRCidBc.js → service-CU627QjX.js} +1 -1
- package/dist/assets/{shorten-label-DNQydA43.js → shorten-label-izVabXeE.js} +1 -1
- package/dist/assets/{simple-select-DTSEgkTK.js → simple-select-BSptVRvh.js} +1 -1
- package/dist/assets/{spaces-BCtuyMgR.js → spaces-CGMxc8V-.js} +1 -1
- package/dist/assets/{status-CfOHQcWj.js → status-Cc65Exxv.js} +1 -1
- package/dist/assets/{status-ClxmfwnA.js → status-DsuywKQN.js} +1 -1
- package/dist/assets/{switch-control-_mPRn1TT.js → switch-control-BrQIub8A.js} +1 -1
- package/dist/assets/{table-icons-BCjGfZ_O.js → table-icons-hVAZnA0-.js} +1 -1
- package/dist/assets/{team-DJ1sxIWJ.js → team-651xYHqY.js} +1 -1
- package/dist/assets/{toLower-BSV3IbDQ.js → toLower-BTh_yPFG.js} +1 -1
- package/dist/assets/toUpper-BY5QEPjh.js +1 -0
- package/dist/assets/{traffic-CKmj2zi9.js → traffic-DEO0b2pJ.js} +1 -1
- package/dist/assets/{tsMode-DT1APwIi.js → tsMode-DFoW-qGq.js} +1 -1
- package/dist/assets/{typescript-esvOVxsa.js → typescript-yTEHeHqu.js} +1 -1
- package/dist/assets/{url-evaluation-DNJ48_wb.js → url-evaluation-htR8cP0c.js} +1 -1
- package/dist/assets/{url-join-CDhrsaDR.js → url-join-CvBUjlHE.js} +1 -1
- package/dist/assets/{use-mobile-BlNK1r7t.js → use-mobile-B2fvjcjL.js} +1 -1
- package/dist/assets/{use-mobile-Do94upEI.js → use-mobile-CD0b5-fF.js} +1 -1
- package/dist/assets/{useAsync-BJIXRppj.js → useAsync-DTSaiLA6.js} +1 -1
- package/dist/assets/{useAsyncRetry-D8_fwb_i.js → useAsyncRetry-3oMBxbWI.js} +1 -1
- package/dist/assets/{useLocalStorage-BT1idF5p.js → useLocalStorage-pDiaOOl8.js} +1 -1
- package/dist/assets/{useThemeProps-Cjy804xx.js → useThemeProps-D2o2I8tH.js} +1 -1
- package/dist/assets/{util-BuBDzST7.js → util-CO7za6kW.js} +1 -1
- package/dist/assets/{wait-container-C3xVNo3H.js → wait-container-CKMtOVZ5.js} +1 -1
- package/dist/assets/{without-wallet-CSLsp-R3.js → without-wallet-Bz0faV9X.js} +1 -1
- package/dist/assets/wrap-locale-BbjqZMGZ.js +1 -0
- package/dist/assets/{xml-XqwsWxhl.js → xml-DOoQrL1t.js} +1 -1
- package/dist/assets/{yaml-CCl6p8Pa.js → yaml-CEc3MOv9.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/ArrowDropDown-JQ3Rq4ea.js +0 -1
- package/dist/assets/api-D8P27G7r.js +0 -1
- package/dist/assets/cloneDeep-CH6T7y2B.js +0 -1
- package/dist/assets/emotion-cache.browser.esm-Cvn7wadW.js +0 -1
- package/dist/assets/engine-Df3lbfPA.js +0 -1
- package/dist/assets/getValidReactChildren-BjYEIaVV.js +0 -1
- package/dist/assets/index-BvSt3OAt.js +0 -1
- package/dist/assets/omit-0SEPYCGW.js +0 -1
- package/dist/assets/schema-BKOGdXcY.js +0 -1
- package/dist/assets/sdk-Ml4VOZ8I.js +0 -1
- package/dist/assets/toUpper-P9za5QoT.js +0 -1
- package/dist/assets/wrap-locale-BnQ35YJ5.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{u as N,j as o,C as k,ay as b,cY as U,A as W,V as E,cN as _,r,aX as D,h as d,y as x,al as P,af as R,w as O,aH as A,x as $,ax as H,bC as K,s as V}from"./index-
|
|
1
|
+
import{u as N,j as o,C as k,ay as b,cY as U,A as W,V as E,cN as _,r,aX as D,h as d,y as x,al as P,af as R,w as O,aH as A,x as $,ax as H,bC as K,s as V}from"./index-DpFVufZF.js";import{I as X}from"./invitation-CK-9fzay.js";import"./index-CZVZy3tE.js";import"./index-Br_3Odot.js";import"./emotion-cache.browser.esm-B4otC3_4.js";import"./sdk-BCvN9-9d.js";import"./wrap-locale-BbjqZMGZ.js";import"./index-CySEKiOM.js";function z(h){const{api:i,session:f}=b(),{info:s}=N(),c=U(),v=W(),{t:l,locale:m}=E(),{encryptKey:y,decrypt:C}=_(),[I,g]=r.useState(!1),p=r.useMemo(()=>new URLSearchParams(c.search).get("inviteId"),[c]),a=D(async()=>{if(!p)return null;let e;const{data:n}=await i.get("/api/invitation",{params:{inviteId:p}}),t=!!d(s,"ownerNft.did")&&n.role.name==="owner";if(t){const u=new URL(window.location.href);u.pathname=x(P(),"/api/did/invite/token"),u.searchParams.set("_ek_",y),u.searchParams.set("inviteId",p);const{data:F}=await i.get(u.href);e=F}return{invitation:n,nextWorkflow:e,needReceiveNFT:t}}),L=r.useCallback(()=>{g(!0)},[]),S=r.useCallback(()=>{if(a.error)throw a.error;return a.value.invitation},[a]),w=r.useCallback(async e=>{e&&(Object.prototype.hasOwnProperty.call(e,"encrypted")&&!e.encrypted?R(e.sessionToken):R(C(e.sessionToken)));const n=new URLSearchParams(c.search);n.delete("inviteId");const t=n.toString();await f.refresh(),v(`/${t&&`?${t}`}`,{replace:!0})},[c,v,f]);if(a.loading)return o.jsx(k,{});const T=()=>{const e=new URL(window.location.href);e.pathname=x(P(),"/api/did/invite/status"),e.searchParams.set("_t_",a.value.nextWorkflow.token),e.searchParams.set("locale",m);const n=setInterval(async()=>{const{data:t}=await i.get(e.href);t.status==="succeed"&&(clearInterval(n),f.updateConnectedInfo(t),w(t))},2e3)},j=()=>{g(!1)};return o.jsxs(M,{className:"page-invite",children:[d(a,"value.needReceiveNFT")&&o.jsx(O,{action:"login",popup:!0,className:"connect",open:I,locale:m,baseUrl:s.launcher.url,checkFn:H.create({baseURL:s.launcher.url}).get,onSuccess:T,onClose:j,checkTimeout:5*60*1e3,webWalletUrl:$(s),extraParams:{nw:d(a,"value.nextWorkflow.url")},messages:{title:l("invite.transferNFTDialog.title",{name:s.name}),scan:l("invite.transferNFTDialog.scan"),confirm:l("invite.transferNFTDialog.confirm"),success:l("invite.transferNFTDialog.success")},prefix:`${A.WELLKNOWN_SERVICE_PATH_PREFIX}/api/did`}),o.jsx(X,{...h,getDataFn:S,createPassportSvg:e=>K(e,s),checkFn:i.get,onLoginSuccess:w,passportColor:"default",onReceive:d(a,"value.needReceiveNFT")?L:null})]})}const M=V.div`
|
|
2
2
|
width: 100vw;
|
|
3
3
|
height: 100%;
|
|
4
4
|
min-height: 100vh;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{aF as Ve,j as e,bo as ht,r as x,bE as J,bg as H,H as q,aH as E,g as gt,o as d,h as ee,au as xt,O as bt,K as N,T as Y,V as Q,eO as ke,P as Fe,ip as Ge,bk as Re,aV as Te,U as Ie,bB as Ce,b4 as He,b2 as Ee,C as Ye,f as Je,f0 as Qe,aP as Ae,W as jt,at as Xe,iq as Ze,v as De,f2 as et,br as be,fJ as tt,dD as yt,s as ae,ag as pe,G as qe,av as St,ir as vt,is as Ct,$ as Nt,it as wt,iu as Rt,iv as Tt,iw as It,N as Et,by as st,E as At,J as Dt,Q as Ot,S as Lt,R as Ue,ix as kt}from"./index-DijM3Brt.js";import{d as Ft,H as nt,g as Pt}from"./index-COMjcH0c.js";import{S as me}from"./shorten-label-DNQydA43.js";import{v as at}from"./index-owbIHPzo.js";import{T as _t}from"./html-title-DCtKzGAT.js";import{R as Pe}from"./Replay-B86FlV2V.js";import{R as Bt}from"./Refresh-Dpf0qLZl.js";import{D as zt,g as Wt}from"./traffic-CKmj2zi9.js";import"./FilterList-CZU1TLat.js";import"./CSSTransition-680AnN9b.js";import"./emotion-cache.browser.esm-Cvn7wadW.js";import"./index-Cbdkr0wH.js";import"./redux-DfszZyTl.js";import"./typeof-QjJsDpFa.js";import"./depsEqual-Cn18gXKK.js";import"./index-CB511uzw.js";import"./TableSearch-DKi7Ktdg.js";import"./Search-D5OHIH5t.js";import"./Clear-BEIkQJ0G.js";import"./MoreVert-C4JPmAZs.js";import"./iframe-Db5U2ou8.js";import"./ChevronLeft-Bqr4v0-x.js";import"./ChevronRight-C92WXl3G.js";import"./index-DBii9-f-.js";import"./base-chart-ADeRHccn.js";import"./index-uT6ey1Ij.js";import"./AdapterDayjs-DbXM02a3.js";import"./useThemeProps-Cjy804xx.js";import"./visuallyHidden-Dan1xhjv.js";const Mt=Ve(e.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"})),Kt=Ve(e.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"})),it=x.createContext({}),{Provider:Ht,Consumer:Hs}=it;function qt({children:t,blocklet:s=""}){const{api:n,inService:r,ws:{useSubscription:i}}=ht(),[l,b]=x.useState([]),[m,S]=x.useState({total:0,pageSize:20,pageCount:0,page:1}),h=J(()=>s.meta?.did,[s]),[j,v]=x.useState([]),[P,F]=x.useState({}),w=J(()=>l.length?new Set(l.map(p=>p.id)):new Set,[l]),U=async({page:p=1,pageSize:g=20,...T}={})=>{if(!h)return[];try{const D={paging:{page:p,pageSize:g},...T,teamDid:h,dateRange:T.dateRange?[H(T.dateRange[0]).toISOString(),H(T.dateRange[1]).toISOString()]:void 0},{dids:O,...z}=D;let _="";O&&O.includes("system")&&(_="system");const ie=O?O.filter(oe=>oe!=="system"):[],se={...z,source:_,componentDids:ie},Z=await n.getNotificationSendLog({input:se});return F(se),b(Z.list),S(Z.paging),Z.list}catch(D){return q.error(D.message),[]}},M=async()=>{const p=await n.getNotificationComponents({input:{teamDid:h}});v(p.componentDids)},L=x.useCallback(p=>{const g=s.children.find(T=>T.meta?.did===p);if(g)return g.ancestors=[s],g},[s]),k=async({notificationId:p,receivers:g,channels:T,...D})=>{await n.resendNotification({input:{teamDid:h,notificationId:p,receivers:g,channels:T.map(O=>O==="wallet"?E.NOTIFICATION_SEND_CHANNEL.WALLET:O==="pushKit"?E.NOTIFICATION_SEND_CHANNEL.PUSH:O),...D}})},$=x.useCallback(async p=>(await n.getUser({input:{teamDid:h,user:{did:p},options:{enableConnectedAccount:!0}}})).user,[n,h]),V=x.useCallback(async({page:p=1,pageSize:g=20,...T}={})=>{try{const D={paging:{page:p,pageSize:g},...T,userName:T.searchText||"",teamDid:h,dateRange:T.dateRange?[H(T.dateRange[0]).toISOString(),H(T.dateRange[1]).toISOString()]:void 0};return await n.getReceivers({input:D})}catch(D){throw q.error(D.message),D}},[n,h]);x.useEffect(()=>{h&&M()},[h]),i(E.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,p=>{w.has(p.notificationId)&&U(P)},[w,P]),i(E.EVENTS.NOTIFICATION_BLOCKLET_CREATE,p=>{w.has(p.id)||U(P)},[w,P]);const X={fetch:U,data:l,paging:m,blocklet:s,getComponent:L,resendNotification:k,getUser:$,componentDids:j,getReceivers:V,inService:r,teamDid:h};return e.jsx(Ht,{value:{notificationRecords:X},children:t})}function _e(){const{notificationRecords:t}=x.useContext(it);return t}he.propTypes={severity:d.oneOf(Object.values(["info","success","error","warning"])).isRequired};const Ut={info:"primary",success:"success",error:"error",warning:"warning"};function he({severity:t="info"}){return e.jsx(gt,{type:Ut[t],children:t})}const $t=(t,s,n="")=>{if(!n||!s)return"";switch(n){case E.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:s});case E.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:s});case E.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:s});case E.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return n}};function ot(t,s,n={}){const{status:r,updatedAt:i,reason:l="",channel:b="wallet"}=n,m=i?t("notification.sendStatus.sentTime",{date:xt(i,s)}):"",S=$t(t,b,l);return r===E.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:m,reason:S}:r===E.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:m}:{status:"pending",title:t("notification.sendStatus.pending"),reason:S,sentTime:m}}const Oe={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Le=["wallet","pushKit","email"],$e=["info","success","error","warning"],rt=t=>{const{settings:s}=t;return s?.notification?.email?.enabled},lt=t=>{const{settings:s}=t;return s?.notification?.pushKit?.enabled},Vt=(t,s)=>{const n=ee(s,"extra.notifications.email",!0);return{available:rt(t),enabled:n}},Gt=(t,s)=>{const n=ee(s,"extra.notifications.push",!0);return{available:lt(t),enabled:n}},Yt=t=>({enabled:ee(t,"extra.notifications.wallet",!0)}),Jt=t=>({enabled:ee(t,"extra.webhooks",[]).length>0}),ge=(t=3)=>new Promise(s=>{setTimeout(()=>{s()},t*1e3)}),Qt=(t,s)=>s==="wallet"||s==="webhook"?[{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:s==="pushKit"||s==="email"?[{channel:s,type:"available",pass:t("notification.sendStatus.reason.available",{channel:s}),fail:t("notification.sendStatus.reason.unavailable",{channel:s})},{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:[],xe=(t=[])=>{const s=H().startOf("day");return t.filter(n=>H(n.sendAt).isSame(s,"day")).length},Xt=(t,s="")=>{if(s&&Le.includes(s)){const l=`${s}SendRecord`,b=ee(t,l,[]);return xe(b)}const n=ee(t,"webhook",{}),r=Object.keys(n??{})??[];if(s&&r.includes(s)){const l=n[s]??[];return xe(l)}const i={};return Le.forEach(l=>{const b=`${l}SendRecord`,m=ee(t,b,[]),S=xe(m);i[l]=S}),r.length>0&&r.forEach(l=>{const b=n[l]??[],m=xe(b);i[l]=m}),i},je=(t,s,n)=>{if(!Array.isArray(t))throw new Error("Invalid filterList or index");return t[n].splice(s,1),t},ye=(t,s)=>{if(!Array.isArray(s))throw new Error("filters must be an array");return s.length?!s.includes(t):!1},Zt=t=>{switch(t){case E.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case E.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case E.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case E.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},ct=()=>({components:{MUIDataTableFilter:{styleOverrides:{header:{marginBottom:0,p:{margin:0}},root:{"& .MuiGrid-container":{marginTop:0,"& .MuiGrid-item":{paddingTop:0}}}}},MuiPopover:{styleOverrides:{root:{"&.MuiPopover-root":{"& .MuiPaper-root:has(.filter-container)":{width:"420px"}}}}}}});function te({config:t,enableTooltip:s=!0,showTitle:n=!1,children:r=null}){const{status:i,title:l="",sentTime:b="",reason:m=""}=t,S=[l,m].filter(Boolean).join(", ");return e.jsx(bt,{title:s?e.jsxs(e.Fragment,{children:[e.jsx(Y,{color:"inherit",sx:{fontSize:12},children:S}),e.jsx("span",{children:b})]}):null,arrow:!0,placement:"top",children:e.jsxs(N,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(N,{sx:{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx(N,{style:{opacity:.15},sx:{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Oe[i]}}),e.jsx(N,{sx:{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Oe[i]}})]}),e.jsx(Y,{color:"inherit",sx:{fontSize:12},children:n?l:r})]})})}te.propTypes={config:d.object.isRequired,enableTooltip:d.bool,showTitle:d.bool,children:d.node};Se.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};function Se({list:t,label:s,onDelete:n=()=>{}}){const{t:r,locale:i}=Q();return e.jsxs(N,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsxs(Y,{children:[s,": "]}),t.map(l=>{const b=ot(r,i,{status:l});return e.jsx(ke,{size:"small",label:e.jsx(N,{sx:{display:"flex",alignItems:"center",gap:"4px"},children:e.jsx(te,{config:b,enableTooltip:!1,children:b.title})}),onDelete:m=>n(m,l)},l)})]})}Be.propTypes={filterList:d.array.isRequired,onChange:d.func.isRequired,index:d.number.isRequired,column:d.object.isRequired,filterValues:d.array.isRequired,label:d.string.isRequired,renderLabel:d.func.isRequired};function Be({filterList:t,onChange:s,index:n,column:r,filterValues:i,label:l,renderLabel:b}){return e.jsxs(Fe,{className:"filter-container",children:[e.jsx(Ge,{component:"legend",children:l}),e.jsx(Re,{row:!0,children:i.map(m=>e.jsx(Te,{control:e.jsx(Ie,{checked:t[n].indexOf(m.value??m)>-1,onChange:S=>{const h=[...t];S.target.checked?h[n]=[...h[n],m.value??m]:h[n]=h[n].filter(j=>j!==(m.value??m)),s(h[n],n,r)},name:m.value??m}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:b(m)})},m.value??m))})]})}function we(t){return e.jsx(Be,{...t,renderLabel:s=>e.jsx(te,{enableTooltip:!1,config:{status:s.status},children:s.label})})}ce.propTypes={status:d.number.isRequired,updatedAt:d.string.isRequired,reason:d.string,channel:d.string,onResend:d.func};function ce({status:t,updatedAt:s,reason:n="",channel:r="wallet",onResend:i}){const{t:l,locale:b}=Q(),m=ot(l,b,{status:t,updatedAt:s,reason:n,channel:r});return e.jsxs(N,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(te,{config:m,showTitle:!0}),m.status!=="success"&&e.jsx(Ce,{className:"resend-btn",size:"small",startIcon:e.jsx(Pe,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:i,children:l("notification.resend")})]})}ze.propTypes={value:d.array.isRequired,onChange:d.func};function ze({value:t,onChange:s}){const{locale:n}=Q(),r=H().toDate(),[i,l]=x.useState(null),b=x.useCallback(h=>{l(i?null:h.currentTarget)},[i]),m=!!i,S=x.useCallback(h=>{if(!h.startDate||!h.endDate){q.error("Please select a date range");return}if(H(h.startDate).isAfter(h.endDate)||!H(h.startDate).isValid()||!H(h.endDate).isValid()){q.error("Invalid date range");return}s([h.startDate,h.endDate]),l(null)},[s]);return e.jsxs("div",{children:[e.jsx(Y,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},sx:{mb:0},children:e.jsxs(Ce,{onClick:b,variant:"outlined",size:"small",color:"inherit",children:[He(t[0],n)," - ",He(t[1],n)]})}),e.jsx(Ee,{open:m,anchorEl:i,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(zt,{open:!0,maxDate:r,initialDateRange:{startDate:t[0],endDate:t[1]},toggle:b,definedRanges:Wt(r),onChange:S})})]})}We.propTypes={itemComponent:d.elementType.isRequired};function We({itemComponent:t,...s}){const{t:n}=Q();return!s?.filterList?.filter(i=>i.length).length?null:e.jsxs(N,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsx("div",{className:"toolbar-filter-title",children:n("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(Ft.TableFilterList,{...s,ItemComponent:t})})]})}function Me({label:t,onDelete:s,canDelete:n=()=>!0,...r}){const i=s&&typeof s=="function"?s:void 0;let l=!0;return n&&typeof n=="function"&&(l=n({label:t,...r})),e.jsx(ke,{label:t,variant:"outlined",...i&&l?{onDelete:i}:{}})}Me.propTypes={label:d.string.isRequired,onDelete:d.func,canDelete:d.func};const es=[{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}];dt.propTypes={loading:d.bool,onCancel:d.func,onConfirm:d.func};function dt({loading:t=!1,onCancel:s=()=>{},onConfirm:n=()=>{}}){const{t:r}=Q(),[i,l]=x.useState(es),[b,m]=x.useState(!0),S=(j,v)=>{v.checked=j.target.checked;const P=i.map(F=>({...F,checked:F.value===v.value?v.checked:F.checked}));l(P)},h=j=>{j.stopPropagation(),n({channels:i.filter(v=>v.checked).map(v=>v.value),isResendFailedOnly:b})};return e.jsxs(N,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(Y,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(N,{className:"choose-channel",children:e.jsxs(Fe,{component:"fieldset",variant:"standard",children:[e.jsx(Ge,{component:"legend",children:r("notification.selectChannels")}),e.jsx(Re,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:i.map(j=>e.jsx(Te,{control:e.jsx(Ie,{checked:j.checked,onChange:v=>S(v,j),name:j.value}),label:j.label},j.value))})]})}),e.jsx(N,{className:"resend-config-footer",children:e.jsx(Re,{children:e.jsx(Te,{control:e.jsx(Ie,{checked:b,onChange:j=>m(j.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(N,{className:"resend-config-footer-tip",sx:{display:"flex",justifyContent:"flex-end",gap:1},children:[e.jsx(Ce,{onClick:j=>{j.stopPropagation(),s()},color:"inherit",children:r("common.cancel")}),e.jsxs(Ce,{onClick:h,color:"primary",disabled:t,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[t&&e.jsx(Ye,{size:16}),r("common.confirm")]})]})]})}ut.propTypes={notificationId:d.string.isRequired,handleResend:d.func,resending:d.bool};function ut({notificationId:t,handleResend:s,resending:n=!1}){const{t:r,locale:i}=Q(),l=Je(),b=x.useMemo(()=>Qe(l,ct()),[l]),{getReceivers:m,inService:S,teamDid:h,getUser:j,blocklet:v}=_e(),[P,F]=x.useState(!1),[w,U]=x.useState([]),M=Ae({anchorEl:null,position:null}),L=Ae({anchorEl:null,position:null}),[k,$]=x.useState(null),[V,X]=x.useState({total:0,pageSize:10,pageCount:0,page:1}),[p,g]=x.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[H().subtract(1,"month").startOf("day").toDate(),H().endOf("day").toDate()]}),[T,D]=x.useState([]),O=[{label:r("notification.sendStatus.pending"),value:0,status:"pending"},{label:r("notification.sendStatus.success"),value:1,status:"success"},{label:r("notification.sendStatus.failed"),value:2,status:"failed"}],z=async()=>{if(!P&&t)try{F(!0);const a=await m({notificationId:t,...p}),o=a.list.map(c=>({...c,receiverUser:{...c.receiverUser,avatar:tt(c.receiverUser.avatar,h,S)}}));U(o),X(a.paging),F(!1)}catch(a){q.error(a.message),F(!1)}};x.useEffect(()=>{z()},[p]);const _=a=>{a.stopPropagation();const o=a.currentTarget;L.anchorEl=o;const c=o.getBoundingClientRect();L.position={top:c.top+window.scrollY,left:c.left+window.scrollX}},ie=a=>a.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(De,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(Pe,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:_,children:r("notification.resend")})}):null,se={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:V.page-1,rowsPerPage:V.pageSize,count:V.total,searchText:p.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:T,onRowSelectionChange:(a,o)=>{D(o.map(c=>c.dataIndex))},customToolbarSelect:ie},Z=({page:a,rowsPerPage:o,searchText:c,filterList:C})=>{const[,B=[],G=[],K=[]]=C;p.pageSize!==o?g(W=>({...W,pageSize:o,page:1})):p.page!==a+1?g(W=>({...W,page:a+1})):p.searchText!==c?g(W=>({...W,searchText:c,page:1})):pe(B,p.walletSendStatus)?pe(G,p.pushKitSendStatus)?pe(K,p.emailSendStatus)||g(W=>({...W,emailSendStatus:K,page:1})):g(W=>({...W,pushKitSendStatus:G,page:1})):g(W=>({...W,walletSendStatus:B,page:1}))},oe=x.useCallback(async(a,o)=>{if(!o)return!1;const c=await j(o);return c?a==="wallet"?Yt(c):a==="email"?Vt(v,c):a==="pushKit"?Gt(v,c):a==="webhook"?Jt(c):!0:!1},[j,v]),Ne=x.useCallback(a=>Qt(r,a),[r]),f=()=>{M.anchorEl=null,M.position=null,$(null)},u=()=>{L.anchorEl=null,L.position=null},y=async(a,o,c=!0,C="")=>{if(!(!o.length||!a.length))try{s(a,o,c,C),L.anchorEl||(await ge(.5),f())}catch(B){console.error("handleResend error",{error:B})}},I=async({channels:a,isResendFailedOnly:o})=>{const c=T.map(C=>w[C].receiver);await y(a,c,o),await ge(.5),u(),D([])},A=async(a,o=[],c=!0)=>{try{await y(["webhook"],[a.receiver],c,o)}catch(C){q.error(C.response?C.response.statusText:C.message)}},R=async(a,o,c,C=[],B=!0)=>{if(a.stopPropagation(),Xt(o,c)>=4){q.warning(r("notification.resendLimit"));return}if(!Le.includes(c)){await A(o,C,B);return}if(a){const K=a.currentTarget,W=K.getBoundingClientRect();M.anchorEl=K,M.position={top:W.top+window.scrollY,left:W.left+window.scrollX}}$({channel:c});try{const K=await oe(c,o.receiver);await ge(1),$({channel:c,result:K}),(typeof K=="boolean"&&K||yt(K)&&Object.values(K).every(W=>!!W))&&(await s([c],[o.receiver],B),L.anchorEl||(await ge(.5),f()))}catch(K){q.error(K.message)}},re=a=>{g(o=>({...o,dateRange:a,page:1}))},ne=(a,o,c,C)=>{a.stopPropagation();const B=c.filter(G=>G!==o);g(G=>({...G,[C]:B,page:1}))},le=J(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:a=>{const{receiverUser:o,receiver:c}=w[a];return o?e.jsxs(N,{"data-cy":`member-name-${o.fullName}`,sx:{display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start"},children:[e.jsx(Xe,{src:`${o.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:c,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(me,{children:o.fullName})]},c):e.jsx(jt,{size:14,responsive:!1,compact:!0,copyable:!1,did:c})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:p.walletSendStatus??[],customFilterListOptions:{render:a=>e.jsx(Se,{list:a,label:"Wallet",onDelete:(o,c)=>{o.stopPropagation(),ne(o,c,le[1].options.filterList,"walletSendStatus")}}),update:je},filterOptions:{names:O,fullWidth:!0,logic:ye,display:(a,o,c,C)=>e.jsx(we,{label:"Wallet",filterList:a,onChange:o,index:c,column:C,filterValues:O})},customBodyRenderLite:a=>{const{walletSendStatus:o,walletSendAt:c,walletSendFailedReason:C}=w[a];return e.jsx(ce,{status:o,updatedAt:c,reason:C,channel:"wallet",onResend:B=>R(B,w[a],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{pushKitSendStatus:o,pushKitSendAt:c,pushKitSendFailedReason:C}=w[a];return e.jsx(ce,{status:o,updatedAt:c,reason:C,channel:"pushkit",onResend:B=>R(B,w[a],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:p.pushKitSendStatus??[],customFilterListOptions:{render:a=>e.jsx(Se,{list:a,label:"Push Kit",onDelete:(o,c)=>{o.stopPropagation(),ne(o,c,le[2].options.filterList,"pushKitSendStatus")}}),update:je},filterOptions:{names:O,fullWidth:!0,logic:ye,display:(a,o,c,C)=>e.jsx(we,{label:"Push Kit",filterList:a,onChange:o,index:c,column:C,filterValues:O})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{emailSendStatus:o,emailSendAt:c,emailSendFailedReason:C}=w[a];return e.jsx(ce,{status:o,updatedAt:c,reason:C,channel:"email",onResend:B=>R(B,w[a],"email",[],!1)})},filter:!0,filterType:"custom",filterList:p.emailSendStatus??[],customFilterListOptions:{render:a=>e.jsx(Se,{list:a,label:"Email",onDelete:(o,c)=>{o.stopPropagation(),ne(o,c,le[3].options.filterList,"emailSendStatus")}}),update:je},filterOptions:{names:O,fullWidth:!0,logic:ye,display:(a,o,c,C)=>e.jsx(we,{label:"Email",filterList:a,onChange:o,index:c,column:C,filterValues:O})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{webhook:o}=w[a];if(!o)return null;const c=Object.entries(o)[0];if(!c)return null;const[C,B]=c,G=B[0];return e.jsx(N,{sx:{display:"flex",flexDirection:"column",gap:1},children:e.jsxs(N,{className:"webhook-item",sx:{fontSize:12},children:[e.jsx(me,{maxLength:30,children:C},C),e.jsx(ce,{status:G.status,updatedAt:G.sendAt,reason:G.failedReason,channel:"webhook",onResend:K=>R(K,w[a],"webhook",[C],!1)})]},C)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:a=>{const{createdAt:o}=w[a];return e.jsx(Ze,{value:o,locale:i,shouldUpdate:!0})}}}],[w,i,p,r]),mt=[e.jsx(ze,{value:p.dateRange,onChange:re},"date-picker"),e.jsx(De,{variant:"contained",size:"small",color:"primary",loading:P,startIcon:e.jsx(Bt,{}),onClick:()=>z(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(N,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(ss,{children:e.jsxs(et,{theme:b,children:[e.jsx(nt,{className:"receivers-table",locale:i,loading:P,columns:le,data:w,onChange:Z,options:se,customButtons:mt,components:{TableFilterList:a=>e.jsx(We,{...a,itemComponent:o=>e.jsx(Me,{...o,canDelete:()=>!1})})}}),M.anchorEl&&e.jsx(Ee,{open:!!M.anchorEl,anchorReference:"anchorPosition",anchorPosition:M.position,onClose:f,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(ns,{children:[e.jsxs(Y,{variant:"body1",component:"div",className:"check-title",children:[k?.channel," Checking"]}),e.jsx(N,{sx:{display:"flex",flexDirection:"column",gap:"4px"},children:Ne(k?.channel).map(a=>{const{type:o,pass:c,fail:C}=a;return!k?.result||k?.result?.[o]?e.jsxs(Y,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:k?.result?.[o]?be.success.main:"inherit"},children:[k?.result?e.jsx(Kt,{}):e.jsx(Ye,{size:12,sx:{color:be.primary.main}}),e.jsx("span",{children:c})]},o):e.jsxs(Y,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:be.error.main},children:[e.jsx(Mt,{}),e.jsx("span",{children:C})]},o)})})]})}),L.anchorEl&&e.jsx(Ee,{open:!!L.anchorEl,anchorReference:"anchorPosition",anchorPosition:L.position,onClose:u,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(dt,{loading:n,onCancel:u,onConfirm:I})})]})})})}const ts=x.memo(ut),ss=ae.div`
|
|
1
|
+
import{aF as Ve,j as e,bo as ht,r as x,bE as J,bg as H,H as q,aH as E,g as gt,o as d,h as ee,au as xt,O as bt,K as N,T as Y,V as Q,eO as ke,P as Fe,ip as Ge,bk as Re,aV as Te,U as Ie,bB as Ce,b4 as He,b2 as Ee,C as Ye,f as Je,f0 as Qe,aP as Ae,W as jt,at as Xe,iq as Ze,v as De,f2 as et,br as be,fJ as tt,dD as yt,s as ae,ag as pe,G as qe,av as St,ir as vt,is as Ct,$ as Nt,it as wt,iu as Rt,iv as Tt,iw as It,N as Et,by as st,E as At,J as Dt,Q as Ot,S as Lt,R as Ue,ix as kt}from"./index-DpFVufZF.js";import{d as Ft,H as nt,g as Pt}from"./index-DxeaApG7.js";import{S as me}from"./shorten-label-izVabXeE.js";import{v as at}from"./index-FOfUOpKU.js";import{T as _t}from"./html-title-CFJOQU04.js";import{R as Pe}from"./Replay-CUAnOum2.js";import{R as Bt}from"./Refresh-mfLuZ9Wj.js";import{D as zt,g as Wt}from"./traffic-DEO0b2pJ.js";import"./FilterList-CoptEImh.js";import"./CSSTransition-y8iKTN7d.js";import"./emotion-cache.browser.esm-B4otC3_4.js";import"./index-BprceCor.js";import"./redux-DfszZyTl.js";import"./typeof-QjJsDpFa.js";import"./depsEqual-BIKlqTyk.js";import"./index-BruXFS68.js";import"./TableSearch-hUcYhTcB.js";import"./Search-CCrESOjg.js";import"./Clear-CP-1JSsG.js";import"./MoreVert-Bs574HAx.js";import"./iframe-DTPDSES_.js";import"./ChevronLeft-nSrR9D_I.js";import"./ChevronRight-CRb5GVq5.js";import"./index-DBii9-f-.js";import"./base-chart-DoQaNYbB.js";import"./index-CusFNu14.js";import"./AdapterDayjs-BjFsoQ-w.js";import"./useThemeProps-D2o2I8tH.js";import"./visuallyHidden-Dan1xhjv.js";const Mt=Ve(e.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"})),Kt=Ve(e.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"})),it=x.createContext({}),{Provider:Ht,Consumer:Hs}=it;function qt({children:t,blocklet:s=""}){const{api:n,inService:r,ws:{useSubscription:i}}=ht(),[l,b]=x.useState([]),[m,S]=x.useState({total:0,pageSize:20,pageCount:0,page:1}),h=J(()=>s.meta?.did,[s]),[j,v]=x.useState([]),[P,F]=x.useState({}),w=J(()=>l.length?new Set(l.map(p=>p.id)):new Set,[l]),U=async({page:p=1,pageSize:g=20,...T}={})=>{if(!h)return[];try{const D={paging:{page:p,pageSize:g},...T,teamDid:h,dateRange:T.dateRange?[H(T.dateRange[0]).toISOString(),H(T.dateRange[1]).toISOString()]:void 0},{dids:O,...z}=D;let _="";O&&O.includes("system")&&(_="system");const ie=O?O.filter(oe=>oe!=="system"):[],se={...z,source:_,componentDids:ie},Z=await n.getNotificationSendLog({input:se});return F(se),b(Z.list),S(Z.paging),Z.list}catch(D){return q.error(D.message),[]}},M=async()=>{const p=await n.getNotificationComponents({input:{teamDid:h}});v(p.componentDids)},L=x.useCallback(p=>{const g=s.children.find(T=>T.meta?.did===p);if(g)return g.ancestors=[s],g},[s]),k=async({notificationId:p,receivers:g,channels:T,...D})=>{await n.resendNotification({input:{teamDid:h,notificationId:p,receivers:g,channels:T.map(O=>O==="wallet"?E.NOTIFICATION_SEND_CHANNEL.WALLET:O==="pushKit"?E.NOTIFICATION_SEND_CHANNEL.PUSH:O),...D}})},$=x.useCallback(async p=>(await n.getUser({input:{teamDid:h,user:{did:p},options:{enableConnectedAccount:!0}}})).user,[n,h]),V=x.useCallback(async({page:p=1,pageSize:g=20,...T}={})=>{try{const D={paging:{page:p,pageSize:g},...T,userName:T.searchText||"",teamDid:h,dateRange:T.dateRange?[H(T.dateRange[0]).toISOString(),H(T.dateRange[1]).toISOString()]:void 0};return await n.getReceivers({input:D})}catch(D){throw q.error(D.message),D}},[n,h]);x.useEffect(()=>{h&&M()},[h]),i(E.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,p=>{w.has(p.notificationId)&&U(P)},[w,P]),i(E.EVENTS.NOTIFICATION_BLOCKLET_CREATE,p=>{w.has(p.id)||U(P)},[w,P]);const X={fetch:U,data:l,paging:m,blocklet:s,getComponent:L,resendNotification:k,getUser:$,componentDids:j,getReceivers:V,inService:r,teamDid:h};return e.jsx(Ht,{value:{notificationRecords:X},children:t})}function _e(){const{notificationRecords:t}=x.useContext(it);return t}he.propTypes={severity:d.oneOf(Object.values(["info","success","error","warning"])).isRequired};const Ut={info:"primary",success:"success",error:"error",warning:"warning"};function he({severity:t="info"}){return e.jsx(gt,{type:Ut[t],children:t})}const $t=(t,s,n="")=>{if(!n||!s)return"";switch(n){case E.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:s});case E.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:s});case E.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:s});case E.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return n}};function ot(t,s,n={}){const{status:r,updatedAt:i,reason:l="",channel:b="wallet"}=n,m=i?t("notification.sendStatus.sentTime",{date:xt(i,s)}):"",S=$t(t,b,l);return r===E.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:m,reason:S}:r===E.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:m}:{status:"pending",title:t("notification.sendStatus.pending"),reason:S,sentTime:m}}const Oe={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Le=["wallet","pushKit","email"],$e=["info","success","error","warning"],rt=t=>{const{settings:s}=t;return s?.notification?.email?.enabled},lt=t=>{const{settings:s}=t;return s?.notification?.pushKit?.enabled},Vt=(t,s)=>{const n=ee(s,"extra.notifications.email",!0);return{available:rt(t),enabled:n}},Gt=(t,s)=>{const n=ee(s,"extra.notifications.push",!0);return{available:lt(t),enabled:n}},Yt=t=>({enabled:ee(t,"extra.notifications.wallet",!0)}),Jt=t=>({enabled:ee(t,"extra.webhooks",[]).length>0}),ge=(t=3)=>new Promise(s=>{setTimeout(()=>{s()},t*1e3)}),Qt=(t,s)=>s==="wallet"||s==="webhook"?[{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:s==="pushKit"||s==="email"?[{channel:s,type:"available",pass:t("notification.sendStatus.reason.available",{channel:s}),fail:t("notification.sendStatus.reason.unavailable",{channel:s})},{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:[],xe=(t=[])=>{const s=H().startOf("day");return t.filter(n=>H(n.sendAt).isSame(s,"day")).length},Xt=(t,s="")=>{if(s&&Le.includes(s)){const l=`${s}SendRecord`,b=ee(t,l,[]);return xe(b)}const n=ee(t,"webhook",{}),r=Object.keys(n??{})??[];if(s&&r.includes(s)){const l=n[s]??[];return xe(l)}const i={};return Le.forEach(l=>{const b=`${l}SendRecord`,m=ee(t,b,[]),S=xe(m);i[l]=S}),r.length>0&&r.forEach(l=>{const b=n[l]??[],m=xe(b);i[l]=m}),i},je=(t,s,n)=>{if(!Array.isArray(t))throw new Error("Invalid filterList or index");return t[n].splice(s,1),t},ye=(t,s)=>{if(!Array.isArray(s))throw new Error("filters must be an array");return s.length?!s.includes(t):!1},Zt=t=>{switch(t){case E.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case E.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case E.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case E.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},ct=()=>({components:{MUIDataTableFilter:{styleOverrides:{header:{marginBottom:0,p:{margin:0}},root:{"& .MuiGrid-container":{marginTop:0,"& .MuiGrid-item":{paddingTop:0}}}}},MuiPopover:{styleOverrides:{root:{"&.MuiPopover-root":{"& .MuiPaper-root:has(.filter-container)":{width:"420px"}}}}}}});function te({config:t,enableTooltip:s=!0,showTitle:n=!1,children:r=null}){const{status:i,title:l="",sentTime:b="",reason:m=""}=t,S=[l,m].filter(Boolean).join(", ");return e.jsx(bt,{title:s?e.jsxs(e.Fragment,{children:[e.jsx(Y,{color:"inherit",sx:{fontSize:12},children:S}),e.jsx("span",{children:b})]}):null,arrow:!0,placement:"top",children:e.jsxs(N,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(N,{sx:{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx(N,{style:{opacity:.15},sx:{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Oe[i]}}),e.jsx(N,{sx:{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Oe[i]}})]}),e.jsx(Y,{color:"inherit",sx:{fontSize:12},children:n?l:r})]})})}te.propTypes={config:d.object.isRequired,enableTooltip:d.bool,showTitle:d.bool,children:d.node};Se.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};function Se({list:t,label:s,onDelete:n=()=>{}}){const{t:r,locale:i}=Q();return e.jsxs(N,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsxs(Y,{children:[s,": "]}),t.map(l=>{const b=ot(r,i,{status:l});return e.jsx(ke,{size:"small",label:e.jsx(N,{sx:{display:"flex",alignItems:"center",gap:"4px"},children:e.jsx(te,{config:b,enableTooltip:!1,children:b.title})}),onDelete:m=>n(m,l)},l)})]})}Be.propTypes={filterList:d.array.isRequired,onChange:d.func.isRequired,index:d.number.isRequired,column:d.object.isRequired,filterValues:d.array.isRequired,label:d.string.isRequired,renderLabel:d.func.isRequired};function Be({filterList:t,onChange:s,index:n,column:r,filterValues:i,label:l,renderLabel:b}){return e.jsxs(Fe,{className:"filter-container",children:[e.jsx(Ge,{component:"legend",children:l}),e.jsx(Re,{row:!0,children:i.map(m=>e.jsx(Te,{control:e.jsx(Ie,{checked:t[n].indexOf(m.value??m)>-1,onChange:S=>{const h=[...t];S.target.checked?h[n]=[...h[n],m.value??m]:h[n]=h[n].filter(j=>j!==(m.value??m)),s(h[n],n,r)},name:m.value??m}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:b(m)})},m.value??m))})]})}function we(t){return e.jsx(Be,{...t,renderLabel:s=>e.jsx(te,{enableTooltip:!1,config:{status:s.status},children:s.label})})}ce.propTypes={status:d.number.isRequired,updatedAt:d.string.isRequired,reason:d.string,channel:d.string,onResend:d.func};function ce({status:t,updatedAt:s,reason:n="",channel:r="wallet",onResend:i}){const{t:l,locale:b}=Q(),m=ot(l,b,{status:t,updatedAt:s,reason:n,channel:r});return e.jsxs(N,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(te,{config:m,showTitle:!0}),m.status!=="success"&&e.jsx(Ce,{className:"resend-btn",size:"small",startIcon:e.jsx(Pe,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:i,children:l("notification.resend")})]})}ze.propTypes={value:d.array.isRequired,onChange:d.func};function ze({value:t,onChange:s}){const{locale:n}=Q(),r=H().toDate(),[i,l]=x.useState(null),b=x.useCallback(h=>{l(i?null:h.currentTarget)},[i]),m=!!i,S=x.useCallback(h=>{if(!h.startDate||!h.endDate){q.error("Please select a date range");return}if(H(h.startDate).isAfter(h.endDate)||!H(h.startDate).isValid()||!H(h.endDate).isValid()){q.error("Invalid date range");return}s([h.startDate,h.endDate]),l(null)},[s]);return e.jsxs("div",{children:[e.jsx(Y,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},sx:{mb:0},children:e.jsxs(Ce,{onClick:b,variant:"outlined",size:"small",color:"inherit",children:[He(t[0],n)," - ",He(t[1],n)]})}),e.jsx(Ee,{open:m,anchorEl:i,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(zt,{open:!0,maxDate:r,initialDateRange:{startDate:t[0],endDate:t[1]},toggle:b,definedRanges:Wt(r),onChange:S})})]})}We.propTypes={itemComponent:d.elementType.isRequired};function We({itemComponent:t,...s}){const{t:n}=Q();return!s?.filterList?.filter(i=>i.length).length?null:e.jsxs(N,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsx("div",{className:"toolbar-filter-title",children:n("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(Ft.TableFilterList,{...s,ItemComponent:t})})]})}function Me({label:t,onDelete:s,canDelete:n=()=>!0,...r}){const i=s&&typeof s=="function"?s:void 0;let l=!0;return n&&typeof n=="function"&&(l=n({label:t,...r})),e.jsx(ke,{label:t,variant:"outlined",...i&&l?{onDelete:i}:{}})}Me.propTypes={label:d.string.isRequired,onDelete:d.func,canDelete:d.func};const es=[{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}];dt.propTypes={loading:d.bool,onCancel:d.func,onConfirm:d.func};function dt({loading:t=!1,onCancel:s=()=>{},onConfirm:n=()=>{}}){const{t:r}=Q(),[i,l]=x.useState(es),[b,m]=x.useState(!0),S=(j,v)=>{v.checked=j.target.checked;const P=i.map(F=>({...F,checked:F.value===v.value?v.checked:F.checked}));l(P)},h=j=>{j.stopPropagation(),n({channels:i.filter(v=>v.checked).map(v=>v.value),isResendFailedOnly:b})};return e.jsxs(N,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(Y,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(N,{className:"choose-channel",children:e.jsxs(Fe,{component:"fieldset",variant:"standard",children:[e.jsx(Ge,{component:"legend",children:r("notification.selectChannels")}),e.jsx(Re,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:i.map(j=>e.jsx(Te,{control:e.jsx(Ie,{checked:j.checked,onChange:v=>S(v,j),name:j.value}),label:j.label},j.value))})]})}),e.jsx(N,{className:"resend-config-footer",children:e.jsx(Re,{children:e.jsx(Te,{control:e.jsx(Ie,{checked:b,onChange:j=>m(j.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(N,{className:"resend-config-footer-tip",sx:{display:"flex",justifyContent:"flex-end",gap:1},children:[e.jsx(Ce,{onClick:j=>{j.stopPropagation(),s()},color:"inherit",children:r("common.cancel")}),e.jsxs(Ce,{onClick:h,color:"primary",disabled:t,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[t&&e.jsx(Ye,{size:16}),r("common.confirm")]})]})]})}ut.propTypes={notificationId:d.string.isRequired,handleResend:d.func,resending:d.bool};function ut({notificationId:t,handleResend:s,resending:n=!1}){const{t:r,locale:i}=Q(),l=Je(),b=x.useMemo(()=>Qe(l,ct()),[l]),{getReceivers:m,inService:S,teamDid:h,getUser:j,blocklet:v}=_e(),[P,F]=x.useState(!1),[w,U]=x.useState([]),M=Ae({anchorEl:null,position:null}),L=Ae({anchorEl:null,position:null}),[k,$]=x.useState(null),[V,X]=x.useState({total:0,pageSize:10,pageCount:0,page:1}),[p,g]=x.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[H().subtract(1,"month").startOf("day").toDate(),H().endOf("day").toDate()]}),[T,D]=x.useState([]),O=[{label:r("notification.sendStatus.pending"),value:0,status:"pending"},{label:r("notification.sendStatus.success"),value:1,status:"success"},{label:r("notification.sendStatus.failed"),value:2,status:"failed"}],z=async()=>{if(!P&&t)try{F(!0);const a=await m({notificationId:t,...p}),o=a.list.map(c=>({...c,receiverUser:{...c.receiverUser,avatar:tt(c.receiverUser.avatar,h,S)}}));U(o),X(a.paging),F(!1)}catch(a){q.error(a.message),F(!1)}};x.useEffect(()=>{z()},[p]);const _=a=>{a.stopPropagation();const o=a.currentTarget;L.anchorEl=o;const c=o.getBoundingClientRect();L.position={top:c.top+window.scrollY,left:c.left+window.scrollX}},ie=a=>a.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(De,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(Pe,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:_,children:r("notification.resend")})}):null,se={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:V.page-1,rowsPerPage:V.pageSize,count:V.total,searchText:p.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:T,onRowSelectionChange:(a,o)=>{D(o.map(c=>c.dataIndex))},customToolbarSelect:ie},Z=({page:a,rowsPerPage:o,searchText:c,filterList:C})=>{const[,B=[],G=[],K=[]]=C;p.pageSize!==o?g(W=>({...W,pageSize:o,page:1})):p.page!==a+1?g(W=>({...W,page:a+1})):p.searchText!==c?g(W=>({...W,searchText:c,page:1})):pe(B,p.walletSendStatus)?pe(G,p.pushKitSendStatus)?pe(K,p.emailSendStatus)||g(W=>({...W,emailSendStatus:K,page:1})):g(W=>({...W,pushKitSendStatus:G,page:1})):g(W=>({...W,walletSendStatus:B,page:1}))},oe=x.useCallback(async(a,o)=>{if(!o)return!1;const c=await j(o);return c?a==="wallet"?Yt(c):a==="email"?Vt(v,c):a==="pushKit"?Gt(v,c):a==="webhook"?Jt(c):!0:!1},[j,v]),Ne=x.useCallback(a=>Qt(r,a),[r]),f=()=>{M.anchorEl=null,M.position=null,$(null)},u=()=>{L.anchorEl=null,L.position=null},y=async(a,o,c=!0,C="")=>{if(!(!o.length||!a.length))try{s(a,o,c,C),L.anchorEl||(await ge(.5),f())}catch(B){console.error("handleResend error",{error:B})}},I=async({channels:a,isResendFailedOnly:o})=>{const c=T.map(C=>w[C].receiver);await y(a,c,o),await ge(.5),u(),D([])},A=async(a,o=[],c=!0)=>{try{await y(["webhook"],[a.receiver],c,o)}catch(C){q.error(C.response?C.response.statusText:C.message)}},R=async(a,o,c,C=[],B=!0)=>{if(a.stopPropagation(),Xt(o,c)>=4){q.warning(r("notification.resendLimit"));return}if(!Le.includes(c)){await A(o,C,B);return}if(a){const K=a.currentTarget,W=K.getBoundingClientRect();M.anchorEl=K,M.position={top:W.top+window.scrollY,left:W.left+window.scrollX}}$({channel:c});try{const K=await oe(c,o.receiver);await ge(1),$({channel:c,result:K}),(typeof K=="boolean"&&K||yt(K)&&Object.values(K).every(W=>!!W))&&(await s([c],[o.receiver],B),L.anchorEl||(await ge(.5),f()))}catch(K){q.error(K.message)}},re=a=>{g(o=>({...o,dateRange:a,page:1}))},ne=(a,o,c,C)=>{a.stopPropagation();const B=c.filter(G=>G!==o);g(G=>({...G,[C]:B,page:1}))},le=J(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:a=>{const{receiverUser:o,receiver:c}=w[a];return o?e.jsxs(N,{"data-cy":`member-name-${o.fullName}`,sx:{display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start"},children:[e.jsx(Xe,{src:`${o.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:c,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(me,{children:o.fullName})]},c):e.jsx(jt,{size:14,responsive:!1,compact:!0,copyable:!1,did:c})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:p.walletSendStatus??[],customFilterListOptions:{render:a=>e.jsx(Se,{list:a,label:"Wallet",onDelete:(o,c)=>{o.stopPropagation(),ne(o,c,le[1].options.filterList,"walletSendStatus")}}),update:je},filterOptions:{names:O,fullWidth:!0,logic:ye,display:(a,o,c,C)=>e.jsx(we,{label:"Wallet",filterList:a,onChange:o,index:c,column:C,filterValues:O})},customBodyRenderLite:a=>{const{walletSendStatus:o,walletSendAt:c,walletSendFailedReason:C}=w[a];return e.jsx(ce,{status:o,updatedAt:c,reason:C,channel:"wallet",onResend:B=>R(B,w[a],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{pushKitSendStatus:o,pushKitSendAt:c,pushKitSendFailedReason:C}=w[a];return e.jsx(ce,{status:o,updatedAt:c,reason:C,channel:"pushkit",onResend:B=>R(B,w[a],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:p.pushKitSendStatus??[],customFilterListOptions:{render:a=>e.jsx(Se,{list:a,label:"Push Kit",onDelete:(o,c)=>{o.stopPropagation(),ne(o,c,le[2].options.filterList,"pushKitSendStatus")}}),update:je},filterOptions:{names:O,fullWidth:!0,logic:ye,display:(a,o,c,C)=>e.jsx(we,{label:"Push Kit",filterList:a,onChange:o,index:c,column:C,filterValues:O})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{emailSendStatus:o,emailSendAt:c,emailSendFailedReason:C}=w[a];return e.jsx(ce,{status:o,updatedAt:c,reason:C,channel:"email",onResend:B=>R(B,w[a],"email",[],!1)})},filter:!0,filterType:"custom",filterList:p.emailSendStatus??[],customFilterListOptions:{render:a=>e.jsx(Se,{list:a,label:"Email",onDelete:(o,c)=>{o.stopPropagation(),ne(o,c,le[3].options.filterList,"emailSendStatus")}}),update:je},filterOptions:{names:O,fullWidth:!0,logic:ye,display:(a,o,c,C)=>e.jsx(we,{label:"Email",filterList:a,onChange:o,index:c,column:C,filterValues:O})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:a=>{const{webhook:o}=w[a];if(!o)return null;const c=Object.entries(o)[0];if(!c)return null;const[C,B]=c,G=B[0];return e.jsx(N,{sx:{display:"flex",flexDirection:"column",gap:1},children:e.jsxs(N,{className:"webhook-item",sx:{fontSize:12},children:[e.jsx(me,{maxLength:30,children:C},C),e.jsx(ce,{status:G.status,updatedAt:G.sendAt,reason:G.failedReason,channel:"webhook",onResend:K=>R(K,w[a],"webhook",[C],!1)})]},C)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:a=>{const{createdAt:o}=w[a];return e.jsx(Ze,{value:o,locale:i,shouldUpdate:!0})}}}],[w,i,p,r]),mt=[e.jsx(ze,{value:p.dateRange,onChange:re},"date-picker"),e.jsx(De,{variant:"contained",size:"small",color:"primary",loading:P,startIcon:e.jsx(Bt,{}),onClick:()=>z(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(N,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(ss,{children:e.jsxs(et,{theme:b,children:[e.jsx(nt,{className:"receivers-table",locale:i,loading:P,columns:le,data:w,onChange:Z,options:se,customButtons:mt,components:{TableFilterList:a=>e.jsx(We,{...a,itemComponent:o=>e.jsx(Me,{...o,canDelete:()=>!1})})}}),M.anchorEl&&e.jsx(Ee,{open:!!M.anchorEl,anchorReference:"anchorPosition",anchorPosition:M.position,onClose:f,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(ns,{children:[e.jsxs(Y,{variant:"body1",component:"div",className:"check-title",children:[k?.channel," Checking"]}),e.jsx(N,{sx:{display:"flex",flexDirection:"column",gap:"4px"},children:Ne(k?.channel).map(a=>{const{type:o,pass:c,fail:C}=a;return!k?.result||k?.result?.[o]?e.jsxs(Y,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:k?.result?.[o]?be.success.main:"inherit"},children:[k?.result?e.jsx(Kt,{}):e.jsx(Ye,{size:12,sx:{color:be.primary.main}}),e.jsx("span",{children:c})]},o):e.jsxs(Y,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:be.error.main},children:[e.jsx(Mt,{}),e.jsx("span",{children:C})]},o)})})]})}),L.anchorEl&&e.jsx(Ee,{open:!!L.anchorEl,anchorReference:"anchorPosition",anchorPosition:L.position,onClose:u,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(dt,{loading:n,onCancel:u,onConfirm:I})})]})})})}const ts=x.memo(ut),ss=ae.div`
|
|
2
2
|
td.MuiTableCell-footer {
|
|
3
3
|
border: none !important;
|
|
4
4
|
}
|