@abtnode/blocklet-services 1.16.41-beta-20250318-012955-51b0ae39 → 1.16.41-beta-20250319-034744-5c62f533

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.
Files changed (169) hide show
  1. package/api/libs/connect/session.js +23 -12
  2. package/api/libs/open-graph/index.js +21 -11
  3. package/api/libs/open-graph/template.js +42 -2
  4. package/api/routes/user.js +51 -13
  5. package/api/services/auth/connect/receive-transfer-app-owner.js +15 -3
  6. package/api/services/auth/connect/rotate-key-pair.js +1 -1
  7. package/api/util/attach-shared-utils.js +1 -1
  8. package/dist/assets/{ArrowDropDown-qWbq0JMo.js → ArrowDropDown-ydRfHJ2x.js} +1 -1
  9. package/dist/assets/{CheckCircle-B3DI9-8u.js → CheckCircle-DgSwRUf8.js} +1 -1
  10. package/dist/assets/{ChevronLeft-QmS7XZ0_.js → ChevronLeft-CqDoHwdJ.js} +1 -1
  11. package/dist/assets/{ChevronRight-C-wVLPcS.js → ChevronRight-Bpkf9aqI.js} +1 -1
  12. package/dist/assets/{DeleteOutline-DMkWy6Ct.js → DeleteOutline-D4DYIaUj.js} +1 -1
  13. package/dist/assets/{Done-DMtnp3P-.js → Done-B8c93MpP.js} +1 -1
  14. package/dist/assets/{Download-BBNJo00y.js → Download-DANYdeZR.js} +1 -1
  15. package/dist/assets/{Error-H665t4TD.js → Error-wKO1hXtU.js} +1 -1
  16. package/dist/assets/{ExpandLess-DBi9UnX8.js → ExpandLess-BqrBuxL9.js} +1 -1
  17. package/dist/assets/{Google-Dmn0CqqC.js → Google-CBPWeaVC.js} +4 -4
  18. package/dist/assets/{InfoOutlined-A0h5OX7J.js → InfoOutlined-HP5LuELQ.js} +1 -1
  19. package/dist/assets/{Launch-Ca2Avd-H.js → Launch-XvyEoGhF.js} +1 -1
  20. package/dist/assets/{LaunchOutlined-LqfRJ-HK.js → LaunchOutlined-BfbVRiJT.js} +1 -1
  21. package/dist/assets/{MoreHoriz-I4HIq7xK.js → MoreHoriz-Cv3BqpRU.js} +1 -1
  22. package/dist/assets/{PlayArrow-ByDKBx4g.js → PlayArrow-DI84Lay5.js} +1 -1
  23. package/dist/assets/{ViewList-CHv7QZAz.js → ViewList-DLzG9ldE.js} +1 -1
  24. package/dist/assets/{access-control-CWfdDjGm.js → access-control-DyHt8ppX.js} +1 -1
  25. package/dist/assets/{actions-BlT0cxUG.js → actions-CBPbCBQc.js} +1 -1
  26. package/dist/assets/add-component-core-DOdhiJes.js +765 -0
  27. package/dist/assets/add-resource-CGPM0kPR.js +1 -0
  28. package/dist/assets/{addon-CY_qIvTD.js → addon-bbJfiLal.js} +1 -1
  29. package/dist/assets/{analytics-DjXhSquU.js → analytics-BRjS4mY-.js} +28 -28
  30. package/dist/assets/api-CvDkueg1.js +1 -0
  31. package/dist/assets/ar-A7PXaQSB.js +3 -0
  32. package/dist/assets/{audit-logs-f63v6qb6.js → audit-logs-D1W37Cj4.js} +1 -1
  33. package/dist/assets/{base32-BFbPN3_B.js → base32-gJJTbpiB.js} +1 -1
  34. package/dist/assets/{branding-M3jcBXbn.js → branding-DR3Jnq-d.js} +2 -2
  35. package/dist/assets/{bundle-avatar-CV6DwAbG.js → bundle-avatar-Eqwd2qUG.js} +1 -1
  36. package/dist/assets/{button-CobAXYnZ.js → button-BqyvGZC-.js} +1 -1
  37. package/dist/assets/{click-to-copy-4DAi5FNW.js → click-to-copy-Dc16fHKA.js} +1 -1
  38. package/dist/assets/{complete-BV8Jki_A.js → complete-BzSPyjUA.js} +1 -1
  39. package/dist/assets/{component-CHjmE2X3.js → component--_f-xKi7.js} +1 -1
  40. package/dist/assets/{config-AQxF4UXZ.js → config-BDpdqYom.js} +1 -1
  41. package/dist/assets/{config-D26mW5ts.js → config-C3tQWDAE.js} +1 -1
  42. package/dist/assets/config-navigation-BrXS6Zm4.js +29 -0
  43. package/dist/assets/{config-space-CEfS-edx.js → config-space-BZu4nd7t.js} +1 -1
  44. package/dist/assets/{confirm-AquAQGjx.js → confirm-CCmbVvGp.js} +1 -1
  45. package/dist/assets/{connect-C3HOcFE4.js → connect-Bgm2clKz.js} +1 -1
  46. package/dist/assets/{connect-BUUxpeii.js → connect-C1EdscR7.js} +1 -1
  47. package/dist/assets/{connect-to-DIh1QUDe.js → connect-to-CAjdR1Vi.js} +1 -1
  48. package/dist/assets/{dashboard-CgU5vYTc.js → dashboard-C2dbiNOp.js} +3 -3
  49. package/dist/assets/de-DQLOqs4x.js +3 -0
  50. package/dist/assets/{delete-confirm-3NLpiaw3.js → delete-confirm-CVo1ye7X.js} +1 -1
  51. package/dist/assets/{did-address-BOFBaeCw.js → did-address-DIKoCoBp.js} +1 -1
  52. package/dist/assets/{domain-By_3gkYk.js → domain-BQkRhwGe.js} +1 -1
  53. package/dist/assets/{domain-action-card-3cxCJSVs.js → domain-action-card-Dlgq4rsm.js} +1 -1
  54. package/dist/assets/domains-DaOwHgX-.js +1 -0
  55. package/dist/assets/{email-CIF4NKca.js → email-BHF0jLjs.js} +1 -1
  56. package/dist/assets/es-Wyib4tkS.js +3 -0
  57. package/dist/assets/{exchange-passport-CzS1Xb1d.js → exchange-passport-C6TpmUyM.js} +1 -1
  58. package/dist/assets/{form-text-input-BAXS_3xu.js → form-text-input-C8x5debf.js} +1 -1
  59. package/dist/assets/fr-CTdi8lPh.js +3 -0
  60. package/dist/assets/{fuel-mq0wsfbI.js → fuel-DQMzXBHQ.js} +1 -1
  61. package/dist/assets/{fullpage-Bo8SoEA1.js → fullpage-kiX9qo3H.js} +1 -1
  62. package/dist/assets/{get-safe-url-RpxfbZMw.js → get-safe-url-BvS0hy8W.js} +1 -1
  63. package/dist/assets/{get-safe-url-zNlUtfl-.js → get-safe-url-CXJBjnNj.js} +1 -1
  64. package/dist/assets/hi-Dk3MVpw6.js +1 -0
  65. package/dist/assets/{home-D5_68Jum.js → home-CfRR-l78.js} +1 -1
  66. package/dist/assets/id-BqyOVEFD.js +3 -0
  67. package/dist/assets/{iframe-Dg-K9tKI.js → iframe-C0FAfo1V.js} +1 -1
  68. package/dist/assets/{index-BNbCkJGk.js → index-BL64rJ3g.js} +1 -1
  69. package/dist/assets/{index-B1eW_9jO.js → index-BVjGveR4.js} +1 -1
  70. package/dist/assets/{index-9xLdpFIQ.js → index-BsMTGy4m.js} +1 -1
  71. package/dist/assets/{index-CE2_NNHG.js → index-Bv_udrJr.js} +1 -1
  72. package/dist/assets/index-CYdNDqQ1.js +104 -0
  73. package/dist/assets/{index-BQaClmdg.js → index-CmyG8bip.js} +1 -1
  74. package/dist/assets/{index-C564BFHJ.js → index-D2qwAqco.js} +1 -1
  75. package/dist/assets/{index-CT7JoARP.js → index-D5rqbUOM.js} +1 -1
  76. package/dist/assets/{index-DNXaKH5L.js → index-D8WxMgot.js} +3 -3
  77. package/dist/assets/index-DJJGXGi6.js +137 -0
  78. package/dist/assets/{index-D_zMGAKU.js → index-DQKEK30u.js} +1 -1
  79. package/dist/assets/{index-BYV52_OZ.js → index-Dal_0cM6.js} +1 -1
  80. package/dist/assets/{index-DxEhSAq4.js → index-Db8S8FOW.js} +1 -1
  81. package/dist/assets/{index-BkWaMAY7.js → index-DojJOk-8.js} +1 -1
  82. package/dist/assets/index-Dv43WFu_.js +220 -0
  83. package/dist/assets/{index-CosUPggW.js → index-Hc4fe8tE.js} +1 -1
  84. package/dist/assets/{index-S_LbRHmk.js → index-KP4WZslk.js} +1 -1
  85. package/dist/assets/{invitation-BXtb5O-j.js → invitation-CDtK_Uyv.js} +1 -1
  86. package/dist/assets/{invite-WH242mWa.js → invite-DSQnWK9o.js} +1 -1
  87. package/dist/assets/{issue-passport-B4E8dvwf.js → issue-passport-Bb_7kKPQ.js} +1 -1
  88. package/dist/assets/{item-CBVHWk6p.js → item-C1U0HVPR.js} +1 -1
  89. package/dist/assets/ja-BIiN349J.js +3 -0
  90. package/dist/assets/ko-D9z_sjE3.js +3 -0
  91. package/dist/assets/{layout-DfSNPKMl.js → layout-Bkn9nC3f.js} +1 -1
  92. package/dist/assets/{list-CENIOVAm.js → list-BIXoIHH2.js} +2 -1
  93. package/dist/assets/localization-Cf41fenL.js +1 -0
  94. package/dist/assets/{log-BXebsTbr.js → log-CuiY798z.js} +1 -1
  95. package/dist/assets/{login-Ocw0I3pN.js → login-Ds2aHi-M.js} +1 -1
  96. package/dist/assets/{login-oauth-callback-BRNb2ryy.js → login-oauth-callback-DAKHXtVv.js} +1 -1
  97. package/dist/assets/{logo-uploader-BbLU5__c.js → logo-uploader-DQCS5qZW.js} +3 -3
  98. package/dist/assets/{lost-passport-AqXyVK_F.js → lost-passport-DdbK0_Yc.js} +1 -1
  99. package/dist/assets/{omit-BySqlv7K.js → omit-DVwO9e3E.js} +1 -1
  100. package/dist/assets/{open-window-Cd4yc8mA.js → open-window-yeboX1Ru.js} +1 -1
  101. package/dist/assets/overview-DFNGZZos.js +12 -0
  102. package/dist/assets/{page-header-5sm-cgQK.js → page-header-DyeTxe1U.js} +1 -1
  103. package/dist/assets/{permission-DQCYXQUJ.js → permission-ZvUR5Tj-.js} +1 -1
  104. package/dist/assets/{preferences-CGAPawRw.js → preferences-Dx29Tgc2.js} +1 -1
  105. package/dist/assets/{profile-embed-CsLOY-3P.js → profile-embed-C_yYlnVt.js} +1 -1
  106. package/dist/assets/pt-DbNy95wU.js +1 -0
  107. package/dist/assets/publish-resource-CPSJ7Gd2.js +1 -0
  108. package/dist/assets/{react-beautiful-dnd.esm-CIox0WsN.js → react-beautiful-dnd.esm-DcDZ_Ghe.js} +1 -1
  109. package/dist/assets/{relative-time-CRrl1gSW.js → relative-time-xM8Zc84I.js} +1 -1
  110. package/dist/assets/ru-BEliZjDL.js +1 -0
  111. package/dist/assets/sdk-CVa22Xgm.js +1 -0
  112. package/dist/assets/{session-D7wR69VL.js → session-CD9NaM-v.js} +1 -1
  113. package/dist/assets/setup-CkUck5w6.js +19 -0
  114. package/dist/assets/{start-CAAERMvb.js → start-CRCAeTDI.js} +1 -1
  115. package/dist/assets/{status-DnvDsTz6.js → status-D8ugfvVU.js} +1 -1
  116. package/dist/assets/{step-actions-LZ6_MGpe.js → step-actions-C83ykph7.js} +1 -1
  117. package/dist/assets/{studio-Ccy_TWjv.js → studio-Cb_GlvSi.js} +1 -1
  118. package/dist/assets/{switch-control-BsVebsZm.js → switch-control-CJ1duVKM.js} +1 -1
  119. package/dist/assets/th-KPXdcBJ0.js +1 -0
  120. package/dist/assets/{traffic-BHL1S-qx.js → traffic-DjeUj5sV.js} +1 -1
  121. package/dist/assets/{transfer-Cnv8HjKE.js → transfer-B_MO7Mf7.js} +1 -1
  122. package/dist/assets/{unsubscribe-BviNUKwm.js → unsubscribe-ajBobtwD.js} +1 -1
  123. package/dist/assets/{useAsync-CDzQ0uN6.js → useAsync-D2OhgEkV.js} +1 -1
  124. package/dist/assets/{useAsyncRetry-CcF3e_P6.js → useAsyncRetry-CEJwVPZ6.js} +1 -1
  125. package/dist/assets/{useLocalStorage-CCDYY4Oj.js → useLocalStorage-CtbpqE0c.js} +1 -1
  126. package/dist/assets/{user-center-D0D8fiVb.js → user-center-D62gRjAl.js} +1 -1
  127. package/dist/assets/{util-B7dUkIpg.js → util-CohOBosL.js} +1 -1
  128. package/dist/assets/{util-pKcd70El.js → util-CzgwETtC.js} +1 -1
  129. package/dist/assets/{vendor-arcblock-BmGcldk1.js → vendor-arcblock-E5QJEgSK.js} +71 -71
  130. package/dist/assets/{vendor-hooks-DbRTDIFw.js → vendor-hooks-CYyfK9g3.js} +1 -1
  131. package/dist/assets/{vendor-utils-DJ1bmiuG.js → vendor-utils-CbeKtci8.js} +1 -1
  132. package/dist/assets/{vendor-ux-did-connect-4bCiyPYS.js → vendor-ux-did-connect-D75Zatzm.js} +44 -44
  133. package/dist/assets/vi-ChkGdSKU.js +1 -0
  134. package/dist/assets/wrap-locale-lZatlhee.js +1 -0
  135. package/dist/assets/zh-DDAGRLEd.js +4 -0
  136. package/dist/assets/zh-tw-DIWT2k6_.js +3 -0
  137. package/dist/images/banner.png +0 -0
  138. package/dist/index.html +5 -5
  139. package/dist/service-worker.js +1 -1
  140. package/package.json +28 -28
  141. package/dist/assets/add-component-core-CkafMVNq.js +0 -765
  142. package/dist/assets/add-resource-B6yfNhfJ.js +0 -1
  143. package/dist/assets/api-D2GjOmnt.js +0 -1
  144. package/dist/assets/ar-B77PsiKa.js +0 -3
  145. package/dist/assets/cloneDeep-SKWOTeUJ.js +0 -1
  146. package/dist/assets/config-navigation-CWecd6yU.js +0 -26
  147. package/dist/assets/de-DxPd91kE.js +0 -3
  148. package/dist/assets/domains-UcV83Tm2.js +0 -1
  149. package/dist/assets/es-BLYV0NxM.js +0 -3
  150. package/dist/assets/fr-CKRgIc8I.js +0 -3
  151. package/dist/assets/hi-C7aBkqb5.js +0 -1
  152. package/dist/assets/id-CCxzaFVu.js +0 -3
  153. package/dist/assets/index-Bgf07DdH.js +0 -220
  154. package/dist/assets/index-CeZInncP.js +0 -144
  155. package/dist/assets/index-DXodzmv1.js +0 -104
  156. package/dist/assets/ja-CtW6nj42.js +0 -3
  157. package/dist/assets/ko-DnLZZMTR.js +0 -3
  158. package/dist/assets/localization-Dp5KNtVj.js +0 -1
  159. package/dist/assets/overview-3qBN9FRv.js +0 -12
  160. package/dist/assets/pt-Do2DB7RU.js +0 -1
  161. package/dist/assets/publish-resource-CAFJkTLS.js +0 -1
  162. package/dist/assets/ru-DLPypCUz.js +0 -1
  163. package/dist/assets/sdk-CrU7nlFr.js +0 -1
  164. package/dist/assets/setup-JUlzHBjh.js +0 -19
  165. package/dist/assets/th-BgGjupIV.js +0 -1
  166. package/dist/assets/vi-Bye_bkKy.js +0 -1
  167. package/dist/assets/wrap-locale-h-Rh8AV-.js +0 -1
  168. package/dist/assets/zh-Dr6QyOeU.js +0 -4
  169. package/dist/assets/zh-tw-3LQ5YEkc.js +0 -3
@@ -1,4 +1,4 @@
1
- import{r as b}from"./vendor-react-DoD83n6N.js";import{j as e,E as d,a1 as Pe,R as bt,a4 as jt,T as G,a3 as R,A as Fe,bj as _e,co as et,cn as Te,bn as Ie,bO as De,x as ye,aj as Ee,a2 as tt,a9 as ae,V as nt,bd as Xe,bm as vt,bi as yt,ai as Je,cp as St}from"./vendor-mui-core-O22FPGM4.js";import{b as Z,av as re,z as Ct}from"./vendor-utils-DJ1bmiuG.js";import{V,p as L,a$ as Nt,r as Be,u as X,bM as wt,U as st,B as Ae,a2 as at,bd as be,ak as Rt,aq as Tt,bC as It}from"./vendor-ux-did-connect-4bCiyPYS.js";import{z as Dt,G as H,m as Et,I as Qe}from"./index-DXodzmv1.js";import{f as pe,a as Oe}from"./vendor-hooks-DbRTDIFw.js";import{S as ue}from"./shorten-label-DXrhdUJE.js";import{I as it}from"./index-CT7JoARP.js";import{S as At,a as Ot}from"./list-CENIOVAm.js";import{R as ze}from"./relative-time-CRrl1gSW.js";import{b as We}from"./dashboard-CgU5vYTc.js";import{W as Lt}from"./did-address-BOFBaeCw.js";import{p as ot}from"./util-pKcd70El.js";import{D as kt,g as Pt}from"./traffic-BHL1S-qx.js";import{B as rt}from"./bundle-avatar-CV6DwAbG.js";import{B as Ft}from"./index-9xLdpFIQ.js";import"./lottie-web-B6s7dDoL.js";import"./vendor-arcblock-BmGcldk1.js";import"./index-C46rA4HG.js";import"./InfoOutlined-A0h5OX7J.js";import"./useLocalStorage-CCDYY4Oj.js";import"./confirm-AquAQGjx.js";import"./format-error-LAoTjvJe.js";import"./PlayArrow-ByDKBx4g.js";import"./get-safe-url-zNlUtfl-.js";import"./session-D7wR69VL.js";import"./useAsyncRetry-CcF3e_P6.js";import"./useAsync-CDzQ0uN6.js";import"./useSetState-BL3ktMon.js";import"./base32-BFbPN3_B.js";import"./iframe-Dg-K9tKI.js";import"./LaunchOutlined-LqfRJ-HK.js";import"./ChevronLeft-QmS7XZ0_.js";import"./ChevronRight-C-wVLPcS.js";import"./index-DWJc5Rxl.js";import"./vendor-mui-x-K-9WHqhO.js";const lt=b.createContext({}),{Provider:_t,Consumer:es}=lt;function Bt({children:t,blocklet:n=""}){const{api:s,inService:i}=Dt(),[a,l]=b.useState([]),[p,f]=b.useState({total:0,pageSize:20,pageCount:0,page:1}),y=pe(()=>{var j;return(j=n.meta)==null?void 0:j.did},[n]),[S,T]=b.useState([]),N=async({page:j=1,pageSize:v=20,...x}={})=>{if(!y)return[];try{const w={paging:{page:j,pageSize:v},...x,teamDid:y,dateRange:x.dateRange?[H(x.dateRange[0]).toISOString(),H(x.dateRange[1]).toISOString()]:void 0},{dids:M,...B}=w;let K="";M.includes("system")&&(K="system");const _=M.filter(ee=>ee!=="system"),Q=await s.getNotificationSendLog({input:{...B,source:K,componentDids:_}});return l(Q.list),f(Q.paging),Q.list}catch(w){return V.error(w.message),[]}},A=async()=>{const j=await s.getNotificationComponents({input:{teamDid:y}});T(j.componentDids)},P=b.useCallback(j=>{const v=n.children.find(x=>{var w;return((w=x.meta)==null?void 0:w.did)===j});if(v)return v.ancestors=[n],v},[n]),O=async({notificationId:j,receivers:v,channels:x,...w})=>{await s.resendNotification({input:{teamDid:y,notificationId:j,receivers:v,channels:x.map(M=>M==="wallet"?L.NOTIFICATION_SEND_CHANNEL.WALLET:M==="pushKit"?L.NOTIFICATION_SEND_CHANNEL.PUSH:M),...w}})},F=b.useCallback(async j=>(await s.getUser({input:{teamDid:y,user:{did:j}}})).user,[s,y]),I=b.useCallback(async({page:j=1,pageSize:v=20,...x}={})=>{try{const w={paging:{page:j,pageSize:v},...x,userName:x.searchText||"",teamDid:y,dateRange:x.dateRange?[H(x.dateRange[0]).toISOString(),H(x.dateRange[1]).toISOString()]:void 0};return await s.getReceivers({input:w})}catch(w){throw V.error(w.message),w}},[s,y]);b.useEffect(()=>{y&&A()},[y]);const U={fetch:N,data:a,paging:p,blocklet:n,getComponent:P,resendNotification:O,getUser:F,componentDids:S,getReceivers:I,inService:i,teamDid:y};return e.jsx(_t,{value:{notificationRecords:U},children:t})}function Me(){const{notificationRecords:t}=b.useContext(lt);return t}fe.propTypes={severity:d.oneOf(Object.values(["info","success","error","warning"])).isRequired};const zt={info:"primary",success:"success",error:"error",warning:"warning"};function fe({severity:t="info"}){return e.jsx(Nt,{type:zt[t],children:t})}var qe={},Wt=Pe;Object.defineProperty(qe,"__esModule",{value:!0});var ct=qe.default=void 0,Mt=Wt(Be()),qt=e;ct=qe.default=(0,Mt.default)((0,qt.jsx)("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"CheckCircleOutline");var Ke={},Kt=Pe;Object.defineProperty(Ke,"__esModule",{value:!0});var dt=Ke.default=void 0,$t=Kt(Be()),Ht=e;dt=Ke.default=(0,$t.default)((0,Ht.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12m8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8"}),"Block");var $e={},Ut=Pe;Object.defineProperty($e,"__esModule",{value:!0});var ut=$e.default=void 0,Vt=Ut(Be()),Gt=e;ut=$e.default=(0,Vt.default)((0,Gt.jsx)("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"}),"Refresh");const Yt=(t,n,s="")=>{if(!s||!n)return"";switch(s){case L.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:n});case L.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:n});case L.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:n});case L.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return s}};function pt(t,n,s={}){const{status:i,updatedAt:a,reason:l="",channel:p="wallet"}=s,f=a?t("notification.sendStatus.sentTime",{date:Et(a,n)}):"",y=Yt(t,p,l);return i===L.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:f,reason:y}:i===L.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:f}:{status:"pending",title:t("notification.sendStatus.pending"),reason:y,sentTime:f}}const Le={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},ke=["wallet","pushKit","email"],Ze=["info","success","error","warning"],ft=t=>{var s,i;const{settings:n}=t;return(i=(s=n==null?void 0:n.notification)==null?void 0:s.email)==null?void 0:i.enabled},mt=t=>{var s,i;const{settings:n}=t;return(i=(s=n==null?void 0:n.notification)==null?void 0:s.pushKit)==null?void 0:i.enabled},Xt=(t,n)=>{const s=Z(n,"extra.notifications.email",!0);return{available:ft(t),enabled:s}},Jt=(t,n)=>{const s=Z(n,"extra.notifications.push",!0);return{available:mt(t),enabled:s}},Qt=t=>({enabled:Z(t,"extra.notifications.wallet",!0)}),Zt=t=>({enabled:Z(t,"extra.webhooks",[]).length>0}),ge=(t=3)=>new Promise(n=>{setTimeout(()=>{n()},t*1e3)}),en=(t,n)=>n==="wallet"||n==="webhook"?[{channel:n,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:n}),fail:t("notification.sendStatus.reason.disabled",{channel:n})}]:n==="pushKit"||n==="email"?[{channel:n,type:"available",pass:t("notification.sendStatus.reason.available",{channel:n}),fail:t("notification.sendStatus.reason.unavailable",{channel:n})},{channel:n,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:n}),fail:t("notification.sendStatus.reason.disabled",{channel:n})}]:[],xe=(t=[])=>{const n=H().startOf("day");return t.filter(s=>H(s.sendAt).isSame(n,"day")).length},tn=(t,n="")=>{if(n&&ke.includes(n)){const l=`${n}SendRecord`,p=Z(t,l,[]);return xe(p)}const s=Z(t,"webhook",{}),i=Object.keys(s??{})??[];if(n&&i.includes(n)){const l=s[n]??[];return xe(l)}const a={};return ke.forEach(l=>{const p=`${l}SendRecord`,f=Z(t,p,[]),y=xe(f);a[l]=y}),i.length>0&&i.forEach(l=>{const p=s[l]??[],f=xe(p);a[l]=f}),a},je=(t,n,s)=>{if(!Array.isArray(t))throw new Error("Invalid filterList or index");return t[s].splice(n,1),t},ve=(t,n)=>{if(!Array.isArray(n))throw new Error("filters must be an array");return n.length?!n.includes(t):!1},nn=t=>{switch(t){case L.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case L.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case L.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case L.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},ht=()=>bt({typography:{fontSize:14,button:{textTransform:"none"}},palette:{primary:{main:"#1DC1C7",contrastText:"#fff"},secondary:{main:"#030712",contrastText:"#fff"},storeSecondary:{main:"#EBFEFF",contrastText:"#fff"}},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 J({config:t,enableTooltip:n=!0,showTitle:s=!1,children:i}){const{status:a,title:l="",sentTime:p="",reason:f=""}=t,y=[l,f].filter(Boolean).join(", ");return e.jsx(jt,{title:n?e.jsxs(e.Fragment,{children:[e.jsx(G,{color:"inherit",sx:{fontSize:12},children:y}),e.jsx("span",{children:p})]}):null,arrow:!0,placement:"top",children:e.jsxs(R,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(R,{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center",children:[e.jsx(R,{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Le[a],style:{opacity:.15}}),e.jsx(R,{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Le[a]})]}),e.jsx(G,{color:"inherit",sx:{fontSize:12},children:s?l:i})]})})}J.propTypes={config:d.object.isRequired,enableTooltip:d.bool,showTitle:d.bool,children:d.node};J.defaultProps={enableTooltip:!0,showTitle:!1,children:null};le.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};le.defaultProps={onDelete:()=>{}};function le({list:t,label:n,onDelete:s}){const{t:i,locale:a}=X();return e.jsxs(R,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(G,{children:[n,": "]}),t.map(l=>{const p=pt(i,a,{status:l});return e.jsx(Fe,{size:"small",label:e.jsx(R,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(J,{config:p,enableTooltip:!1,children:p.title})}),onDelete:f=>s(f,l)},l)})]})}He.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 He({filterList:t,onChange:n,index:s,column:i,filterValues:a,label:l,renderLabel:p}){return e.jsxs(_e,{className:"filter-container",children:[e.jsx(et,{component:"legend",children:l}),e.jsx(Te,{row:!0,children:a.map(f=>e.jsx(Ie,{control:e.jsx(De,{checked:t[s].indexOf(f.value??f)>-1,onChange:y=>{const S=[...t];y.target.checked?S[s]=[...S[s],f.value??f]:S[s]=S[s].filter(T=>T!==(f.value??f)),n(S[s],s,i)},name:f.value??f}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:p(f)})},f.value??f))})]})}function Re(t){return e.jsx(He,{...t,renderLabel:n=>e.jsx(J,{enableTooltip:!1,config:{status:n.status},children:n.label})})}oe.propTypes={status:d.number.isRequired,updatedAt:d.string.isRequired,reason:d.string,channel:d.string,onResend:d.func};function oe({status:t,updatedAt:n,reason:s="",channel:i="wallet",onResend:a}){const{t:l,locale:p}=X(),f=pt(l,p,{status:t,updatedAt:n,reason:s,channel:i});return e.jsxs(R,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(J,{config:f,showTitle:!0}),f.status!=="success"&&e.jsx(ye,{className:"resend-btn",size:"small",startIcon:e.jsx(We,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:a,children:l("notification.resend")})]})}Ue.propTypes={value:d.array.isRequired,onChange:d.func};function Ue({value:t,onChange:n}){const{locale:s}=X(),i=H().toDate(),[a,l]=b.useState(null),p=b.useCallback(S=>{l(a?null:S.currentTarget)},[a]),f=!!a,y=b.useCallback(S=>{if(!S.startDate||!S.endDate){V.error("Please select a date range");return}if(H(S.startDate).isAfter(S.endDate)||!H(S.startDate).isValid()||!H(S.endDate).isValid()){V.error("Invalid date range");return}n([S.startDate,S.endDate]),l(null)},[n]);return e.jsxs("div",{children:[e.jsx(G,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:0,children:e.jsxs(ye,{onClick:p,variant:"outlined",size:"small",color:"inherit",children:[Qe(t[0],s)," - ",Qe(t[1],s)]})}),e.jsx(Ee,{open:f,anchorEl:a,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(kt,{open:!0,maxDate:i,initialDateRange:{startDate:t[0],endDate:t[1]},toggle:p,definedRanges:Pt(i),onChange:y})})]})}Ve.propTypes={itemComponent:d.elementType.isRequired};function Ve({itemComponent:t,...n}){var a;const{t:s}=X();return!((a=n==null?void 0:n.filterList)!=null&&a.filter(l=>l.length).length)?null:e.jsxs(R,{display:"flex",gap:1,alignItems:"center",children:[e.jsx("div",{className:"toolbar-filter-title",children:s("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(wt.TableFilterList,{...n,ItemComponent:t})})]})}function Se({label:t,onDelete:n,canDelete:s=()=>!0,...i}){const a=n&&typeof n=="function"?n:void 0;let l=!0;return s&&typeof s=="function"&&(l=s({label:t,...i})),e.jsx(Fe,{label:t,variant:"outlined",...a&&l?{onDelete:a}:{}})}Se.propTypes={label:d.string.isRequired,onDelete:d.func,canDelete:d.func};Se.defaultProps={canDelete:()=>!0};const sn=[{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}];Ge.propTypes={loading:d.bool,onCancel:d.func,onConfirm:d.func};Ge.defaultProps={loading:!1,onCancel:()=>{},onConfirm:()=>{}};function Ge({loading:t=!1,onCancel:n,onConfirm:s}){const{t:i}=X(),[a,l]=b.useState(sn),[p,f]=b.useState(!0),y=(T,N)=>{N.checked=T.target.checked;const A=a.map(P=>({...P,checked:P.value===N.value?N.checked:P.checked}));l(A)},S=T=>{T.stopPropagation(),s({channels:a.filter(N=>N.checked).map(N=>N.value),isResendFailedOnly:p})};return e.jsxs(R,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(G,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:i("notification.config")}),e.jsx(R,{className:"choose-channel",children:e.jsxs(_e,{component:"fieldset",variant:"standard",children:[e.jsx(et,{component:"legend",children:i("notification.selectChannels")}),e.jsx(Te,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:a.map(T=>e.jsx(Ie,{control:e.jsx(De,{checked:T.checked,onChange:N=>y(N,T),name:T.value}),label:T.label},T.value))})]})}),e.jsx(R,{className:"resend-config-footer",children:e.jsx(Te,{children:e.jsx(Ie,{control:e.jsx(De,{checked:p,onChange:T=>f(T.target.checked)}),label:i("notification.resendFailedOnly")})})}),e.jsxs(R,{display:"flex",justifyContent:"flex-end",gap:1,className:"resend-config-footer-tip",children:[e.jsx(ye,{onClick:T=>{T.stopPropagation(),n()},color:"inherit",children:i("common.cancel")}),e.jsxs(ye,{onClick:S,color:"primary",disabled:t,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[t&&e.jsx(tt,{size:16}),i("common.confirm")]})]})]})}gt.propTypes={notificationId:d.string.isRequired,handleResend:d.func,resending:d.bool};function gt({notificationId:t,handleResend:n,resending:s=!1}){const{t:i,locale:a}=X(),{getReceivers:l,inService:p,teamDid:f,getUser:y,blocklet:S}=Me(),[T,N]=b.useState(!1),[A,P]=b.useState([]),O=Oe({anchorEl:null,position:null}),F=Oe({anchorEl:null,position:null}),[I,U]=b.useState(null),[j,v]=b.useState({total:0,pageSize:10,pageCount:0,page:1}),[x,w]=b.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[H().subtract(1,"month").startOf("day").toDate(),H().endOf("day").toDate()]}),[M,B]=b.useState([]),K=[{label:i("notification.sendStatus.pending"),value:0,status:"pending"},{label:i("notification.sendStatus.success"),value:1,status:"success"},{label:i("notification.sendStatus.failed"),value:2,status:"failed"}],_=async()=>{if(!T&&t)try{N(!0);const o=await l({notificationId:t,...x}),r=o.list.map(c=>({...c,receiverUser:{...c.receiverUser,avatar:ot(c.receiverUser.avatar,f,p)}}));P(r),v(o.paging),N(!1)}catch(o){V.error(o.message),N(!1)}};b.useEffect(()=>{_()},[x]);const Q=o=>{o.stopPropagation();const r=o.currentTarget;F.anchorEl=r;const c=r.getBoundingClientRect();F.position={top:c.top+window.scrollY,left:c.left+window.scrollX}},ee=o=>o.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(Ae,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(We,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:Q,children:i("notification.resend")})}):null,Ne={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:i("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:j.page-1,rowsPerPage:j.pageSize,count:j.total,searchText:x.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:M,onRowSelectionChange:(o,r)=>{B(r.map(c=>c.dataIndex))},customToolbarSelect:ee},we=({page:o,rowsPerPage:r,searchText:c,filterList:C})=>{const[,k=[],$=[],q=[]]=C;x.pageSize!==r?w(W=>({...W,pageSize:r,page:1})):x.page!==o+1?w(W=>({...W,page:o+1})):x.searchText!==c?w(W=>({...W,searchText:c,page:1})):re(k,x.walletSendStatus)?re($,x.pushKitSendStatus)?re(q,x.emailSendStatus)||w(W=>({...W,emailSendStatus:q,page:1})):w(W=>({...W,pushKitSendStatus:$,page:1})):w(W=>({...W,walletSendStatus:k,page:1}))},me=b.useCallback(async(o,r)=>{if(!r)return!1;const c=await y(r);return c?o==="wallet"?Qt(c):o==="email"?Xt(S,c):o==="pushKit"?Jt(S,c):o==="webhook"?Zt(c):!0:!1},[y,S]),h=b.useCallback(o=>en(i,o),[i]),u=()=>{O.anchorEl=null,O.position=null,U(null)},m=()=>{F.anchorEl=null,F.position=null},g=async(o,r,c=!0,C="")=>{if(!(!r.length||!o.length))try{n(o,r,c,C),F.anchorEl||(await ge(.5),u())}catch(k){console.error("handleResend error",{error:k})}},D=async({channels:o,isResendFailedOnly:r})=>{const c=M.map(C=>A[C].receiver);await g(o,c,r),await ge(.5),m(),B([])},E=async(o,r=[],c=!0)=>{try{await g(["webhook"],[o.receiver],c,r)}catch(C){V.error(C.response?C.response.statusText:C.message)}},z=async(o,r,c,C=[],k=!0)=>{if(o.stopPropagation(),tn(r,c)>=4){V.warning(i("notification.resendLimit"));return}if(!ke.includes(c)){await E(r,C,k);return}if(o){const q=o.currentTarget,W=q.getBoundingClientRect();O.anchorEl=q,O.position={top:W.top+window.scrollY,left:W.left+window.scrollX}}U({channel:c});try{const q=await me(c,r.receiver);await ge(1),U({channel:c,result:q}),(typeof q=="boolean"&&q||Ct(q)&&Object.values(q).every(W=>!!W))&&(await n([c],[r.receiver],k),F.anchorEl||(await ge(.5),u()))}catch(q){V.error(q.message)}},Y=o=>{w(r=>({...r,dateRange:o,page:1}))},te=(o,r,c,C)=>{o.stopPropagation();const k=c.filter($=>$!==r);w($=>({...$,[C]:k,page:1}))},ie=pe(()=>[{label:i("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:o=>{const{receiverUser:r,receiver:c}=A[o];return r?e.jsxs(R,{"data-cy":`member-name-${r.fullName}`,display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start",children:[e.jsx(st,{src:`${r.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:c,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(ue,{children:r.fullName})]},c):e.jsx(Lt,{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:x.walletSendStatus??[],customFilterListOptions:{render:o=>e.jsx(le,{list:o,label:"Wallet",onDelete:(r,c)=>{r.stopPropagation(),te(r,c,ie[1].options.filterList,"walletSendStatus")}}),update:je},filterOptions:{names:K,fullWidth:!0,logic:ve,display:(o,r,c,C)=>e.jsx(Re,{label:"Wallet",filterList:o,onChange:r,index:c,column:C,filterValues:K})},customBodyRenderLite:o=>{const{walletSendStatus:r,walletSendAt:c,walletSendFailedReason:C}=A[o];return e.jsx(oe,{status:r,updatedAt:c,reason:C,channel:"wallet",onResend:k=>z(k,A[o],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:o=>{const{pushKitSendStatus:r,pushKitSendAt:c,pushKitSendFailedReason:C}=A[o];return e.jsx(oe,{status:r,updatedAt:c,reason:C,channel:"pushkit",onResend:k=>z(k,A[o],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:x.pushKitSendStatus??[],customFilterListOptions:{render:o=>e.jsx(le,{list:o,label:"Push Kit",onDelete:(r,c)=>{r.stopPropagation(),te(r,c,ie[2].options.filterList,"pushKitSendStatus")}}),update:je},filterOptions:{names:K,fullWidth:!0,logic:ve,display:(o,r,c,C)=>e.jsx(Re,{label:"Push Kit",filterList:o,onChange:r,index:c,column:C,filterValues:K})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:o=>{const{emailSendStatus:r,emailSendAt:c,emailSendFailedReason:C}=A[o];return e.jsx(oe,{status:r,updatedAt:c,reason:C,channel:"email",onResend:k=>z(k,A[o],"email",[],!1)})},filter:!0,filterType:"custom",filterList:x.emailSendStatus??[],customFilterListOptions:{render:o=>e.jsx(le,{list:o,label:"Email",onDelete:(r,c)=>{r.stopPropagation(),te(r,c,ie[3].options.filterList,"emailSendStatus")}}),update:je},filterOptions:{names:K,fullWidth:!0,logic:ve,display:(o,r,c,C)=>e.jsx(Re,{label:"Email",filterList:o,onChange:r,index:c,column:C,filterValues:K})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:o=>{const{webhook:r}=A[o];if(!r)return null;const c=Object.entries(r)[0];if(!c)return null;const[C,k]=c,$=k[0];return e.jsx(R,{display:"flex",flexDirection:"column",gap:1,children:e.jsxs(R,{className:"webhook-item",fontSize:12,children:[e.jsx(ue,{maxLength:30,children:C},C),e.jsx(oe,{status:$.status,updatedAt:$.sendAt,reason:$.failedReason,channel:"webhook",onResend:q=>z(q,A[o],"webhook",[C],!1)})]},C)})}}},{label:i("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:o=>{const{createdAt:r}=A[o];return e.jsx(ze,{value:r,locale:a,shouldUpdate:!0})}}}],[A,a,x,i]),he=[e.jsx(Ue,{value:x.dateRange,onChange:Y},"date-picker"),e.jsx(Ae,{variant:"contained",size:"small",color:"primary",loading:T,startIcon:e.jsx(ut,{}),onClick:()=>_(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:i("common.refresh")},"refresh")];return e.jsx(R,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(on,{children:e.jsxs(nt,{theme:ht(),children:[e.jsx(at,{className:"receivers-table",locale:a,loading:T,columns:ie,data:A,onChange:we,options:Ne,customButtons:he,components:{TableFilterList:o=>e.jsx(Ve,{...o,itemComponent:r=>e.jsx(Se,{...r,canDelete:()=>!1})})}}),O.anchorEl&&e.jsx(Ee,{open:!!O.anchorEl,anchorReference:"anchorPosition",anchorPosition:O.position,onClose:u,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(rn,{children:[e.jsxs(G,{variant:"body1",component:"div",className:"check-title",children:[I==null?void 0:I.channel," Checking"]}),e.jsx(R,{display:"flex",flexDirection:"column",sx:{gap:"4px"},children:h(I==null?void 0:I.channel).map(o=>{var k,$;const{type:r,pass:c,fail:C}=o;return!(I!=null&&I.result)||(k=I==null?void 0:I.result)!=null&&k[r]?e.jsxs(G,{variant:"body1",component:"div",className:"check-item",display:"flex",alignItems:"center",sx:{gap:"4px",color:($=I==null?void 0:I.result)!=null&&$[r]?be.success.main:"inherit"},children:[I!=null&&I.result?e.jsx(ct,{}):e.jsx(tt,{size:12,sx:{color:be.primary.main}}),e.jsx("span",{children:c})]},r):e.jsxs(G,{variant:"body1",component:"div",display:"flex",alignItems:"center",className:"check-item",sx:{gap:"4px",color:be.error.main},children:[e.jsx(dt,{}),e.jsx("span",{children:C})]},r)})})]})}),F.anchorEl&&e.jsx(Ee,{open:!!F.anchorEl,anchorReference:"anchorPosition",anchorPosition:F.position,onClose:m,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(Ge,{loading:s,onCancel:m,onConfirm:D})})]})})})}const an=b.memo(gt),on=ae.div`
1
+ import{r as b}from"./vendor-react-DoD83n6N.js";import{j as e,E as d,a1 as Pe,R as bt,a4 as jt,T as G,a3 as R,A as Fe,bj as _e,co as et,cn as Te,bn as Ie,bO as De,x as ye,aj as Ee,a2 as tt,a9 as ae,V as nt,bd as Xe,bm as vt,bi as yt,ai as Je,cp as St}from"./vendor-mui-core-O22FPGM4.js";import{b as Z,av as re,z as Ct}from"./vendor-utils-CbeKtci8.js";import{V,p as L,a$ as Nt,r as Be,u as X,bM as wt,U as st,B as Ae,a2 as at,bd as be,ak as Rt,aq as Tt,bC as It}from"./vendor-ux-did-connect-D75Zatzm.js";import{z as Dt,G as H,m as Et,I as Qe}from"./index-CYdNDqQ1.js";import{f as pe,a as Oe}from"./vendor-hooks-CYyfK9g3.js";import{S as ue}from"./shorten-label-DXrhdUJE.js";import{I as it}from"./index-D5rqbUOM.js";import{S as At,a as Ot}from"./list-BIXoIHH2.js";import{R as ze}from"./relative-time-xM8Zc84I.js";import{b as We}from"./dashboard-C2dbiNOp.js";import{W as Lt}from"./did-address-DIKoCoBp.js";import{p as ot}from"./util-CzgwETtC.js";import{D as kt,g as Pt}from"./traffic-DjeUj5sV.js";import{B as rt}from"./bundle-avatar-Eqwd2qUG.js";import{B as Ft}from"./index-BsMTGy4m.js";import"./lottie-web-B6s7dDoL.js";import"./vendor-arcblock-E5QJEgSK.js";import"./index-C46rA4HG.js";import"./InfoOutlined-HP5LuELQ.js";import"./useLocalStorage-CtbpqE0c.js";import"./confirm-CCmbVvGp.js";import"./format-error-LAoTjvJe.js";import"./PlayArrow-DI84Lay5.js";import"./get-safe-url-BvS0hy8W.js";import"./session-CD9NaM-v.js";import"./useAsyncRetry-CEJwVPZ6.js";import"./useAsync-D2OhgEkV.js";import"./useSetState-BL3ktMon.js";import"./base32-gJJTbpiB.js";import"./iframe-C0FAfo1V.js";import"./LaunchOutlined-BfbVRiJT.js";import"./ChevronLeft-CqDoHwdJ.js";import"./ChevronRight-Bpkf9aqI.js";import"./index-DWJc5Rxl.js";import"./vendor-mui-x-K-9WHqhO.js";const lt=b.createContext({}),{Provider:_t,Consumer:es}=lt;function Bt({children:t,blocklet:n=""}){const{api:s,inService:i}=Dt(),[a,l]=b.useState([]),[p,f]=b.useState({total:0,pageSize:20,pageCount:0,page:1}),y=pe(()=>{var j;return(j=n.meta)==null?void 0:j.did},[n]),[S,T]=b.useState([]),N=async({page:j=1,pageSize:v=20,...x}={})=>{if(!y)return[];try{const w={paging:{page:j,pageSize:v},...x,teamDid:y,dateRange:x.dateRange?[H(x.dateRange[0]).toISOString(),H(x.dateRange[1]).toISOString()]:void 0},{dids:M,...B}=w;let K="";M.includes("system")&&(K="system");const _=M.filter(ee=>ee!=="system"),Q=await s.getNotificationSendLog({input:{...B,source:K,componentDids:_}});return l(Q.list),f(Q.paging),Q.list}catch(w){return V.error(w.message),[]}},A=async()=>{const j=await s.getNotificationComponents({input:{teamDid:y}});T(j.componentDids)},P=b.useCallback(j=>{const v=n.children.find(x=>{var w;return((w=x.meta)==null?void 0:w.did)===j});if(v)return v.ancestors=[n],v},[n]),O=async({notificationId:j,receivers:v,channels:x,...w})=>{await s.resendNotification({input:{teamDid:y,notificationId:j,receivers:v,channels:x.map(M=>M==="wallet"?L.NOTIFICATION_SEND_CHANNEL.WALLET:M==="pushKit"?L.NOTIFICATION_SEND_CHANNEL.PUSH:M),...w}})},F=b.useCallback(async j=>(await s.getUser({input:{teamDid:y,user:{did:j}}})).user,[s,y]),I=b.useCallback(async({page:j=1,pageSize:v=20,...x}={})=>{try{const w={paging:{page:j,pageSize:v},...x,userName:x.searchText||"",teamDid:y,dateRange:x.dateRange?[H(x.dateRange[0]).toISOString(),H(x.dateRange[1]).toISOString()]:void 0};return await s.getReceivers({input:w})}catch(w){throw V.error(w.message),w}},[s,y]);b.useEffect(()=>{y&&A()},[y]);const U={fetch:N,data:a,paging:p,blocklet:n,getComponent:P,resendNotification:O,getUser:F,componentDids:S,getReceivers:I,inService:i,teamDid:y};return e.jsx(_t,{value:{notificationRecords:U},children:t})}function Me(){const{notificationRecords:t}=b.useContext(lt);return t}fe.propTypes={severity:d.oneOf(Object.values(["info","success","error","warning"])).isRequired};const zt={info:"primary",success:"success",error:"error",warning:"warning"};function fe({severity:t="info"}){return e.jsx(Nt,{type:zt[t],children:t})}var qe={},Wt=Pe;Object.defineProperty(qe,"__esModule",{value:!0});var ct=qe.default=void 0,Mt=Wt(Be()),qt=e;ct=qe.default=(0,Mt.default)((0,qt.jsx)("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"CheckCircleOutline");var Ke={},Kt=Pe;Object.defineProperty(Ke,"__esModule",{value:!0});var dt=Ke.default=void 0,$t=Kt(Be()),Ht=e;dt=Ke.default=(0,$t.default)((0,Ht.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12m8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8"}),"Block");var $e={},Ut=Pe;Object.defineProperty($e,"__esModule",{value:!0});var ut=$e.default=void 0,Vt=Ut(Be()),Gt=e;ut=$e.default=(0,Vt.default)((0,Gt.jsx)("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"}),"Refresh");const Yt=(t,n,s="")=>{if(!s||!n)return"";switch(s){case L.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:n});case L.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:n});case L.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:n});case L.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return s}};function pt(t,n,s={}){const{status:i,updatedAt:a,reason:l="",channel:p="wallet"}=s,f=a?t("notification.sendStatus.sentTime",{date:Et(a,n)}):"",y=Yt(t,p,l);return i===L.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:f,reason:y}:i===L.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:f}:{status:"pending",title:t("notification.sendStatus.pending"),reason:y,sentTime:f}}const Le={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},ke=["wallet","pushKit","email"],Ze=["info","success","error","warning"],ft=t=>{var s,i;const{settings:n}=t;return(i=(s=n==null?void 0:n.notification)==null?void 0:s.email)==null?void 0:i.enabled},mt=t=>{var s,i;const{settings:n}=t;return(i=(s=n==null?void 0:n.notification)==null?void 0:s.pushKit)==null?void 0:i.enabled},Xt=(t,n)=>{const s=Z(n,"extra.notifications.email",!0);return{available:ft(t),enabled:s}},Jt=(t,n)=>{const s=Z(n,"extra.notifications.push",!0);return{available:mt(t),enabled:s}},Qt=t=>({enabled:Z(t,"extra.notifications.wallet",!0)}),Zt=t=>({enabled:Z(t,"extra.webhooks",[]).length>0}),ge=(t=3)=>new Promise(n=>{setTimeout(()=>{n()},t*1e3)}),en=(t,n)=>n==="wallet"||n==="webhook"?[{channel:n,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:n}),fail:t("notification.sendStatus.reason.disabled",{channel:n})}]:n==="pushKit"||n==="email"?[{channel:n,type:"available",pass:t("notification.sendStatus.reason.available",{channel:n}),fail:t("notification.sendStatus.reason.unavailable",{channel:n})},{channel:n,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:n}),fail:t("notification.sendStatus.reason.disabled",{channel:n})}]:[],xe=(t=[])=>{const n=H().startOf("day");return t.filter(s=>H(s.sendAt).isSame(n,"day")).length},tn=(t,n="")=>{if(n&&ke.includes(n)){const l=`${n}SendRecord`,p=Z(t,l,[]);return xe(p)}const s=Z(t,"webhook",{}),i=Object.keys(s??{})??[];if(n&&i.includes(n)){const l=s[n]??[];return xe(l)}const a={};return ke.forEach(l=>{const p=`${l}SendRecord`,f=Z(t,p,[]),y=xe(f);a[l]=y}),i.length>0&&i.forEach(l=>{const p=s[l]??[],f=xe(p);a[l]=f}),a},je=(t,n,s)=>{if(!Array.isArray(t))throw new Error("Invalid filterList or index");return t[s].splice(n,1),t},ve=(t,n)=>{if(!Array.isArray(n))throw new Error("filters must be an array");return n.length?!n.includes(t):!1},nn=t=>{switch(t){case L.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case L.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case L.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case L.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},ht=()=>bt({typography:{fontSize:14,button:{textTransform:"none"}},palette:{primary:{main:"#1DC1C7",contrastText:"#fff"},secondary:{main:"#030712",contrastText:"#fff"},storeSecondary:{main:"#EBFEFF",contrastText:"#fff"}},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 J({config:t,enableTooltip:n=!0,showTitle:s=!1,children:i}){const{status:a,title:l="",sentTime:p="",reason:f=""}=t,y=[l,f].filter(Boolean).join(", ");return e.jsx(jt,{title:n?e.jsxs(e.Fragment,{children:[e.jsx(G,{color:"inherit",sx:{fontSize:12},children:y}),e.jsx("span",{children:p})]}):null,arrow:!0,placement:"top",children:e.jsxs(R,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(R,{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center",children:[e.jsx(R,{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Le[a],style:{opacity:.15}}),e.jsx(R,{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Le[a]})]}),e.jsx(G,{color:"inherit",sx:{fontSize:12},children:s?l:i})]})})}J.propTypes={config:d.object.isRequired,enableTooltip:d.bool,showTitle:d.bool,children:d.node};J.defaultProps={enableTooltip:!0,showTitle:!1,children:null};le.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};le.defaultProps={onDelete:()=>{}};function le({list:t,label:n,onDelete:s}){const{t:i,locale:a}=X();return e.jsxs(R,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(G,{children:[n,": "]}),t.map(l=>{const p=pt(i,a,{status:l});return e.jsx(Fe,{size:"small",label:e.jsx(R,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(J,{config:p,enableTooltip:!1,children:p.title})}),onDelete:f=>s(f,l)},l)})]})}He.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 He({filterList:t,onChange:n,index:s,column:i,filterValues:a,label:l,renderLabel:p}){return e.jsxs(_e,{className:"filter-container",children:[e.jsx(et,{component:"legend",children:l}),e.jsx(Te,{row:!0,children:a.map(f=>e.jsx(Ie,{control:e.jsx(De,{checked:t[s].indexOf(f.value??f)>-1,onChange:y=>{const S=[...t];y.target.checked?S[s]=[...S[s],f.value??f]:S[s]=S[s].filter(T=>T!==(f.value??f)),n(S[s],s,i)},name:f.value??f}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:p(f)})},f.value??f))})]})}function Re(t){return e.jsx(He,{...t,renderLabel:n=>e.jsx(J,{enableTooltip:!1,config:{status:n.status},children:n.label})})}oe.propTypes={status:d.number.isRequired,updatedAt:d.string.isRequired,reason:d.string,channel:d.string,onResend:d.func};function oe({status:t,updatedAt:n,reason:s="",channel:i="wallet",onResend:a}){const{t:l,locale:p}=X(),f=pt(l,p,{status:t,updatedAt:n,reason:s,channel:i});return e.jsxs(R,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(J,{config:f,showTitle:!0}),f.status!=="success"&&e.jsx(ye,{className:"resend-btn",size:"small",startIcon:e.jsx(We,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:a,children:l("notification.resend")})]})}Ue.propTypes={value:d.array.isRequired,onChange:d.func};function Ue({value:t,onChange:n}){const{locale:s}=X(),i=H().toDate(),[a,l]=b.useState(null),p=b.useCallback(S=>{l(a?null:S.currentTarget)},[a]),f=!!a,y=b.useCallback(S=>{if(!S.startDate||!S.endDate){V.error("Please select a date range");return}if(H(S.startDate).isAfter(S.endDate)||!H(S.startDate).isValid()||!H(S.endDate).isValid()){V.error("Invalid date range");return}n([S.startDate,S.endDate]),l(null)},[n]);return e.jsxs("div",{children:[e.jsx(G,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:0,children:e.jsxs(ye,{onClick:p,variant:"outlined",size:"small",color:"inherit",children:[Qe(t[0],s)," - ",Qe(t[1],s)]})}),e.jsx(Ee,{open:f,anchorEl:a,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(kt,{open:!0,maxDate:i,initialDateRange:{startDate:t[0],endDate:t[1]},toggle:p,definedRanges:Pt(i),onChange:y})})]})}Ve.propTypes={itemComponent:d.elementType.isRequired};function Ve({itemComponent:t,...n}){var a;const{t:s}=X();return!((a=n==null?void 0:n.filterList)!=null&&a.filter(l=>l.length).length)?null:e.jsxs(R,{display:"flex",gap:1,alignItems:"center",children:[e.jsx("div",{className:"toolbar-filter-title",children:s("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(wt.TableFilterList,{...n,ItemComponent:t})})]})}function Se({label:t,onDelete:n,canDelete:s=()=>!0,...i}){const a=n&&typeof n=="function"?n:void 0;let l=!0;return s&&typeof s=="function"&&(l=s({label:t,...i})),e.jsx(Fe,{label:t,variant:"outlined",...a&&l?{onDelete:a}:{}})}Se.propTypes={label:d.string.isRequired,onDelete:d.func,canDelete:d.func};Se.defaultProps={canDelete:()=>!0};const sn=[{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}];Ge.propTypes={loading:d.bool,onCancel:d.func,onConfirm:d.func};Ge.defaultProps={loading:!1,onCancel:()=>{},onConfirm:()=>{}};function Ge({loading:t=!1,onCancel:n,onConfirm:s}){const{t:i}=X(),[a,l]=b.useState(sn),[p,f]=b.useState(!0),y=(T,N)=>{N.checked=T.target.checked;const A=a.map(P=>({...P,checked:P.value===N.value?N.checked:P.checked}));l(A)},S=T=>{T.stopPropagation(),s({channels:a.filter(N=>N.checked).map(N=>N.value),isResendFailedOnly:p})};return e.jsxs(R,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(G,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:i("notification.config")}),e.jsx(R,{className:"choose-channel",children:e.jsxs(_e,{component:"fieldset",variant:"standard",children:[e.jsx(et,{component:"legend",children:i("notification.selectChannels")}),e.jsx(Te,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:a.map(T=>e.jsx(Ie,{control:e.jsx(De,{checked:T.checked,onChange:N=>y(N,T),name:T.value}),label:T.label},T.value))})]})}),e.jsx(R,{className:"resend-config-footer",children:e.jsx(Te,{children:e.jsx(Ie,{control:e.jsx(De,{checked:p,onChange:T=>f(T.target.checked)}),label:i("notification.resendFailedOnly")})})}),e.jsxs(R,{display:"flex",justifyContent:"flex-end",gap:1,className:"resend-config-footer-tip",children:[e.jsx(ye,{onClick:T=>{T.stopPropagation(),n()},color:"inherit",children:i("common.cancel")}),e.jsxs(ye,{onClick:S,color:"primary",disabled:t,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[t&&e.jsx(tt,{size:16}),i("common.confirm")]})]})]})}gt.propTypes={notificationId:d.string.isRequired,handleResend:d.func,resending:d.bool};function gt({notificationId:t,handleResend:n,resending:s=!1}){const{t:i,locale:a}=X(),{getReceivers:l,inService:p,teamDid:f,getUser:y,blocklet:S}=Me(),[T,N]=b.useState(!1),[A,P]=b.useState([]),O=Oe({anchorEl:null,position:null}),F=Oe({anchorEl:null,position:null}),[I,U]=b.useState(null),[j,v]=b.useState({total:0,pageSize:10,pageCount:0,page:1}),[x,w]=b.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[H().subtract(1,"month").startOf("day").toDate(),H().endOf("day").toDate()]}),[M,B]=b.useState([]),K=[{label:i("notification.sendStatus.pending"),value:0,status:"pending"},{label:i("notification.sendStatus.success"),value:1,status:"success"},{label:i("notification.sendStatus.failed"),value:2,status:"failed"}],_=async()=>{if(!T&&t)try{N(!0);const o=await l({notificationId:t,...x}),r=o.list.map(c=>({...c,receiverUser:{...c.receiverUser,avatar:ot(c.receiverUser.avatar,f,p)}}));P(r),v(o.paging),N(!1)}catch(o){V.error(o.message),N(!1)}};b.useEffect(()=>{_()},[x]);const Q=o=>{o.stopPropagation();const r=o.currentTarget;F.anchorEl=r;const c=r.getBoundingClientRect();F.position={top:c.top+window.scrollY,left:c.left+window.scrollX}},ee=o=>o.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(Ae,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(We,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:Q,children:i("notification.resend")})}):null,Ne={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:i("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:j.page-1,rowsPerPage:j.pageSize,count:j.total,searchText:x.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:M,onRowSelectionChange:(o,r)=>{B(r.map(c=>c.dataIndex))},customToolbarSelect:ee},we=({page:o,rowsPerPage:r,searchText:c,filterList:C})=>{const[,k=[],$=[],q=[]]=C;x.pageSize!==r?w(W=>({...W,pageSize:r,page:1})):x.page!==o+1?w(W=>({...W,page:o+1})):x.searchText!==c?w(W=>({...W,searchText:c,page:1})):re(k,x.walletSendStatus)?re($,x.pushKitSendStatus)?re(q,x.emailSendStatus)||w(W=>({...W,emailSendStatus:q,page:1})):w(W=>({...W,pushKitSendStatus:$,page:1})):w(W=>({...W,walletSendStatus:k,page:1}))},me=b.useCallback(async(o,r)=>{if(!r)return!1;const c=await y(r);return c?o==="wallet"?Qt(c):o==="email"?Xt(S,c):o==="pushKit"?Jt(S,c):o==="webhook"?Zt(c):!0:!1},[y,S]),h=b.useCallback(o=>en(i,o),[i]),u=()=>{O.anchorEl=null,O.position=null,U(null)},m=()=>{F.anchorEl=null,F.position=null},g=async(o,r,c=!0,C="")=>{if(!(!r.length||!o.length))try{n(o,r,c,C),F.anchorEl||(await ge(.5),u())}catch(k){console.error("handleResend error",{error:k})}},D=async({channels:o,isResendFailedOnly:r})=>{const c=M.map(C=>A[C].receiver);await g(o,c,r),await ge(.5),m(),B([])},E=async(o,r=[],c=!0)=>{try{await g(["webhook"],[o.receiver],c,r)}catch(C){V.error(C.response?C.response.statusText:C.message)}},z=async(o,r,c,C=[],k=!0)=>{if(o.stopPropagation(),tn(r,c)>=4){V.warning(i("notification.resendLimit"));return}if(!ke.includes(c)){await E(r,C,k);return}if(o){const q=o.currentTarget,W=q.getBoundingClientRect();O.anchorEl=q,O.position={top:W.top+window.scrollY,left:W.left+window.scrollX}}U({channel:c});try{const q=await me(c,r.receiver);await ge(1),U({channel:c,result:q}),(typeof q=="boolean"&&q||Ct(q)&&Object.values(q).every(W=>!!W))&&(await n([c],[r.receiver],k),F.anchorEl||(await ge(.5),u()))}catch(q){V.error(q.message)}},Y=o=>{w(r=>({...r,dateRange:o,page:1}))},te=(o,r,c,C)=>{o.stopPropagation();const k=c.filter($=>$!==r);w($=>({...$,[C]:k,page:1}))},ie=pe(()=>[{label:i("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:o=>{const{receiverUser:r,receiver:c}=A[o];return r?e.jsxs(R,{"data-cy":`member-name-${r.fullName}`,display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start",children:[e.jsx(st,{src:`${r.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:c,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(ue,{children:r.fullName})]},c):e.jsx(Lt,{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:x.walletSendStatus??[],customFilterListOptions:{render:o=>e.jsx(le,{list:o,label:"Wallet",onDelete:(r,c)=>{r.stopPropagation(),te(r,c,ie[1].options.filterList,"walletSendStatus")}}),update:je},filterOptions:{names:K,fullWidth:!0,logic:ve,display:(o,r,c,C)=>e.jsx(Re,{label:"Wallet",filterList:o,onChange:r,index:c,column:C,filterValues:K})},customBodyRenderLite:o=>{const{walletSendStatus:r,walletSendAt:c,walletSendFailedReason:C}=A[o];return e.jsx(oe,{status:r,updatedAt:c,reason:C,channel:"wallet",onResend:k=>z(k,A[o],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:o=>{const{pushKitSendStatus:r,pushKitSendAt:c,pushKitSendFailedReason:C}=A[o];return e.jsx(oe,{status:r,updatedAt:c,reason:C,channel:"pushkit",onResend:k=>z(k,A[o],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:x.pushKitSendStatus??[],customFilterListOptions:{render:o=>e.jsx(le,{list:o,label:"Push Kit",onDelete:(r,c)=>{r.stopPropagation(),te(r,c,ie[2].options.filterList,"pushKitSendStatus")}}),update:je},filterOptions:{names:K,fullWidth:!0,logic:ve,display:(o,r,c,C)=>e.jsx(Re,{label:"Push Kit",filterList:o,onChange:r,index:c,column:C,filterValues:K})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:o=>{const{emailSendStatus:r,emailSendAt:c,emailSendFailedReason:C}=A[o];return e.jsx(oe,{status:r,updatedAt:c,reason:C,channel:"email",onResend:k=>z(k,A[o],"email",[],!1)})},filter:!0,filterType:"custom",filterList:x.emailSendStatus??[],customFilterListOptions:{render:o=>e.jsx(le,{list:o,label:"Email",onDelete:(r,c)=>{r.stopPropagation(),te(r,c,ie[3].options.filterList,"emailSendStatus")}}),update:je},filterOptions:{names:K,fullWidth:!0,logic:ve,display:(o,r,c,C)=>e.jsx(Re,{label:"Email",filterList:o,onChange:r,index:c,column:C,filterValues:K})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:o=>{const{webhook:r}=A[o];if(!r)return null;const c=Object.entries(r)[0];if(!c)return null;const[C,k]=c,$=k[0];return e.jsx(R,{display:"flex",flexDirection:"column",gap:1,children:e.jsxs(R,{className:"webhook-item",fontSize:12,children:[e.jsx(ue,{maxLength:30,children:C},C),e.jsx(oe,{status:$.status,updatedAt:$.sendAt,reason:$.failedReason,channel:"webhook",onResend:q=>z(q,A[o],"webhook",[C],!1)})]},C)})}}},{label:i("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:o=>{const{createdAt:r}=A[o];return e.jsx(ze,{value:r,locale:a,shouldUpdate:!0})}}}],[A,a,x,i]),he=[e.jsx(Ue,{value:x.dateRange,onChange:Y},"date-picker"),e.jsx(Ae,{variant:"contained",size:"small",color:"primary",loading:T,startIcon:e.jsx(ut,{}),onClick:()=>_(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:i("common.refresh")},"refresh")];return e.jsx(R,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(on,{children:e.jsxs(nt,{theme:ht(),children:[e.jsx(at,{className:"receivers-table",locale:a,loading:T,columns:ie,data:A,onChange:we,options:Ne,customButtons:he,components:{TableFilterList:o=>e.jsx(Ve,{...o,itemComponent:r=>e.jsx(Se,{...r,canDelete:()=>!1})})}}),O.anchorEl&&e.jsx(Ee,{open:!!O.anchorEl,anchorReference:"anchorPosition",anchorPosition:O.position,onClose:u,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(rn,{children:[e.jsxs(G,{variant:"body1",component:"div",className:"check-title",children:[I==null?void 0:I.channel," Checking"]}),e.jsx(R,{display:"flex",flexDirection:"column",sx:{gap:"4px"},children:h(I==null?void 0:I.channel).map(o=>{var k,$;const{type:r,pass:c,fail:C}=o;return!(I!=null&&I.result)||(k=I==null?void 0:I.result)!=null&&k[r]?e.jsxs(G,{variant:"body1",component:"div",className:"check-item",display:"flex",alignItems:"center",sx:{gap:"4px",color:($=I==null?void 0:I.result)!=null&&$[r]?be.success.main:"inherit"},children:[I!=null&&I.result?e.jsx(ct,{}):e.jsx(tt,{size:12,sx:{color:be.primary.main}}),e.jsx("span",{children:c})]},r):e.jsxs(G,{variant:"body1",component:"div",display:"flex",alignItems:"center",className:"check-item",sx:{gap:"4px",color:be.error.main},children:[e.jsx(dt,{}),e.jsx("span",{children:C})]},r)})})]})}),F.anchorEl&&e.jsx(Ee,{open:!!F.anchorEl,anchorReference:"anchorPosition",anchorPosition:F.position,onClose:m,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(Ge,{loading:s,onCancel:m,onConfirm:D})})]})})})}const an=b.memo(gt),on=ae.div`
2
2
  td.MuiTableCell-footer {
3
3
  border: none !important;
4
4
  }
@@ -1,4 +1,4 @@
1
- import{E as r,a9 as f,j as i,by as T,a3 as S,a2 as D}from"./vendor-mui-core-O22FPGM4.js";import{a as $,k as E,u as P,l as U}from"./vendor-hooks-DbRTDIFw.js";import{N as q,R as F}from"./vendor-arcblock-BmGcldk1.js";import{r as m}from"./vendor-react-DoD83n6N.js";import{aX as M,ak as H,u as j,aL as O,p as B,aY as I,U as W}from"./vendor-ux-did-connect-4bCiyPYS.js";import{x as X}from"./vendor-utils-DJ1bmiuG.js";import{v as V,w as L,x as z}from"./index-DXodzmv1.js";import{u as Y}from"./use-passport-id-B-b-_oYF.js";import{u as J}from"./session-D7wR69VL.js";import{b as K}from"./sdk-CrU7nlFr.js";import{d as G}from"./CheckCircle-B3DI9-8u.js";import{w as Q}from"./wrap-locale-h-Rh8AV-.js";function k({invitation:e,createPassportSvg:a,passportColor:c}){const[p,n]=m.useState(!1),{t}=m.useContext(M),l=m.useMemo(()=>(e.role.title||e.role.name).toUpperCase(),[e.role.title,e.role.name]),u=m.useMemo(()=>a({title:l,issuer:e.info.name,issuerDid:e.info.appDid,ownerName:"Your Name",ownerDid:e.info.appDid,preferredColor:e.info.passportColor||c}),[e,l]),x=m.useCallback(()=>{n(!0)},[]),s=m.useCallback(()=>{n(!1)},[]);return i.jsxs(i.Fragment,{children:[i.jsx(Z,{children:i.jsxs("div",{className:"invite-passport__card",onClick:x,children:[!!e.display&&i.jsx(q,{data:e.display,style:{width:"100%",height:"100%"}}),!e.display&&i.jsx("div",{className:"invite-passport__cover",dangerouslySetInnerHTML:{__html:u}})]})}),i.jsx(H,{open:p,title:t("invite.viewPermission"),PaperProps:{style:{minHeight:"auto",paddingBottom:"20px"}},onClose:s,children:e.role.permissions&&e.role.permissions.length>0?i.jsx("ul",{style:{listStyle:"circle",padding:"0 20px"},children:e.role.permissions.map(o=>i.jsx("li",{style:{listStyle:"circle"},children:o.description},o.name))}):i.jsxs("div",{style:{color:"#999",textAlign:"center"},children:[i.jsx(T,{style:{width:"30px",height:"30px"}}),i.jsx("div",{children:t("invite.emptyPermission")})]})})]})}k.propTypes={invitation:r.object.isRequired,createPassportSvg:r.func.isRequired,passportColor:r.string};k.defaultProps={passportColor:"auto"};const Z=f.div`
1
+ import{E as r,a9 as f,j as i,by as T,a3 as S,a2 as D}from"./vendor-mui-core-O22FPGM4.js";import{a as $,k as E,u as P,l as U}from"./vendor-hooks-CYyfK9g3.js";import{N as q,R as F}from"./vendor-arcblock-E5QJEgSK.js";import{r as m}from"./vendor-react-DoD83n6N.js";import{aX as M,ak as H,u as j,aL as O,p as B,aY as I,U as W}from"./vendor-ux-did-connect-D75Zatzm.js";import{x as X}from"./vendor-utils-CbeKtci8.js";import{v as V,w as L,x as z}from"./index-CYdNDqQ1.js";import{u as Y}from"./use-passport-id-B-b-_oYF.js";import{u as J}from"./session-CD9NaM-v.js";import{b as K}from"./sdk-CVa22Xgm.js";import{d as G}from"./CheckCircle-DgSwRUf8.js";import{w as Q}from"./wrap-locale-lZatlhee.js";function k({invitation:e,createPassportSvg:a,passportColor:c}){const[p,n]=m.useState(!1),{t}=m.useContext(M),l=m.useMemo(()=>(e.role.title||e.role.name).toUpperCase(),[e.role.title,e.role.name]),u=m.useMemo(()=>a({title:l,issuer:e.info.name,issuerDid:e.info.appDid,ownerName:"Your Name",ownerDid:e.info.appDid,preferredColor:e.info.passportColor||c}),[e,l]),x=m.useCallback(()=>{n(!0)},[]),s=m.useCallback(()=>{n(!1)},[]);return i.jsxs(i.Fragment,{children:[i.jsx(Z,{children:i.jsxs("div",{className:"invite-passport__card",onClick:x,children:[!!e.display&&i.jsx(q,{data:e.display,style:{width:"100%",height:"100%"}}),!e.display&&i.jsx("div",{className:"invite-passport__cover",dangerouslySetInnerHTML:{__html:u}})]})}),i.jsx(H,{open:p,title:t("invite.viewPermission"),PaperProps:{style:{minHeight:"auto",paddingBottom:"20px"}},onClose:s,children:e.role.permissions&&e.role.permissions.length>0?i.jsx("ul",{style:{listStyle:"circle",padding:"0 20px"},children:e.role.permissions.map(o=>i.jsx("li",{style:{listStyle:"circle"},children:o.description},o.name))}):i.jsxs("div",{style:{color:"#999",textAlign:"center"},children:[i.jsx(T,{style:{width:"30px",height:"30px"}}),i.jsx("div",{children:t("invite.emptyPermission")})]})})]})}k.propTypes={invitation:r.object.isRequired,createPassportSvg:r.func.isRequired,passportColor:r.string};k.defaultProps={passportColor:"auto"};const Z=f.div`
2
2
  display: flex;
3
3
  max-width: 350px;
4
4
  margin: 30px auto;
@@ -1 +1 @@
1
- import{j as i,a3 as x}from"./vendor-mui-core-O22FPGM4.js";import{k as g,r as u}from"./vendor-react-DoD83n6N.js";import{u as v}from"./vendor-hooks-DbRTDIFw.js";import{I as w}from"./invitation-BXtb5O-j.js";import{F as I}from"./fullpage-Bo8SoEA1.js";import{u as k,aN as S,p as T}from"./vendor-ux-did-connect-4bCiyPYS.js";import{H as j}from"./vendor-arcblock-BmGcldk1.js";import{g as E}from"./get-safe-url-RpxfbZMw.js";import{u as P,d as F,c as R,s as W,a as C}from"./index-DXodzmv1.js";import"./vendor-utils-DJ1bmiuG.js";import"./use-passport-id-B-b-_oYF.js";import"./session-D7wR69VL.js";import"./sdk-CrU7nlFr.js";import"./CheckCircle-B3DI9-8u.js";import"./wrap-locale-h-Rh8AV-.js";import"./lottie-web-B6s7dDoL.js";function y(c){var r;const m=g(),{searchParams:s}=new URL(window.location.href),{api:p,session:d}=P(),{t:f}=k(),a=s.get("inviteId"),n=s.get("redirect"),h=u.useCallback(async()=>{const{data:t}=await F.get("invitation",{params:{inviteId:a}});return t},[a]),l=v(async(t,o=e=>e)=>{t&&(W(o(t.sessionToken)),C(o(t.refreshToken)),t.visitorId&&S(o(t.visitorId))),await d.refresh(),setTimeout(()=>{if(n){const e=decodeURIComponent(n);e.startsWith(T.WELLKNOWN_SERVICE_PATH_PREFIX)?m(e,{replace:!0}):window.location.href=E(e)}else window.location.href=window.env.pathPrefix||"/"},50)});return i.jsxs(I,{did:(r=window.blocklet)==null?void 0:r.appPid,children:[i.jsx(j,{children:i.jsx("title",{children:f("pageTitle.invite")})}),i.jsx(x,{sx:{width:"560px",maxWidth:"100%",height:"100%"},className:"page-invite",children:i.jsx(w,{...c,getDataFn:h,checkFn:p.get,createPassportSvg:R,onLoginSuccess:l,inService:!0})})]})}export{y as default};
1
+ import{j as i,a3 as x}from"./vendor-mui-core-O22FPGM4.js";import{k as g,r as u}from"./vendor-react-DoD83n6N.js";import{u as v}from"./vendor-hooks-CYyfK9g3.js";import{I as w}from"./invitation-CDtK_Uyv.js";import{F as I}from"./fullpage-kiX9qo3H.js";import{u as k,aN as S,p as T}from"./vendor-ux-did-connect-D75Zatzm.js";import{H as j}from"./vendor-arcblock-E5QJEgSK.js";import{g as E}from"./get-safe-url-CXJBjnNj.js";import{u as P,d as F,c as R,s as W,a as C}from"./index-CYdNDqQ1.js";import"./vendor-utils-CbeKtci8.js";import"./use-passport-id-B-b-_oYF.js";import"./session-CD9NaM-v.js";import"./sdk-CVa22Xgm.js";import"./CheckCircle-DgSwRUf8.js";import"./wrap-locale-lZatlhee.js";import"./lottie-web-B6s7dDoL.js";function y(c){var r;const m=g(),{searchParams:s}=new URL(window.location.href),{api:p,session:d}=P(),{t:f}=k(),a=s.get("inviteId"),n=s.get("redirect"),h=u.useCallback(async()=>{const{data:t}=await F.get("invitation",{params:{inviteId:a}});return t},[a]),l=v(async(t,o=e=>e)=>{t&&(W(o(t.sessionToken)),C(o(t.refreshToken)),t.visitorId&&S(o(t.visitorId))),await d.refresh(),setTimeout(()=>{if(n){const e=decodeURIComponent(n);e.startsWith(T.WELLKNOWN_SERVICE_PATH_PREFIX)?m(e,{replace:!0}):window.location.href=E(e)}else window.location.href=window.env.pathPrefix||"/"},50)});return i.jsxs(I,{did:(r=window.blocklet)==null?void 0:r.appPid,children:[i.jsx(j,{children:i.jsx("title",{children:f("pageTitle.invite")})}),i.jsx(x,{sx:{width:"560px",maxWidth:"100%",height:"100%"},className:"page-invite",children:i.jsx(w,{...c,getDataFn:h,checkFn:p.get,createPassportSvg:R,onLoginSuccess:l,inService:!0})})]})}export{y as default};
@@ -1 +1 @@
1
- import{j as e,a2 as w,a3 as v}from"./vendor-mui-core-O22FPGM4.js";import{a as I,l as P,u as m}from"./vendor-hooks-DbRTDIFw.js";import{I as T}from"./invitation-BXtb5O-j.js";import{F as k}from"./fullpage-Bo8SoEA1.js";import{u as j,aN as R,p as S}from"./vendor-ux-did-connect-4bCiyPYS.js";import{H as E}from"./vendor-arcblock-BmGcldk1.js";import{g as F}from"./get-safe-url-RpxfbZMw.js";import{u as C,c as L,s as N,a as W}from"./index-DXodzmv1.js";import{k as H}from"./vendor-react-DoD83n6N.js";import"./vendor-utils-DJ1bmiuG.js";import"./use-passport-id-B-b-_oYF.js";import"./session-D7wR69VL.js";import"./sdk-CrU7nlFr.js";import"./CheckCircle-B3DI9-8u.js";import"./wrap-locale-h-Rh8AV-.js";import"./lottie-web-B6s7dDoL.js";function Q(f){var p;const{searchParams:a}=new URL(window.location.href),{api:r,session:d}=C(),u=H(),{t:h}=j(),n=a.get("id"),c=a.get("redirect"),l=I({state:""}),s=P(async()=>{if(!n)return null;const{data:t}=await r.get("/api/invitation",{params:{inviteId:n,mode:"issue-passport"}});return t}),g=m(()=>{if(s.error)throw s.error;return s==null?void 0:s.data}),x=m(async(t,i=o=>o)=>{t&&(t.sessionToken&&N(i(t.sessionToken)),t.refreshToken&&W(i(t.refreshToken)),t.visitorId&&R(i(t.visitorId)),await d.refresh()),setTimeout(()=>{if(c){const o=decodeURIComponent(c);o.startsWith(S.WELLKNOWN_SERVICE_PATH_PREFIX)?u(o,{replace:!0}):window.location.href=F(o)}else window.location.href=window.env.pathPrefix||"/"},50)});return s.loading?e.jsx(w,{}):e.jsxs(k,{did:(p=window.blocklet)==null?void 0:p.appPid,children:[e.jsx(E,{children:e.jsx("title",{children:h("pageTitle.issuePassport")})}),e.jsx(v,{className:"page-invite",sx:{width:"560px",maxWidth:"100%",height:"100%"},children:e.jsx(T,{...f,action:"issue-passport",getDataFn:g,checkFn:r.get,createPassportSvg:L,onLoginSuccess:x,inService:!0,status:l.state})})]})}export{Q as default};
1
+ import{j as e,a2 as w,a3 as v}from"./vendor-mui-core-O22FPGM4.js";import{a as I,l as P,u as m}from"./vendor-hooks-CYyfK9g3.js";import{I as T}from"./invitation-CDtK_Uyv.js";import{F as k}from"./fullpage-kiX9qo3H.js";import{u as j,aN as R,p as S}from"./vendor-ux-did-connect-D75Zatzm.js";import{H as E}from"./vendor-arcblock-E5QJEgSK.js";import{g as F}from"./get-safe-url-CXJBjnNj.js";import{u as C,c as L,s as N,a as W}from"./index-CYdNDqQ1.js";import{k as H}from"./vendor-react-DoD83n6N.js";import"./vendor-utils-CbeKtci8.js";import"./use-passport-id-B-b-_oYF.js";import"./session-CD9NaM-v.js";import"./sdk-CVa22Xgm.js";import"./CheckCircle-DgSwRUf8.js";import"./wrap-locale-lZatlhee.js";import"./lottie-web-B6s7dDoL.js";function Q(f){var p;const{searchParams:a}=new URL(window.location.href),{api:r,session:d}=C(),u=H(),{t:h}=j(),n=a.get("id"),c=a.get("redirect"),l=I({state:""}),s=P(async()=>{if(!n)return null;const{data:t}=await r.get("/api/invitation",{params:{inviteId:n,mode:"issue-passport"}});return t}),g=m(()=>{if(s.error)throw s.error;return s==null?void 0:s.data}),x=m(async(t,i=o=>o)=>{t&&(t.sessionToken&&N(i(t.sessionToken)),t.refreshToken&&W(i(t.refreshToken)),t.visitorId&&R(i(t.visitorId)),await d.refresh()),setTimeout(()=>{if(c){const o=decodeURIComponent(c);o.startsWith(S.WELLKNOWN_SERVICE_PATH_PREFIX)?u(o,{replace:!0}):window.location.href=F(o)}else window.location.href=window.env.pathPrefix||"/"},50)});return s.loading?e.jsx(w,{}):e.jsxs(k,{did:(p=window.blocklet)==null?void 0:p.appPid,children:[e.jsx(E,{children:e.jsx("title",{children:h("pageTitle.issuePassport")})}),e.jsx(v,{className:"page-invite",sx:{width:"560px",maxWidth:"100%",height:"100%"},children:e.jsx(T,{...f,action:"issue-passport",getDataFn:g,checkFn:r.get,createPassportSvg:L,onLoginSuccess:x,inService:!0,status:l.state})})]})}export{Q as default};