@abtnode/webapp 1.16.43-beta-20250507-131727-e3e5be46 → 1.16.43-beta-20250509-094134-34c76f98

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 (204) hide show
  1. package/blocklet.js +1 -1
  2. package/blocklet.yml +1 -1
  3. package/dist/assets/{AdapterDayjs-DN3WVSzh.js → AdapterDayjs-Dd7kIQDg.js} +6 -6
  4. package/dist/assets/{Add-B5o3lKZ4.js → Add-DyqE7ma4.js} +1 -1
  5. package/dist/assets/{ArrowDropDown-RVN4Mn-W.js → ArrowDropDown-srvJwv_s.js} +1 -1
  6. package/dist/assets/{Autocomplete-DHpI8PP1.js → Autocomplete-DgD7oXbC.js} +1 -1
  7. package/dist/assets/{Breadcrumbs-BO8goWHs.js → Breadcrumbs-BjBCOm__.js} +1 -1
  8. package/dist/assets/{ButtonGroup-DP9Um2zw.js → ButtonGroup-CETfqQqG.js} +1 -1
  9. package/dist/assets/{CSSTransition-Ce16mrqT.js → CSSTransition-8GXDrEVI.js} +1 -1
  10. package/dist/assets/{CallMerge-D9pdEpQ4.js → CallMerge-D1kGN-Yl.js} +1 -1
  11. package/dist/assets/{CardContent-CV6vnW6h.js → CardContent-BsBNKLwR.js} +1 -1
  12. package/dist/assets/{ChevronLeft-CVA4N8rQ.js → ChevronLeft-CQJA5jUj.js} +1 -1
  13. package/dist/assets/{ChevronRight-sZUpX7tH.js → ChevronRight-B3ioYqvf.js} +1 -1
  14. package/dist/assets/{Clear-C7odY-6_.js → Clear-C23RMA8O.js} +1 -1
  15. package/dist/assets/{Close-w8eKEJW7.js → Close-CMKp87zW.js} +1 -1
  16. package/dist/assets/{Community-CIu-cG23.js → Community-B9PcA7bL.js} +1 -1
  17. package/dist/assets/{Delete-DSB9GjVg.js → Delete-DemQysCs.js} +1 -1
  18. package/dist/assets/{Delete-DpNbJCJA.js → Delete-X-iZLu8W.js} +1 -1
  19. package/dist/assets/{DeleteOutline-B4zcgGCZ.js → DeleteOutline-CBtSJ3uj.js} +1 -1
  20. package/dist/assets/{Done-CasEZEMQ.js → Done-LO8W9lyO.js} +1 -1
  21. package/dist/assets/{Edit-D9oke1qz.js → Edit-qCwSqHzK.js} +1 -1
  22. package/dist/assets/{ErrorOutline-cX4XY61i.js → ErrorOutline-CpLJ4ot-.js} +1 -1
  23. package/dist/assets/{HelpOutline-B-3RVeU3.js → HelpOutline-B7KAkB_W.js} +1 -1
  24. package/dist/assets/{Holiday-CWWiyhee.js → Holiday-DLF993Gr.js} +1 -1
  25. package/dist/assets/{Launch-9QmeNFGh.js → Launch-CbHu_JiN.js} +1 -1
  26. package/dist/assets/{Link-V0zXa94b.js → Link-BJsvTgLA.js} +1 -1
  27. package/dist/assets/{ListItemButton-Drq6UK1v.js → ListItemButton-DU8Ok_s-.js} +1 -1
  28. package/dist/assets/{ListSubheader-r9QVg4z3.js → ListSubheader-C2HVg1lq.js} +1 -1
  29. package/dist/assets/{LoadingButton-CwgQEhJX.js → LoadingButton-JtnEy6x-.js} +1 -1
  30. package/dist/assets/{LockIcon-AR8ebEzv.js → LockIcon-BeIxsnPz.js} +1 -1
  31. package/dist/assets/{Meeting-CF-WhmPM.js → Meeting-BL7WF2AJ.js} +1 -1
  32. package/dist/assets/{MoreHoriz-DuOMe2bn.js → MoreHoriz-_l-lUoyq.js} +1 -1
  33. package/dist/assets/{MoreVert-UFPlWjze.js → MoreVert-T7jlVzCd.js} +1 -1
  34. package/dist/assets/{OffSick-CSP2kO-5.js → OffSick-D6JEPSYU.js} +1 -1
  35. package/dist/assets/{OpenInNew-6pTIeS0r.js → OpenInNew-Bh0ZyNdY.js} +1 -1
  36. package/dist/assets/{Public-Cm3uAF1d.js → Public-BieGltlg.js} +1 -1
  37. package/dist/assets/{Refresh-DsQW01Ya.js → Refresh-CtWiwbL8.js} +1 -1
  38. package/dist/assets/{SchemaReference.es-BPpguI5D.js → SchemaReference.es-CN84fzHD.js} +1 -1
  39. package/dist/assets/{Search-DnEqCvoa.js → Search-CzTpAOa9.js} +1 -1
  40. package/dist/assets/{Slider-DRcvOlgL.js → Slider-DNt5jJD4.js} +1 -1
  41. package/dist/assets/{Stepper-DfLckKIy.js → Stepper-EVvxFm-l.js} +1 -1
  42. package/dist/assets/{TableRow-BMSWmGPk.js → TableRow-Cr41eTmp.js} +1 -1
  43. package/dist/assets/{TableSearch-Dobasaj8.js → TableSearch-DBDA-JAl.js} +1 -1
  44. package/dist/assets/{ToggleButtonGroup-CfjCj__G.js → ToggleButtonGroup-CmondxKP.js} +1 -1
  45. package/dist/assets/{Verified-oP4ZelZh.js → Verified-BrGKKjLS.js} +1 -1
  46. package/dist/assets/{VerifiedUser-CzEMJOGM.js → VerifiedUser-T9tFwB9U.js} +1 -1
  47. package/dist/assets/{ViewColumn-BIPD356c.js → ViewColumn-CQJvMaMH.js} +1 -1
  48. package/dist/assets/{ViewList-BYQ2Wo2N.js → ViewList-BSeqocMD.js} +1 -1
  49. package/dist/assets/{WorkingRemotely-B8U5I0AD.js → WorkingRemotely-DSoKGD6u.js} +1 -1
  50. package/dist/assets/{_createAggregator-BzC5cfxy.js → _createAggregator-CJSDSMg6.js} +1 -1
  51. package/dist/assets/{actions-C1blhdkh.js → actions-Bv3_VVES.js} +1 -1
  52. package/dist/assets/{actions-CIvfyQ4N.js → actions-R0k2zQ3B.js} +1 -1
  53. package/dist/assets/{agreement-BKAba3Bu.js → agreement--xEd5J2_.js} +1 -1
  54. package/dist/assets/api-DG7in6iX.js +1 -0
  55. package/dist/assets/{appearance-BT6nflvn.js → appearance-By8P7pS8.js} +1 -1
  56. package/dist/assets/{audit-logs-CxO1RKPM.js → audit-logs-axk4FVuN.js} +2 -2
  57. package/dist/assets/{blocklet-DgGtZNCB.js → blocklet-n2QLVVft.js} +1 -1
  58. package/dist/assets/{brace-fold.es-D7zHyRiF.js → brace-fold.es-CpmacDXy.js} +1 -1
  59. package/dist/assets/{chain-CMNZiwbz.js → chain-B3UsKW7l.js} +1 -1
  60. package/dist/assets/click-to-copy-BBx903lR.js +1 -0
  61. package/dist/assets/cloneDeep-DdAFYsMv.js +1 -0
  62. package/dist/assets/{closebrackets.es-BY2R-PDl.js → closebrackets.es-BPM7qcyy.js} +1 -1
  63. package/dist/assets/{codemirror.es-Bj7wxben.js → codemirror.es-rKm7-8so.js} +1 -1
  64. package/dist/assets/{comment.es-9NAetJeX.js → comment.es-cEEILSJL.js} +1 -1
  65. package/dist/assets/{config-navigation-BeyhoAYd.js → config-navigation-RVGkWDYS.js} +3 -3
  66. package/dist/assets/{connect-to-B2UoY2JL.js → connect-to-Cu2hr8Uh.js} +1 -1
  67. package/dist/assets/{delete-confirm-B0FL8Sx7.js → delete-confirm-C6MdS5sY.js} +1 -1
  68. package/dist/assets/{detail-Lgl7Opc1.js → detail-C1bo_0g-.js} +3 -3
  69. package/dist/assets/{dialog.es-CV929pYp.js → dialog.es-B1IFC9u6.js} +1 -1
  70. package/dist/assets/domains-2uhvPnPP.js +24 -0
  71. package/dist/assets/{download-IW0OxyHF.js → download-CNUneSlg.js} +1 -1
  72. package/dist/assets/emotion-react.browser.esm-Dyrm_eeQ.js +1 -0
  73. package/dist/assets/{foldgutter.es-D3SAnwjU.js → foldgutter.es-C2vuNFxa.js} +1 -1
  74. package/dist/assets/{get-safe-url-BQ9e1d8R.js → get-safe-url-Bs5i5FpE.js} +1 -1
  75. package/dist/assets/{get-safe-url-fVLOWjDv.js → get-safe-url-DfM7C7Hf.js} +1 -1
  76. package/dist/assets/getValidReactChildren-q1n8NmWG.js +1 -0
  77. package/dist/assets/{hint.es-xqBNEZOH.js → hint.es-DNy1bW-g.js} +1 -1
  78. package/dist/assets/{hint.es2-jX0Ikd_H.js → hint.es2-i7xguvxM.js} +1 -1
  79. package/dist/assets/{iframe-B52MZmUp.js → iframe-DWi9MO_j.js} +1 -1
  80. package/dist/assets/{index-yrfr0MWP.js → index-2OI_OVBD.js} +1 -1
  81. package/dist/assets/{index-DHqdVKlk.js → index-2rbYz989.js} +1 -1
  82. package/dist/assets/{index-CUdgGjYV.js → index-64gxJuGR.js} +1 -1
  83. package/dist/assets/{index-BFMlUu0x.js → index-9yi2bmN6.js} +1 -1
  84. package/dist/assets/{index-KdOmwCM0.js → index-AJgIDgSg.js} +51 -51
  85. package/dist/assets/index-B2GgL3-R.js +1 -0
  86. package/dist/assets/index-B2n80jby.js +1 -0
  87. package/dist/assets/{index-Bahrm-G8.js → index-BCr5STuV.js} +18 -18
  88. package/dist/assets/{index-B930dkB6.js → index-BFERjMXy.js} +1 -1
  89. package/dist/assets/{index-BEgDyH2G.js → index-BHiZELzY.js} +1 -1
  90. package/dist/assets/{index-Da_gY2p2.js → index-BLYEw0YZ.js} +1 -1
  91. package/dist/assets/{index-Btu7Neya.js → index-BLslsStt.js} +1 -1
  92. package/dist/assets/{index-BsoiXoFC.js → index-BMxCOuow.js} +1 -1
  93. package/dist/assets/{index-B8d6BDWi.js → index-BZL4w7FF.js} +1 -1
  94. package/dist/assets/{index-iW0yPyzE.js → index-BZOISQEj.js} +2 -2
  95. package/dist/assets/{index-n3NnSt8H.js → index-BdSP5x7V.js} +4 -4
  96. package/dist/assets/{index-Bpzwsd3f.js → index-BdlWUpNp.js} +6 -6
  97. package/dist/assets/{index-BcWvyuw8.js → index-BgnDgaOb.js} +1 -1
  98. package/dist/assets/{index-C8FhJ0rj.js → index-Bl_QpGg2.js} +1 -1
  99. package/dist/assets/{index-CiH2SOFi.js → index-BtW4iaLk.js} +3 -3
  100. package/dist/assets/{index-DPJjuq8y.js → index-C94nEH1q.js} +1 -1
  101. package/dist/assets/{index-CNElardu.js → index-CAL8SdA5.js} +1 -1
  102. package/dist/assets/{index-trVfBCte.js → index-CB14HOGE.js} +2 -2
  103. package/dist/assets/{index-BfvhxdN7.js → index-CEIvGGC0.js} +11 -11
  104. package/dist/assets/{index-Dzpr3qS7.js → index-CEvL1Y2e.js} +1 -1
  105. package/dist/assets/{index-BK_iEF6w.js → index-CUwFRYPb.js} +3 -3
  106. package/dist/assets/{index-DX8DEJlQ.js → index-CXdXz1YC.js} +1 -1
  107. package/dist/assets/{index-hmtP3oKe.js → index-CZQq2WZl.js} +1 -1
  108. package/dist/assets/{index-D6sUi9RT.js → index-CeEXyjqX.js} +1 -1
  109. package/dist/assets/{index-BerfqWKB.js → index-CotXQiFR.js} +1 -1
  110. package/dist/assets/{index-qxurOC9U.js → index-Cwlwz42P.js} +2 -2
  111. package/dist/assets/{index-DLm8Ub_j.js → index-Cy-HGAg5.js} +1 -1
  112. package/dist/assets/{index-BhA9P09u.js → index-D1Twij0A.js} +1 -1
  113. package/dist/assets/{index-DA7j-cev.js → index-D1Uv4Kgs.js} +1 -1
  114. package/dist/assets/{index-R7x7W7GB.js → index-D2LXsBcO.js} +5 -5
  115. package/dist/assets/{index-D6UMpm4p.js → index-D2TTRLM_.js} +1 -1
  116. package/dist/assets/{index-CZGd5QCZ.js → index-D69xZWqq.js} +8 -8
  117. package/dist/assets/{index-CFslc24J.js → index-DARRrmly.js} +2 -2
  118. package/dist/assets/{index-DydT7-LV.js → index-D_gKXPug.js} +1 -1
  119. package/dist/assets/{index-D_1_RyLT.js → index-DgyX9Ig4.js} +1 -1
  120. package/dist/assets/{index-D-wNDvqE.js → index-DiB0uZqA.js} +3 -3
  121. package/dist/assets/{index-DdLMocGE.js → index-DkSWwzPL.js} +1 -1
  122. package/dist/assets/{index-BNMAXWQI.js → index-Dtjsi5-M.js} +1 -1
  123. package/dist/assets/{index-DRmGM_hP.js → index-IJaA2JHH.js} +1 -1
  124. package/dist/assets/{index-CCAZAiY9.js → index-O5b_bdsU.js} +1 -1
  125. package/dist/assets/{index-Ce_kCGci.js → index-_Gn7XUOL.js} +1 -1
  126. package/dist/assets/{index-DATTQ5am.js → index-knEewVFB.js} +1 -1
  127. package/dist/assets/index-kof4JnLV.js +11 -0
  128. package/dist/assets/{index.esm-BZeAlIeN.js → index.esm-Bx7839pK.js} +1 -1
  129. package/dist/assets/{info-addon.es-C0ND8uqw.js → info-addon.es-B4Pyoy0-.js} +1 -1
  130. package/dist/assets/{info.es-B-kYc798.js → info.es-CtjlX5Wt.js} +1 -1
  131. package/dist/assets/{install-from-url-CV2FomzA.js → install-from-url-C2-00KT9.js} +1 -1
  132. package/dist/assets/{invitation-DH_bKwmI.js → invitation-D6T6DvBj.js} +6 -6
  133. package/dist/assets/is-path-prefix-equal-DPt6K58Y.js +1 -0
  134. package/dist/assets/{item-D5qxr3Lk.js → item-CeGXgGDh.js} +6 -6
  135. package/dist/assets/{javascript.es-CInOpinR.js → javascript.es-CBOLLNJA.js} +1 -1
  136. package/dist/assets/{jump-to-line.es-GaOpyMuN.js → jump-to-line.es-o70pn1AS.js} +1 -1
  137. package/dist/assets/{jump.es-4QMqZ0U2.js → jump.es-uAkOc1x-.js} +1 -1
  138. package/dist/assets/{lint.es-d-xQpru4.js → lint.es-Bq_aFvHE.js} +1 -1
  139. package/dist/assets/{lint.es2-r0w3QthM.js → lint.es2-QDUQ_yvH.js} +1 -1
  140. package/dist/assets/{lint.es3-Duz7LKWy.js → lint.es3-C8hQyDQ6.js} +1 -1
  141. package/dist/assets/{list-header-Dq6Hm5vy.js → list-header-CahJudHO.js} +1 -1
  142. package/dist/assets/{log-CTDXV8ap.js → log-B63Vehap.js} +1 -1
  143. package/dist/assets/{lottie-react.esm-Gf3LaMG1.js → lottie-react.esm-Dyp1pX0s.js} +1 -1
  144. package/dist/assets/{matchbrackets.es-ub9hnhHy.js → matchbrackets.es-DvsHeRkL.js} +1 -1
  145. package/dist/assets/{memory-Co7ZVOfU.js → memory-CB6HwuFd.js} +1 -1
  146. package/dist/assets/{mode.es-CK82ywlP.js → mode.es-BlitFOAg.js} +1 -1
  147. package/dist/assets/{mode.es2-gzITWIBC.js → mode.es2-D9kTW4A1.js} +1 -1
  148. package/dist/assets/{mode.es3-CrkiMbzK.js → mode.es3-C7GVv5Sh.js} +1 -1
  149. package/dist/assets/omit-lJaiB6eZ.js +1 -0
  150. package/dist/assets/{onlineParser.es-C1qjwyf6.js → onlineParser.es-B9GLO6bL.js} +1 -1
  151. package/dist/assets/{overview-WpAQD63O.js → overview-DMesSg9s.js} +2 -2
  152. package/dist/assets/payment-kit-DYSjmihw.png +0 -0
  153. package/dist/assets/{permission-DR4c0ARF.js → permission-bQJb4Wfm.js} +1 -1
  154. package/dist/assets/{preference-BJr6poQJ.js → preference-CQ9_K03t.js} +3 -3
  155. package/dist/assets/{raf-schd.esm-CKlBxZ4m.js → raf-schd.esm-xwaPYuT8.js} +1 -1
  156. package/dist/assets/refType-Dp49VYzY.js +1 -0
  157. package/dist/assets/{resource-dialog-CnEGcfR6.js → resource-dialog-CrF5TTZz.js} +30 -30
  158. package/dist/assets/{runtime-DiZdSvdg.js → runtime-ccgDKRXv.js} +1 -1
  159. package/dist/assets/{schema-CV3xzp1r.js → schema-BAt_zCax.js} +6 -6
  160. package/dist/assets/sdk-BmRwENgz.js +1 -0
  161. package/dist/assets/{search.es-DKqLEqET.js → search.es-BewIGLjB.js} +1 -1
  162. package/dist/assets/{searchcursor.es-BWMpJtYl.js → searchcursor.es-BWP24T39.js} +1 -1
  163. package/dist/assets/{service-B4aFqW1U.js → service-C6dR44t5.js} +1 -1
  164. package/dist/assets/{shorten-label-B1taCLSu.js → shorten-label-C5x3QBkr.js} +1 -1
  165. package/dist/assets/{show-hint.es-C1eZks_O.js → show-hint.es-DR7gTDpy.js} +1 -1
  166. package/dist/assets/{simple-select-BwOhhEqT.js → simple-select-Dk5PYcqy.js} +1 -1
  167. package/dist/assets/{spaces-BHOuJMC0.js → spaces-Qg7EXTlR.js} +1 -1
  168. package/dist/assets/{status-BVDByjVR.js → status-C6NwHG6t.js} +1 -1
  169. package/dist/assets/{status-CLTF7DgB.js → status-Dk-wVme-.js} +1 -1
  170. package/dist/assets/{sublime.es-J7__ylqM.js → sublime.es-Bpk1OuZ2.js} +1 -1
  171. package/dist/assets/{switch-control-k82I7Ndl.js → switch-control-BzAUWBUn.js} +1 -1
  172. package/dist/assets/{table-icons-C8h2igEk.js → table-icons-D5Z-kbr9.js} +36 -36
  173. package/dist/assets/{team-DTa9igye.js → team-CKxs_BXU.js} +1 -1
  174. package/dist/assets/{toLower-CV1JKc77.js → toLower-DoLsoIUi.js} +1 -1
  175. package/dist/assets/toUpper-Bsu2hQC1.js +1 -0
  176. package/dist/assets/{traffic-BZMRS6o_.js → traffic-CmwKqX64.js} +2 -2
  177. package/dist/assets/{url-evaluation-BMmqZ9Xm.js → url-evaluation-CyY2eIYi.js} +1 -1
  178. package/dist/assets/{url-join-3G2iekWy.js → url-join-D3UI4kOJ.js} +1 -1
  179. package/dist/assets/{use-mobile-C-Ki3d1-.js → use-mobile-BO6wzlhh.js} +1 -1
  180. package/dist/assets/{use-mobile-4pPVTaiA.js → use-mobile-DzTdFIlX.js} +1 -1
  181. package/dist/assets/{useAsync-W0rAsXlK.js → useAsync-Ch7FfDvD.js} +1 -1
  182. package/dist/assets/{useLocalStorage-DqX-zdwD.js → useLocalStorage-DErQTCC8.js} +1 -1
  183. package/dist/assets/{useThemeProps-BT_RONtx.js → useThemeProps-DI7JqlIy.js} +1 -1
  184. package/dist/assets/{util-CR3vtO32.js → util-CiEXZkzA.js} +1 -1
  185. package/dist/assets/{wait-container-D3DtxHI5.js → wait-container-DFgs_ycx.js} +1 -1
  186. package/dist/assets/{withStyles-DQtqSL4M.js → withStyles-D9pc_Gr2.js} +1 -1
  187. package/dist/assets/wrap-locale-Cw7rRT3-.js +1 -0
  188. package/dist/index.html +1 -1
  189. package/dist/service-worker.js +1 -1
  190. package/package.json +1 -1
  191. package/dist/assets/api-BhAwS4V8.js +0 -1
  192. package/dist/assets/click-to-copy-mgHOJgOu.js +0 -1
  193. package/dist/assets/cloneDeep-C8Xz4lYT.js +0 -1
  194. package/dist/assets/domains-BnwU8REn.js +0 -24
  195. package/dist/assets/emotion-react.browser.esm-DwA9twTe.js +0 -1
  196. package/dist/assets/getValidReactChildren-BybUhg_p.js +0 -1
  197. package/dist/assets/index-B3-cD9IV.js +0 -1
  198. package/dist/assets/index-DNHgOX2L.js +0 -1
  199. package/dist/assets/index-DjPLbVUc.js +0 -11
  200. package/dist/assets/is-path-prefix-equal-Cl2q8kGU.js +0 -1
  201. package/dist/assets/omit-BE_Bff1I.js +0 -1
  202. package/dist/assets/refType-BFp6Mdcn.js +0 -1
  203. package/dist/assets/toUpper-CIse071F.js +0 -1
  204. package/dist/assets/wrap-locale-DB1j-LK3.js +0 -1
@@ -1,4 +1,4 @@
1
- import{D as fe,g as ge}from"./index-BhA9P09u.js";import{bZ as q,j as e,P as o,m as L,r as C,bs as _,fX as je,l6 as ye,hb as we,N as f,v as le,k as S,C as H,Y as X,hc as ve,ek as N,aZ as ae,X as V,aC as $,aW as Z,aa as G,bh as ee,ab as Q,cC as ke,ee as O,a6 as te,id as Ee,ba as Ce,bb as Te,bm as Se,z as W,bi as Re,O as ce,a_ as z,bj as Me,G as K,aJ as Ie,ac as ze,fK as Pe,a4 as De,aI as $e,la as Oe,fR as We,bu as pe,b_ as ue,F as Ae,lb as qe,ag as Le}from"./index-KdOmwCM0.js";import{d as Be}from"./Add-B5o3lKZ4.js";import{u as U}from"./team-DTa9igye.js";import{u as He,C as Y}from"./index.esm-BZeAlIeN.js";import{u as he}from"./blocklet-DgGtZNCB.js";import{C as J}from"./index-BsoiXoFC.js";import{u as Ne}from"./index-C8FhJ0rj.js";import{L as Fe}from"./ListSubheader-r9QVg4z3.js";import{C as _e}from"./Close-w8eKEJW7.js";import{E as Ue}from"./index-D6UMpm4p.js";import{A as Ve}from"./actions-C1blhdkh.js";import{D as Ke}from"./Delete-DSB9GjVg.js";import"./TableRow-BMSWmGPk.js";import"./useThemeProps-BT_RONtx.js";import"./emotion-react.browser.esm-DwA9twTe.js";import"./ViewColumn-BIPD356c.js";import"./Search-DnEqCvoa.js";import"./Clear-C7odY-6_.js";import"./Delete-DpNbJCJA.js";import"./MoreVert-UFPlWjze.js";import"./TableSearch-Dobasaj8.js";import"./url-evaluation-BMmqZ9Xm.js";import"./MoreHoriz-DuOMe2bn.js";const Ye=q(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 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m4.59-12.42L10 14.17l-2.59-2.58L6 13l4 4 8-8z"}),"CheckCircleOutlined"),Je=q(e.jsx("path",{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z"}),"Edit"),Ge=q(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 2m1 15h-2v-2h2zm0-4h-2V7h2z"}),"ErrorOutlined"),Qe=q(e.jsx("path",{d:"M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8"}),"InfoOutlined"),Xe=q(e.jsx("path",{d:"M6 19h4V5H6zm8-14v14h4V5z"}),"Pause"),Ze=q(e.jsx("path",{d:"M8 5v14l11-7z"}),"PlayArrow"),et=t=>{var g,y;const[d,c]=C.useState(null),[a,b]=C.useState(!t),[R,p]=C.useState(null),{blocklet:s}=he(),l=(y=(g=s==null?void 0:s.site)==null?void 0:g.domainAliases[0])==null?void 0:y.value,k=C.useMemo(()=>{const h={};return d&&(d.sources.forEach(r=>{h[r.did]={source:r,events:[],count:0}}),d.events.forEach(r=>{h[r.source]&&(h[r.source].events.push(r),h[r.source].count+=1)})),h},[d]),T=async()=>{try{if(b(!0),!l)return;const r=await(await fetch(`https://${l}/.well-known/service/openevent.json`)).json();c(r),p(null)}catch(h){p(h instanceof Error?h:new Error(String(h)))}finally{b(!1)}};return C.useEffect(()=>{T()},[l]),{openEvent:d,setOpenEvent:c,eventsBySource:k,loading:a,error:R,loadData:T}};function oe({eventsBySource:t,selectedEvents:d,setSelectedEvents:c,error:a}){const{t:b}=L(),[R,p]=C.useState({}),s=C.useMemo(()=>{const r={};return Object.entries(t).forEach(([w,{events:j}])=>{const E=j.filter(u=>d[`${u.type}-${u.source}`]).length;r[w]=E}),r},[t,d]),l=C.useMemo(()=>Object.values(s).reduce((r,w)=>r+w,0),[s]),k=C.useMemo(()=>Object.values(t).reduce((r,{events:w})=>r+w.length,0),[t]),T=(r,w)=>{w.stopPropagation(),p({...R,[r]:!R[r]})},g=r=>{const w=`${r.type}-${r.source}`;c(j=>({...j,[w]:!j[w]}))},y=(r,w)=>{const j={};r.forEach(E=>{const u=`${E.type}-${E.source}`;j[u]=!w}),c(E=>({...E,...j}))},h=r=>{const w={};Object.values(t).forEach(({events:j})=>{j.forEach(E=>{const u=`${E.type}-${E.source}`;w[u]=r.target.checked})}),c(w)};return e.jsxs(f,{sx:{width:"100%"},children:[e.jsxs(f,{sx:{display:"flex",alignItems:"center",mb:1,mt:1},children:[e.jsx(ae,{control:e.jsx(V,{onChange:h,checked:l>0&&l===k}),label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",cursor:"pointer"},children:[b("webhookEndpoint.selectAllEvents"),e.jsx(f,{sx:{display:"flex",alignItems:"center"},children:e.jsx($,{title:b("webhookEndpoint.selectAllEventsTooltip"),placement:"right",children:e.jsx(Z,{fontSize:"small",sx:{ml:.5,cursor:"help"}})})})]}),sx:{m:0}}),l>0&&e.jsx(S,{variant:"body2",color:"primary",sx:{ml:"auto"},children:b("webhookEndpoint.selectedEventsCount",{count:l})})]}),e.jsx(f,{sx:{maxHeight:"50vh",overflow:"auto"},children:e.jsx(G,{disablePadding:!0,sx:{border:"1px solid",borderColor:"divider",borderRadius:"4px"},children:Object.entries(t).map(([r,{source:w,events:j,count:E}],u)=>{const I=s[r]>0,i=s[r]===j.length&&j.length>0,x=R[r];return e.jsxs(ee.Fragment,{children:[e.jsx(Q,{sx:{borderBottom:({palette:n})=>u<Object.keys(t).length-1?`1px solid ${n.divider}`:"none",px:2,py:1.5,"&:hover":{bgcolor:"rgba(0, 0, 0, 0.02)"}},children:e.jsxs(f,{sx:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center"},onClick:n=>{n.target.closest(".MuiFormControlLabel-root")||T(r,n)},children:[e.jsx(f,{sx:{display:"flex",alignItems:"center"},children:j.length>0&&e.jsx(ae,{control:e.jsx(V,{checked:i,indeterminate:I&&!i,onChange:n=>{n.stopPropagation(),y(j,i)}}),label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[w.logo&&e.jsx(ke,{src:w.logo,sx:{width:24,height:24}}),e.jsx(f,{children:w.title||r}),I&&e.jsx(O,{label:b("webhookEndpoint.selectedCount",{count:s[r]}),size:"small",sx:{mt:"2px",height:"20px",fontSize:"12px",bgcolor:n=>`${n.palette.primary.main}20`,color:"primary.main",fontWeight:500}})]}),sx:{m:0,"& .MuiFormControlLabel-label":{flex:1}}})}),e.jsxs(f,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(S,{variant:"body2",color:"text.secondary",sx:{mr:1},children:b("webhookEndpoint.eventsCount",{count:E})}),j.length>0&&e.jsx(te,{size:"small",edge:"end",children:x?e.jsx(Ee,{}):e.jsx(Ce,{})})]})]})}),j.length>0&&e.jsx(Te,{in:x,timeout:"auto",unmountOnExit:!0,children:e.jsx(G,{disablePadding:!0,sx:{pl:2,pr:2,py:1,bgcolor:"rgba(0, 0, 0, 0.01)"},children:j.map(n=>{const m=`${n.type}-${n.source}`,v=!!d[m];return e.jsx(Q,{dense:!0,sx:{py:.75},onClick:()=>g(n),children:e.jsxs(f,{sx:{display:"flex",alignItems:"flex-start",width:"100%"},children:[e.jsx(V,{checked:v,sx:{mr:1}}),e.jsxs(f,{children:[e.jsx(S,{variant:"body1",sx:{cursor:"pointer"},children:n.type}),e.jsx(S,{variant:"caption",color:"text.disabled",sx:{display:"block",cursor:"pointer"},children:n.description})]})]})},m)})})})]},r)})})}),a&&e.jsx(Se,{error:!0,sx:{mt:1},children:a})]})}oe.propTypes={eventsBySource:o.objectOf(o.shape({source:o.shape({did:o.string.isRequired,title:o.string,description:o.string,version:o.string,logo:o.string}).isRequired,events:o.arrayOf(o.shape({type:o.string.isRequired,description:o.string.isRequired,source:o.string.isRequired})).isRequired,count:o.number.isRequired})).isRequired,selectedEvents:o.objectOf(o.bool).isRequired,setSelectedEvents:o.func.isRequired,error:o.string};oe.defaultProps={error:null};function ne({id:t,url:d,description:c,enabledEvents:a,onSubmit:b,onClose:R}){var n;const{t:p}=L(),[s,l]=C.useState({}),{teamDid:k}=U(),{api:T}=_(),{loading:g,error:y,eventsBySource:h}=et(),{control:r,handleSubmit:w,formState:{errors:j},reset:E,setValue:u,trigger:I}=He({defaultValues:{url:"",description:""}});C.useEffect(()=>{const m=Object.values(s).some(v=>v);u("selectedEvents",m?"valid":""),I("selectedEvents")},[s,u,I]);const i=()=>{l({}),E(),R()},x=async m=>{const v=Object.keys(s).filter(M=>s[M]),P={url:m.url,description:m.description,enabledEvents:v.map(M=>{const[A,B]=M.split("-");return!A||!B?null:{type:A,source:B}}).filter(Boolean)};try{if(t){const M=await T.updateWebhookEndpoint({input:{teamDid:k,id:t,data:P}});W.success(`${p("webhookEndpoint.updateWebhook")} ${p("webhookEndpoint.success")}`),b(M)}else{const M=await T.createWebhookEndpoint({input:{teamDid:k,input:P}});W.success(`${p("webhookEndpoint.createWebhook")} ${p("webhookEndpoint.success")}`),b(M)}}catch(M){W.error(M==null?void 0:M.message)}i()};return C.useEffect(()=>{E({url:d,description:c}),l(a.reduce((m,v)=>(m[`${v.type}-${v.source}`]=!0,m),{}))},[E,l,d,c,a]),e.jsx(je,{open:!0,onClose:i,maxWidth:"lg",fullWidth:!0,sx:{"& .MuiDialog-paper":{minHeight:600}},children:e.jsxs("form",{onSubmit:w(x),children:[e.jsx(ye,{children:p(t?"webhookEndpoint.editWebhookTitle":"webhookEndpoint.createWebhookTitle")}),e.jsx(we,{children:e.jsxs(f,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[e.jsx(Y,{name:"url",control:r,rules:{required:p("webhookEndpoint.validation.urlRequired"),pattern:{value:/^(http|https):\/\/[^ "]+$/,message:p("webhookEndpoint.validation.urlInvalid")}},render:({field:m})=>{var v;return e.jsx(le,{...m,label:p("webhookEndpoint.url.label"),fullWidth:!0,error:!!j.url,helperText:(v=j.url)==null?void 0:v.message})}}),e.jsx(Y,{name:"description",control:r,rules:{required:p("webhookEndpoint.validation.descriptionRequired")},render:({field:m})=>{var v;return e.jsx(le,{...m,label:p("webhookEndpoint.description.label"),fullWidth:!0,multiline:!0,minRows:2,maxRows:4,error:!!j.description,helperText:(v=j.description)==null?void 0:v.message})}}),e.jsx(Y,{name:"selectedEvents",control:r,rules:{required:p("webhookEndpoint.validation.eventRequired")},render:({field:m})=>e.jsx("input",{type:"hidden",...m})}),!g&&h&&Object.keys(h).length>0&&e.jsx(oe,{eventsBySource:h,selectedEvents:s,setSelectedEvents:l,error:(n=j.selectedEvents)==null?void 0:n.message}),!g&&(!h||Object.keys(h).length===0)&&e.jsx(S,{color:"text.secondary",children:p("webhookEndpoint.noAvailableEvents")}),g&&e.jsx(f,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"500px",width:"100%"},children:e.jsx(H,{size:20})}),y&&e.jsx(X,{severity:"error",children:p("webhookEndpoint.loadingError",{message:y==null?void 0:y.message})})]})}),e.jsxs(ve,{sx:{p:"8px 24px 24px"},children:[e.jsx(N,{onClick:i,children:p("common.cancel")}),e.jsx(N,{type:"submit",variant:"contained",color:"primary",children:p(t?"webhookEndpoint.updateWebhook":"webhookEndpoint.saveWebhook")})]})]})})}ne.propTypes={onSubmit:o.func.isRequired,id:o.string,url:o.string,description:o.string,enabledEvents:o.arrayOf(o.shape({type:o.string.isRequired,source:o.string.isRequired})),onClose:o.func};ne.defaultProps={id:null,url:"",description:"",enabledEvents:[],onClose:()=>{}};function xe(t){switch(t){case"enabled":return"success";case"disabled":default:return"default"}}const tt=(t="en")=>t==="tw"?"zh":t;function F(t,d="YYYY-MM-DD HH:mm:ss",c="en"){return t?Re(t).locale(tt(c)).format(d):"-"}function ot(t){return typeof t=="number"?!1:ce(t)}function nt(t){return t>=200&&t<300}function D(t){const d=ot(t.value);return e.jsxs(e.Fragment,{children:[e.jsxs(z,{direction:"column",alignItems:"flex-start",children:[e.jsxs(S,{component:"div",variant:"body1",mb:1,color:"text.primary",sx:{fontWeight:500},children:[t.label,!!t.tip&&e.jsx($,{title:t.tip,children:e.jsx(Qe,{fontSize:"small"})})]}),e.jsx(S,{component:"div",variant:"body1",color:d?"text.disabled":"text.secondary",sx:{width:"100%",minHeight:"24px"},children:d?"-":t.value})]}),t.divider&&e.jsx(Me,{orientation:"vertical",flexItem:!0})]})}D.propTypes={label:o.oneOfType([o.string,o.node]).isRequired,value:o.oneOfType([o.string,o.node]).isRequired,tip:o.oneOfType([o.string,o.node]),divider:o.bool};D.defaultProps={tip:"",divider:!1};function se(t){return e.jsxs(z,{className:"section-header",direction:"row",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:1,sx:{mb:t.mb,mt:t.mt,pb:1},children:[e.jsx(S,{variant:"h3",sx:{fontSize:{xs:"18px",md:"1.09375rem"}},component:"div",children:t.title}),t.children]})}se.propTypes={title:o.oneOfType([o.string,o.node]).isRequired,children:o.node,mb:o.number,mt:o.number};se.defaultProps={children:null,mb:1.5,mt:1.5};const st=t=>{const d={};return t.forEach(c=>{var b;const a=new Date(c.createdAt).toLocaleDateString();d[a]||(d[a]=[]),(b=d[a])==null||b.push(c)}),d};function re({eventId:t,webhookEndpointId:d,event:c}){const{api:a}=_(),{t:b}=L(),{teamDid:R}=U(),{blocklet:p}=he(),{data:s,loadMore:l,loadingMore:k,loading:T}=Ne(u=>{const i=u?Math.ceil(u.list.length/15)+1:1;return a.getWebhookAttempts({input:{teamDid:R,input:{eventId:t,webhookId:d},paging:{page:i,pageSize:15}}})},{reloadDeps:[t,d]}),g=(s==null?void 0:s.list)||[],[y,h]=C.useState(null),r=st(g);C.useEffect(()=>{!y&&(s!=null&&s.list.length)&&h(s.list[0])},[s==null?void 0:s.list.length,y]);const w=u=>{h(u)};if(T)return e.jsx(H,{});const j=s&&s.list.length<s.paging.total,E=u=>{var I,i,x,n,m;if(u.responseBody&&((I=u.responseBody)!=null&&I.sessionId)&&((i=u.responseBody)!=null&&i.projectId)&&((x=u.responseBody)!=null&&x.agentId)){const v=(m=(n=p==null?void 0:p.site)==null?void 0:n.domainAliases[0])==null?void 0:m.value,P=(p.children||[]).find(A=>{var B;return((B=A==null?void 0:A.meta)==null?void 0:B.name)==="ai-studio"}),M=Pe(De(`https://${v}`,(P==null?void 0:P.mountPoint)||"","projects",u.responseBody.projectId,"logs/main"),{sessionId:u.responseBody.sessionId,agentId:u.responseBody.agentId});return e.jsx(te,{sx:{fontSize:20},onClick:()=>window.open(M,"_blank"),children:e.jsx(f,{component:$e,icon:Oe})})}return null};return e.jsxs(K,{container:!0,spacing:{xs:0,md:1},sx:{height:1},children:[e.jsx(K,{item:!0,xs:12,md:4,height:1,children:ce(Object.keys(r))?e.jsx(S,{color:"text.secondary",children:b("webhookEndpoint.waitingForEvents")}):e.jsxs(e.Fragment,{children:[e.jsx(G,{sx:{maxHeight:"calc(100% - 40px)",py:0,overflowY:"auto"},children:Object.entries(r).map(([u,I])=>e.jsxs(ee.Fragment,{children:[e.jsx(Fe,{children:u}),I.map(i=>e.jsxs(Q,{sx:{cursor:"pointer"},onClick:()=>w(i),selected:y===i,secondaryAction:e.jsx(S,{color:"text.secondary",children:F(i.createdAt,"HH:mm:ss")}),children:[e.jsx(Ie,{sx:{minWidth:0,mr:1.5},children:nt(i.responseStatus)===!1?e.jsx(Ge,{color:"error"}):e.jsx(Ye,{color:"success"})}),e.jsx(ze,{primary:e.jsx(S,{color:"text.primary",children:i.event.type})})]},i.id))]},u))}),j&&e.jsx(f,{display:"flex",justifyContent:"center",alignItems:"center",width:1,children:e.jsx(N,{variant:"text",type:"button",color:"inherit",onClick:l,disabled:k,sx:{color:u=>u.palette.text.disabled},children:b(k?"webhookEndpoint.loadingMore":"webhookEndpoint.loadMore")})})]})}),e.jsxs(K,{item:!0,xs:12,md:8,height:1,children:[y&&e.jsxs(z,{height:1,overflow:"auto",direction:"column",spacing:2,sx:{pl:{xs:0,md:1},mt:{xs:2,md:0},borderLeft:{xs:"none"}},children:[e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(S,{variant:"h6",children:t?y.endpoint.url:y.event.type}),e.jsx(f,{children:E(y)})]}),e.jsxs(f,{children:[e.jsxs(S,{variant:"h6",children:[b("webhookEndpoint.response")," (",y.responseStatus,")"]}),e.jsx(J,{language:"json",children:JSON.stringify(y.responseBody,null,2)})]}),e.jsxs(f,{children:[e.jsx(z,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(S,{variant:"h6",children:b("webhookEndpoint.request")})}),e.jsx(J,{language:"json",sx:{margin:0},children:JSON.stringify(y.event,null,2)})]})]}),(s==null?void 0:s.list.length)===0&&c&&e.jsxs(f,{children:[e.jsx(z,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(S,{variant:"h6",children:b("webhookEndpoint.eventData")})}),e.jsx(J,{language:"json",sx:{margin:0},children:JSON.stringify(c.data,null,2)})]})]})]})}re.propTypes={eventId:o.string,webhookEndpointId:o.string,event:o.shape({type:o.string,data:o.object,request:o.object,requestInfo:o.object})};re.defaultProps={eventId:"",webhookEndpointId:"",event:null};function me({id:t,onClose:d}){var k,T,g,y;const{t:c}=L(),{api:a}=_(),{teamDid:b}=U(),{loading:R,error:p,data:s}=pe(()=>a.getWebhookEndpoint({input:{teamDid:b,id:t}})),l=s==null?void 0:s.data;return p?e.jsx(X,{severity:"error",children:p.message}):R||!l?e.jsx(f,{display:"flex",justifyContent:"center",alignItems:"center",height:1,width:1,children:e.jsx(H,{})}):e.jsxs(rt,{direction:"column",sx:{height:{xs:"auto",md:1}},children:[e.jsxs(f,{children:[e.jsxs(z,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e.jsx(z,{flex:1,width:0,children:e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(S,{variant:"h5",fontWeight:600,sx:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},children:l.description}),e.jsx($,{title:l.url,children:e.jsx(Z,{sx:{fontSize:"16px",marginTop:"2px"}})})]})}),e.jsx(z,{direction:"row",alignItems:"center",children:e.jsx(te,{edge:"end",color:"inherit",onClick:d,children:e.jsx(_e,{})})})]}),e.jsx(f,{mt:2,children:e.jsxs(z,{className:"section-body",direction:{xs:"column",md:"row"},spacing:{xs:1,md:3},justifyContent:"flex-start",flexWrap:"wrap",sx:{pt:2,mt:2,borderTop:"1px solid #eee"},children:[e.jsx(D,{label:c("common.status"),value:e.jsx(O,{size:"small",variant:"filled",label:l.status,color:xe(l.status),sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}}),divider:!0}),e.jsx(D,{label:c("webhookEndpoint.listen"),value:e.jsx($,{arrow:!0,title:e.jsx("ul",{style:{padding:0,margin:0},children:l.enabledEvents.map(h=>e.jsx("li",{style:{fontSize:"0.7875rem"},children:h==null?void 0:h.type},h))}),children:e.jsx(O,{size:"small",variant:"filled",label:c("webhookEndpoint.eventsCount",{count:l.enabledEvents.length}),sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})}),divider:!0}),e.jsx(D,{label:c("webhookEndpoint.version"),value:l.apiVersion,divider:!0}),e.jsx(D,{label:c("common.createdAt"),value:F(l.createdAt),divider:!0}),e.jsx(D,{label:c("common.updatedAt"),value:F(l.updatedAt),divider:!0}),e.jsx(D,{label:c("common.createdBy"),value:e.jsx($,{arrow:!0,title:(k=l.createUser)==null?void 0:k.did,children:e.jsx(O,{size:"small",variant:"filled",label:(T=l.createUser)==null?void 0:T.fullName,sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})}),divider:!0}),e.jsx(D,{label:c("common.updatedBy"),value:e.jsx($,{arrow:!0,title:(g=l.updateUser)==null?void 0:g.did,children:e.jsx(O,{size:"small",variant:"filled",label:(y=l.updateUser)==null?void 0:y.fullName,sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})})})]})})]}),e.jsxs(z,{className:"section",flex:1,height:0,overflow:"hidden",children:[e.jsx(se,{title:c("webhookEndpoint.attempts"),mb:0,mt:4}),e.jsx(z,{height:0,flex:1,overflow:"hidden",children:e.jsx(re,{webhookEndpointId:l.id})})]})]})}me.propTypes={id:o.string.isRequired,onClose:o.func.isRequired};const rt=ue(z)``;function be({open:t,onClose:d,id:c}){return e.jsx(We,{anchor:"right",open:t,onClose:d,PaperProps:{sx:{width:"90vw",maxWidth:"1200px"}},children:e.jsx(f,{sx:{height:"100vh",p:3},children:e.jsx(me,{id:c,onClose:d})})})}be.propTypes={open:o.bool.isRequired,onClose:o.func.isRequired,id:o.string.isRequired};function de(){return null}const ie=ee.memo(({options:t,columns:d,toolbar:c=!0,footer:a=!0,hasRowLink:b=!1,emptyNodeText:R="",...p})=>{const{locale:s}=L(),l=Ae(g=>g.breakpoints.down("md")),k={print:!1,download:!1,filter:!1,selectableRows:"none",rowsPerPage:l?5:10,rowsPerPageOptions:[5,10,20,50,100],searchDebounceTime:300,tableBodyHeight:"100%",loading:!0},T={};return c||(T.TableToolbar=de),a||(T.TableFooter=de),e.jsx(it,{locale:s,options:{...k,...t},columns:(d||[]).map(g=>(g.options=g.options||{},g.options.filter=g.options.filter||!1,g.options.sort=g.options.sort||!1,g)),emptyNode:e.jsx(Ue,{children:R}),...p,components:T,hasRowLink:b,isMobile:l})});ie.propTypes={options:o.object,columns:o.array,toolbar:o.bool,footer:o.bool,hasRowLink:o.bool,emptyNodeText:o.node,durable:o.string,durableKeys:o.array,data:o.array,loading:o.bool,onChange:o.func,title:o.node,components:o.object};ie.defaultProps={options:{},columns:[],toolbar:!0,footer:!0,hasRowLink:!1,emptyNodeText:null,durable:"",durableKeys:[],data:[],loading:!1,onChange:()=>{},title:null,components:{}};const it=ue(fe)`
1
+ import{D as fe,g as ge}from"./index-D1Twij0A.js";import{bZ as q,j as e,P as o,m as L,r as C,bs as _,fW as je,l7 as ye,hb as we,N as f,v as le,k as S,C as H,Y as Z,hc as ve,ej as N,aZ as ae,X as V,aC as W,aW as X,aa as Q,bh as ee,ab as G,cC as ke,ed as $,a6 as te,ie as Ee,ba as Ce,bb as Te,bm as Se,z as O,bi as Re,O as ce,a_ as z,bj as Me,G as Y,aJ as Ie,ac as ze,fJ as Pe,a4 as De,aI as We,lb as $e,fQ as Oe,bu as pe,b_ as ue,F as Ae,lc as qe,ag as Le}from"./index-AJgIDgSg.js";import{d as Be}from"./Add-DyqE7ma4.js";import{u as U}from"./team-CKxs_BXU.js";import{u as He,C as J}from"./index.esm-Bx7839pK.js";import{u as he}from"./blocklet-n2QLVVft.js";import{C as K}from"./index-BMxCOuow.js";import{u as Ne}from"./index-Bl_QpGg2.js";import{L as Fe}from"./ListSubheader-C2HVg1lq.js";import{C as _e}from"./Close-CMKp87zW.js";import{E as Ue}from"./index-D2TTRLM_.js";import{A as Ve}from"./actions-Bv3_VVES.js";import{D as Ye}from"./Delete-DemQysCs.js";import"./TableRow-Cr41eTmp.js";import"./useThemeProps-DI7JqlIy.js";import"./emotion-react.browser.esm-Dyrm_eeQ.js";import"./ViewColumn-CQJvMaMH.js";import"./Search-CzTpAOa9.js";import"./Clear-C23RMA8O.js";import"./Delete-X-iZLu8W.js";import"./MoreVert-T7jlVzCd.js";import"./TableSearch-DBDA-JAl.js";import"./url-evaluation-CyY2eIYi.js";import"./MoreHoriz-_l-lUoyq.js";const Je=q(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 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m4.59-12.42L10 14.17l-2.59-2.58L6 13l4 4 8-8z"}),"CheckCircleOutlined"),Ke=q(e.jsx("path",{d:"M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z"}),"Edit"),Qe=q(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 2m1 15h-2v-2h2zm0-4h-2V7h2z"}),"ErrorOutlined"),Ge=q(e.jsx("path",{d:"M11 7h2v2h-2zm0 4h2v6h-2zm1-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8"}),"InfoOutlined"),Ze=q(e.jsx("path",{d:"M6 19h4V5H6zm8-14v14h4V5z"}),"Pause"),Xe=q(e.jsx("path",{d:"M8 5v14l11-7z"}),"PlayArrow"),et=t=>{var g,y;const[d,c]=C.useState(null),[a,b]=C.useState(!t),[R,p]=C.useState(null),{blocklet:s}=he(),l=(y=(g=s==null?void 0:s.site)==null?void 0:g.domainAliases[0])==null?void 0:y.value,k=C.useMemo(()=>{const h={};return d&&(d.sources.forEach(r=>{h[r.did]={source:r,events:[],count:0}}),d.events.forEach(r=>{h[r.source]&&(h[r.source].events.push(r),h[r.source].count+=1)})),h},[d]),T=async()=>{try{if(b(!0),!l)return;const r=await(await fetch(`https://${l}/.well-known/service/openevent.json`)).json();c(r),p(null)}catch(h){p(h instanceof Error?h:new Error(String(h)))}finally{b(!1)}};return C.useEffect(()=>{T()},[l]),{openEvent:d,setOpenEvent:c,eventsBySource:k,loading:a,error:R,loadData:T}};function oe({eventsBySource:t,selectedEvents:d,setSelectedEvents:c,error:a}){const{t:b}=L(),[R,p]=C.useState({}),s=C.useMemo(()=>{const r={};return Object.entries(t).forEach(([w,{events:j}])=>{const E=j.filter(u=>d[`${u.type}-${u.source}`]).length;r[w]=E}),r},[t,d]),l=C.useMemo(()=>Object.values(s).reduce((r,w)=>r+w,0),[s]),k=C.useMemo(()=>Object.values(t).reduce((r,{events:w})=>r+w.length,0),[t]),T=(r,w)=>{w.stopPropagation(),p({...R,[r]:!R[r]})},g=r=>{const w=`${r.type}-${r.source}`;c(j=>({...j,[w]:!j[w]}))},y=(r,w)=>{const j={};r.forEach(E=>{const u=`${E.type}-${E.source}`;j[u]=!w}),c(E=>({...E,...j}))},h=r=>{const w={};Object.values(t).forEach(({events:j})=>{j.forEach(E=>{const u=`${E.type}-${E.source}`;w[u]=r.target.checked})}),c(w)};return e.jsxs(f,{sx:{width:"100%"},children:[e.jsxs(f,{sx:{display:"flex",alignItems:"center",mb:1,mt:1},children:[e.jsx(ae,{control:e.jsx(V,{onChange:h,checked:l>0&&l===k}),label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",cursor:"pointer"},children:[b("webhookEndpoint.selectAllEvents"),e.jsx(f,{sx:{display:"flex",alignItems:"center"},children:e.jsx(W,{title:b("webhookEndpoint.selectAllEventsTooltip"),placement:"right",children:e.jsx(X,{fontSize:"small",sx:{ml:.5,cursor:"help"}})})})]}),sx:{m:0}}),l>0&&e.jsx(S,{variant:"body2",color:"primary",sx:{ml:"auto"},children:b("webhookEndpoint.selectedEventsCount",{count:l})})]}),e.jsx(f,{sx:{maxHeight:"50vh",overflow:"auto"},children:e.jsx(Q,{disablePadding:!0,sx:{border:"1px solid",borderColor:"divider",borderRadius:"4px"},children:Object.entries(t).map(([r,{source:w,events:j,count:E}],u)=>{const I=s[r]>0,i=s[r]===j.length&&j.length>0,x=R[r];return e.jsxs(ee.Fragment,{children:[e.jsx(G,{sx:{borderBottom:({palette:n})=>u<Object.keys(t).length-1?`1px solid ${n.divider}`:"none",px:2,py:1.5,"&:hover":{bgcolor:"rgba(0, 0, 0, 0.02)"}},children:e.jsxs(f,{sx:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center"},onClick:n=>{n.target.closest(".MuiFormControlLabel-root")||T(r,n)},children:[e.jsx(f,{sx:{display:"flex",alignItems:"center"},children:j.length>0&&e.jsx(ae,{control:e.jsx(V,{checked:i,indeterminate:I&&!i,onChange:n=>{n.stopPropagation(),y(j,i)}}),label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[w.logo&&e.jsx(ke,{src:w.logo,sx:{width:24,height:24}}),e.jsx(f,{children:w.title||r}),I&&e.jsx($,{label:b("webhookEndpoint.selectedCount",{count:s[r]}),size:"small",sx:{mt:"2px",height:"20px",fontSize:"12px",bgcolor:n=>`${n.palette.primary.main}20`,color:"primary.main",fontWeight:500}})]}),sx:{m:0,"& .MuiFormControlLabel-label":{flex:1}}})}),e.jsxs(f,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(S,{variant:"body2",color:"text.secondary",sx:{mr:1},children:b("webhookEndpoint.eventsCount",{count:E})}),j.length>0&&e.jsx(te,{size:"small",edge:"end",children:x?e.jsx(Ee,{}):e.jsx(Ce,{})})]})]})}),j.length>0&&e.jsx(Te,{in:x,timeout:"auto",unmountOnExit:!0,children:e.jsx(Q,{disablePadding:!0,sx:{pl:2,pr:2,py:1,bgcolor:"rgba(0, 0, 0, 0.01)"},children:j.map(n=>{const m=`${n.type}-${n.source}`,v=!!d[m];return e.jsx(G,{dense:!0,sx:{py:.75},onClick:()=>g(n),children:e.jsxs(f,{sx:{display:"flex",alignItems:"flex-start",width:"100%"},children:[e.jsx(V,{checked:v,sx:{mr:1}}),e.jsxs(f,{children:[e.jsx(S,{variant:"body1",sx:{cursor:"pointer"},children:n.type}),e.jsx(S,{variant:"caption",color:"text.disabled",sx:{display:"block",cursor:"pointer"},children:n.description})]})]})},m)})})})]},r)})})}),a&&e.jsx(Se,{error:!0,sx:{mt:1},children:a})]})}oe.propTypes={eventsBySource:o.objectOf(o.shape({source:o.shape({did:o.string.isRequired,title:o.string,description:o.string,version:o.string,logo:o.string}).isRequired,events:o.arrayOf(o.shape({type:o.string.isRequired,description:o.string.isRequired,source:o.string.isRequired})).isRequired,count:o.number.isRequired})).isRequired,selectedEvents:o.objectOf(o.bool).isRequired,setSelectedEvents:o.func.isRequired,error:o.string};oe.defaultProps={error:null};function ne({id:t,url:d,description:c,enabledEvents:a,onSubmit:b,onClose:R}){var n;const{t:p}=L(),[s,l]=C.useState({}),{teamDid:k}=U(),{api:T}=_(),{loading:g,error:y,eventsBySource:h}=et(),{control:r,handleSubmit:w,formState:{errors:j},reset:E,setValue:u,trigger:I}=He({defaultValues:{url:"",description:""}});C.useEffect(()=>{const m=Object.values(s).some(v=>v);u("selectedEvents",m?"valid":""),I("selectedEvents")},[s,u,I]);const i=()=>{l({}),E(),R()},x=async m=>{const v=Object.keys(s).filter(M=>s[M]),P={url:m.url,description:m.description,enabledEvents:v.map(M=>{const[A,B]=M.split("-");return!A||!B?null:{type:A,source:B}}).filter(Boolean)};try{if(t){const M=await T.updateWebhookEndpoint({input:{teamDid:k,id:t,data:P}});O.success(`${p("webhookEndpoint.updateWebhook")} ${p("webhookEndpoint.success")}`),b(M)}else{const M=await T.createWebhookEndpoint({input:{teamDid:k,input:P}});O.success(`${p("webhookEndpoint.createWebhook")} ${p("webhookEndpoint.success")}`),b(M)}}catch(M){O.error(M==null?void 0:M.message)}i()};return C.useEffect(()=>{E({url:d,description:c}),l(a.reduce((m,v)=>(m[`${v.type}-${v.source}`]=!0,m),{}))},[E,l,d,c,a]),e.jsx(je,{open:!0,onClose:i,maxWidth:"lg",fullWidth:!0,sx:{"& .MuiDialog-paper":{minHeight:600}},children:e.jsxs("form",{onSubmit:w(x),children:[e.jsx(ye,{children:p(t?"webhookEndpoint.editWebhookTitle":"webhookEndpoint.createWebhookTitle")}),e.jsx(we,{children:e.jsxs(f,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[e.jsx(J,{name:"url",control:r,rules:{required:p("webhookEndpoint.validation.urlRequired"),pattern:{value:/^(http|https):\/\/[^ "]+$/,message:p("webhookEndpoint.validation.urlInvalid")}},render:({field:m})=>{var v;return e.jsx(le,{...m,label:p("webhookEndpoint.url.label"),fullWidth:!0,error:!!j.url,helperText:(v=j.url)==null?void 0:v.message})}}),e.jsx(J,{name:"description",control:r,rules:{required:p("webhookEndpoint.validation.descriptionRequired")},render:({field:m})=>{var v;return e.jsx(le,{...m,label:p("webhookEndpoint.description.label"),fullWidth:!0,multiline:!0,minRows:2,maxRows:4,error:!!j.description,helperText:(v=j.description)==null?void 0:v.message})}}),e.jsx(J,{name:"selectedEvents",control:r,rules:{required:p("webhookEndpoint.validation.eventRequired")},render:({field:m})=>e.jsx("input",{type:"hidden",...m})}),!g&&h&&Object.keys(h).length>0&&e.jsx(oe,{eventsBySource:h,selectedEvents:s,setSelectedEvents:l,error:(n=j.selectedEvents)==null?void 0:n.message}),!g&&(!h||Object.keys(h).length===0)&&e.jsx(S,{color:"text.secondary",children:p("webhookEndpoint.noAvailableEvents")}),g&&e.jsx(f,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"500px",width:"100%"},children:e.jsx(H,{size:20})}),y&&e.jsx(Z,{severity:"error",children:p("webhookEndpoint.loadingError",{message:y==null?void 0:y.message})})]})}),e.jsxs(ve,{sx:{p:"8px 24px 24px"},children:[e.jsx(N,{onClick:i,children:p("common.cancel")}),e.jsx(N,{type:"submit",variant:"contained",color:"primary",children:p(t?"webhookEndpoint.updateWebhook":"webhookEndpoint.saveWebhook")})]})]})})}ne.propTypes={onSubmit:o.func.isRequired,id:o.string,url:o.string,description:o.string,enabledEvents:o.arrayOf(o.shape({type:o.string.isRequired,source:o.string.isRequired})),onClose:o.func};ne.defaultProps={id:null,url:"",description:"",enabledEvents:[],onClose:()=>{}};function xe(t){switch(t){case"enabled":return"success";case"disabled":default:return"default"}}const tt=(t="en")=>t==="tw"?"zh":t;function F(t,d="YYYY-MM-DD HH:mm:ss",c="en"){return t?Re(t).locale(tt(c)).format(d):"-"}function ot(t){return typeof t=="number"?!1:ce(t)}function nt(t){return t>=200&&t<300}function D(t){const d=ot(t.value);return e.jsxs(e.Fragment,{children:[e.jsxs(z,{direction:"column",alignItems:"flex-start",children:[e.jsxs(S,{component:"div",variant:"body1",mb:1,color:"text.primary",sx:{fontWeight:500},children:[t.label,!!t.tip&&e.jsx(W,{title:t.tip,children:e.jsx(Ge,{fontSize:"small"})})]}),e.jsx(S,{component:"div",variant:"body1",color:d?"text.disabled":"text.secondary",sx:{width:"100%",minHeight:"24px"},children:d?"-":t.value})]}),t.divider&&e.jsx(Me,{orientation:"vertical",flexItem:!0})]})}D.propTypes={label:o.oneOfType([o.string,o.node]).isRequired,value:o.oneOfType([o.string,o.node]).isRequired,tip:o.oneOfType([o.string,o.node]),divider:o.bool};D.defaultProps={tip:"",divider:!1};function se(t){return e.jsxs(z,{className:"section-header",direction:"row",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:1,sx:{mb:t.mb,mt:t.mt,pb:1},children:[e.jsx(S,{variant:"h3",sx:{fontSize:{xs:"18px",md:"1.09375rem"}},component:"div",children:t.title}),t.children]})}se.propTypes={title:o.oneOfType([o.string,o.node]).isRequired,children:o.node,mb:o.number,mt:o.number};se.defaultProps={children:null,mb:1.5,mt:1.5};const st=t=>{const d={};return t.forEach(c=>{var b;const a=new Date(c.createdAt).toLocaleDateString();d[a]||(d[a]=[]),(b=d[a])==null||b.push(c)}),d};function re({eventId:t,webhookEndpointId:d,event:c}){const{api:a}=_(),{t:b}=L(),{teamDid:R}=U(),{blocklet:p}=he(),{data:s,loadMore:l,loadingMore:k,loading:T}=Ne(u=>{const i=u?Math.ceil(u.list.length/15)+1:1;return a.getWebhookAttempts({input:{teamDid:R,input:{eventId:t,webhookId:d},paging:{page:i,pageSize:15}}})},{reloadDeps:[t,d]}),g=(s==null?void 0:s.list)||[],[y,h]=C.useState(null),r=st(g);C.useEffect(()=>{!y&&(s!=null&&s.list.length)&&h(s.list[0])},[s==null?void 0:s.list.length,y]);const w=u=>{h(u)};if(T)return e.jsx(H,{});const j=s&&s.list.length<s.paging.total,E=u=>{var I,i,x,n,m;if(u.responseBody&&((I=u.responseBody)!=null&&I.sessionId)&&((i=u.responseBody)!=null&&i.projectId)&&((x=u.responseBody)!=null&&x.agentId)){const v=(m=(n=p==null?void 0:p.site)==null?void 0:n.domainAliases[0])==null?void 0:m.value,P=(p.children||[]).find(A=>{var B;return((B=A==null?void 0:A.meta)==null?void 0:B.name)==="ai-studio"}),M=Pe(De(`https://${v}`,(P==null?void 0:P.mountPoint)||"","projects",u.responseBody.projectId,"logs/main"),{sessionId:u.responseBody.sessionId,agentId:u.responseBody.agentId});return e.jsx(te,{sx:{fontSize:20},onClick:()=>window.open(M,"_blank"),children:e.jsx(f,{component:We,icon:$e})})}return null};return e.jsxs(Y,{container:!0,spacing:{xs:0,md:1},sx:{height:1},children:[e.jsx(Y,{item:!0,xs:12,md:4,height:1,children:ce(Object.keys(r))?e.jsx(S,{color:"text.secondary",children:b("webhookEndpoint.waitingForEvents")}):e.jsxs(e.Fragment,{children:[e.jsx(Q,{sx:{maxHeight:"calc(100% - 40px)",py:0,overflowY:"auto"},children:Object.entries(r).map(([u,I])=>e.jsxs(ee.Fragment,{children:[e.jsx(Fe,{children:u}),I.map(i=>e.jsxs(G,{sx:{cursor:"pointer"},onClick:()=>w(i),selected:y===i,secondaryAction:e.jsx(S,{color:"text.secondary",children:F(i.createdAt,"HH:mm:ss")}),children:[e.jsx(Ie,{sx:{minWidth:0,mr:1.5},children:nt(i.responseStatus)===!1?e.jsx(Qe,{color:"error"}):e.jsx(Je,{color:"success"})}),e.jsx(ze,{primary:e.jsx(S,{color:"text.primary",children:i.event.type})})]},i.id))]},u))}),j&&e.jsx(f,{display:"flex",justifyContent:"center",alignItems:"center",width:1,children:e.jsx(N,{variant:"text",type:"button",color:"inherit",onClick:l,disabled:k,sx:{color:u=>u.palette.text.disabled},children:b(k?"webhookEndpoint.loadingMore":"webhookEndpoint.loadMore")})})]})}),e.jsxs(Y,{item:!0,xs:12,md:8,height:1,children:[y&&e.jsxs(z,{height:1,overflow:"auto",direction:"column",spacing:2,sx:{pl:{xs:0,md:1},mt:{xs:2,md:0},borderLeft:{xs:"none"}},children:[e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(S,{variant:"h6",children:t?y.endpoint.url:y.event.type}),e.jsx(f,{children:E(y)})]}),e.jsxs(f,{children:[e.jsxs(S,{variant:"h6",children:[b("webhookEndpoint.response")," (",y.responseStatus,")"]}),e.jsx(K,{language:"json",children:JSON.stringify(y.responseBody,null,2)})]}),e.jsxs(f,{children:[e.jsx(z,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(S,{variant:"h6",children:b("webhookEndpoint.request")})}),e.jsx(K,{language:"json",sx:{margin:0},children:JSON.stringify(y.event,null,2)})]})]}),(s==null?void 0:s.list.length)===0&&c&&e.jsxs(f,{children:[e.jsx(z,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(S,{variant:"h6",children:b("webhookEndpoint.eventData")})}),e.jsx(K,{language:"json",sx:{margin:0},children:JSON.stringify(c.data,null,2)})]})]})]})}re.propTypes={eventId:o.string,webhookEndpointId:o.string,event:o.shape({type:o.string,data:o.object,request:o.object,requestInfo:o.object})};re.defaultProps={eventId:"",webhookEndpointId:"",event:null};function me({id:t,onClose:d}){var k,T,g,y;const{t:c}=L(),{api:a}=_(),{teamDid:b}=U(),{loading:R,error:p,data:s}=pe(()=>a.getWebhookEndpoint({input:{teamDid:b,id:t}})),l=s==null?void 0:s.data;return p?e.jsx(Z,{severity:"error",children:p.message}):R||!l?e.jsx(f,{display:"flex",justifyContent:"center",alignItems:"center",height:1,width:1,children:e.jsx(H,{})}):e.jsxs(rt,{direction:"column",sx:{height:{xs:"auto",md:1}},children:[e.jsxs(f,{children:[e.jsxs(z,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e.jsx(z,{flex:1,width:0,children:e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(S,{variant:"h5",fontWeight:600,sx:{overflow:"hidden",whiteSpace:"nowrap",textOverflow:"ellipsis"},children:l.description}),e.jsx(W,{title:l.url,children:e.jsx(X,{sx:{fontSize:"16px",marginTop:"2px"}})})]})}),e.jsx(z,{direction:"row",alignItems:"center",children:e.jsx(te,{edge:"end",color:"inherit",onClick:d,children:e.jsx(_e,{})})})]}),e.jsx(f,{mt:2,children:e.jsxs(z,{className:"section-body",direction:{xs:"column",md:"row"},spacing:{xs:1,md:3},justifyContent:"flex-start",flexWrap:"wrap",sx:{pt:2,mt:2,borderTop:"1px solid #eee"},children:[e.jsx(D,{label:c("common.status"),value:e.jsx($,{size:"small",variant:"filled",label:l.status,color:xe(l.status),sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}}),divider:!0}),e.jsx(D,{label:c("webhookEndpoint.listen"),value:e.jsx(W,{arrow:!0,title:e.jsx("ul",{style:{padding:0,margin:0},children:l.enabledEvents.map(h=>e.jsx("li",{style:{fontSize:"0.7875rem"},children:h==null?void 0:h.type},h))}),children:e.jsx($,{size:"small",variant:"filled",label:c("webhookEndpoint.eventsCount",{count:l.enabledEvents.length}),sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})}),divider:!0}),e.jsx(D,{label:c("webhookEndpoint.version"),value:l.apiVersion,divider:!0}),e.jsx(D,{label:c("common.createdAt"),value:F(l.createdAt),divider:!0}),e.jsx(D,{label:c("common.updatedAt"),value:F(l.updatedAt),divider:!0}),e.jsx(D,{label:c("common.createdBy"),value:e.jsx(W,{arrow:!0,title:(k=l.createUser)==null?void 0:k.did,children:e.jsx($,{size:"small",variant:"filled",label:(T=l.createUser)==null?void 0:T.fullName,sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})}),divider:!0}),e.jsx(D,{label:c("common.updatedBy"),value:e.jsx(W,{arrow:!0,title:(g=l.updateUser)==null?void 0:g.did,children:e.jsx($,{size:"small",variant:"filled",label:(y=l.updateUser)==null?void 0:y.fullName,sx:{borderRadius:"4px",lineHeight:"20px",textTransform:"capitalize"}})})})]})})]}),e.jsxs(z,{className:"section",flex:1,height:0,overflow:"hidden",children:[e.jsx(se,{title:c("webhookEndpoint.attempts"),mb:0,mt:4}),e.jsx(z,{height:0,flex:1,overflow:"hidden",children:e.jsx(re,{webhookEndpointId:l.id})})]})]})}me.propTypes={id:o.string.isRequired,onClose:o.func.isRequired};const rt=ue(z)``;function be({open:t,onClose:d,id:c}){return e.jsx(Oe,{anchor:"right",open:t,onClose:d,PaperProps:{sx:{width:"90vw",maxWidth:"1200px"}},children:e.jsx(f,{sx:{height:"100vh",p:3},children:e.jsx(me,{id:c,onClose:d})})})}be.propTypes={open:o.bool.isRequired,onClose:o.func.isRequired,id:o.string.isRequired};function de(){return null}const ie=ee.memo(({options:t,columns:d,toolbar:c=!0,footer:a=!0,hasRowLink:b=!1,emptyNodeText:R="",...p})=>{const{locale:s}=L(),l=Ae(g=>g.breakpoints.down("md")),k={print:!1,download:!1,filter:!1,selectableRows:"none",rowsPerPage:l?5:10,rowsPerPageOptions:[5,10,20,50,100],searchDebounceTime:300,tableBodyHeight:"100%",loading:!0},T={};return c||(T.TableToolbar=de),a||(T.TableFooter=de),e.jsx(it,{locale:s,options:{...k,...t},columns:(d||[]).map(g=>(g.options=g.options||{},g.options.filter=g.options.filter||!1,g.options.sort=g.options.sort||!1,g)),emptyNode:e.jsx(Ue,{children:R}),...p,components:T,hasRowLink:b,isMobile:l})});ie.propTypes={options:o.object,columns:o.array,toolbar:o.bool,footer:o.bool,hasRowLink:o.bool,emptyNodeText:o.node,durable:o.string,durableKeys:o.array,data:o.array,loading:o.bool,onChange:o.func,title:o.node,components:o.object};ie.defaultProps={options:{},columns:[],toolbar:!0,footer:!0,hasRowLink:!1,emptyNodeText:null,durable:"",durableKeys:[],data:[],loading:!1,onChange:()=>{},title:null,components:{}};const it=ue(fe)`
2
2
  .custom-toobar-btns {
3
3
  gap: 8px;
4
4
  }
@@ -138,4 +138,4 @@ import{D as fe,g as ge}from"./index-BhA9P09u.js";import{bZ as q,j as e,P as o,m
138
138
  width: inherit;
139
139
  }
140
140
  }
141
- `,lt=ie;function Pt(){const{teamDid:t}=U(),d=`webhook-endpoints-${t}`,c=ge(d),{t:a}=L(),{api:b}=_(),[R,p]=C.useState(""),[s,l]=C.useState({webhookDetail:{open:!1,id:null},createEdit:{open:!1,id:null,url:"",description:"",enabledEvents:[]},deleteConfirm:null}),[k,T]=qe(d,{defaultValue:{pageSize:c.rowsPerPage||20,page:c.page?c.page+1:1}}),{loading:g,error:y,data:h,refresh:r}=pe(()=>b.getWebhookEndpoints({input:{teamDid:t,paging:{page:k.page,pageSize:k.pageSize}}}));C.useEffect(()=>{r()},[k,r]);const w=C.useCallback(async(i,x)=>{try{await b.updateWebhookEndpoint({input:{teamDid:t,id:i.id,data:{status:x?"disabled":"enabled"}}}),r(),W.success(`${a(x?"webhookEndpoint.disable":"webhookEndpoint.enable")}${a("webhookEndpoint.success")}`)}catch(n){W.error(n==null?void 0:n.message)}},[b,t,r,a]),j=C.useCallback(async i=>{try{await b.deleteWebhookEndpoint({input:{teamDid:t,id:i}}),r(),l(x=>({...x,deleteConfirm:null})),W.success(`${a("common.delete")}${a("webhookEndpoint.success")}`)}catch(x){W.error(x==null?void 0:x.message)}},[b,t,r,a]),E=(i,x)=>{let n=i.page+1;const m=i.searchText||"";if(m!==R){p(m);return}if(x==="changePage"||x==="changeRowsPerPage"){x!=="changePage"&&(n=1);const v={page:n,pageSize:i.rowsPerPage};p(""),T(v)}};if(y)return e.jsx(X,{severity:"error",children:y.message});if(g||!h)return e.jsx(f,{display:"flex",justifyContent:"center",alignItems:"center",width:1,height:500,children:e.jsx(H,{})});const u=((h==null?void 0:h.list)||[]).filter(i=>{if(!R)return!0;const x=R.toLowerCase();return i.description.toLowerCase().includes(x)||i.url.toLowerCase().includes(x)}),I=[{label:"URL",name:"url",options:{customBodyRenderLite:(i,x)=>{const n=u[x];return e.jsxs(f,{sx:{display:"flex",alignItems:"center",cursor:"pointer",gap:.5},children:[e.jsx(S,{variant:"body2",children:n.description}),e.jsx(f,{sx:{display:"flex"},onClick:m=>{m.stopPropagation()},children:e.jsx($,{title:n.url,children:e.jsx(Z,{sx:{fontSize:"15px",marginTop:"1px"}})})})]})}}},{label:"Events",name:"events",options:{customBodyRenderLite:(i,x)=>{const n=u[x];return e.jsx(f,{sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"wrap"},children:n.enabledEvents.map(m=>e.jsx(O,{size:"small",variant:"filled",label:m.type,sx:{borderRadius:"4px",textTransform:"capitalize"}},`${n.source}-${m.type}`))})}}},{label:a("common.status"),name:"status",options:{customBodyRenderLite:(i,x)=>{const n=u[x];return e.jsx(O,{size:"small",variant:"filled",label:a(`webhookEndpoint.${n==null?void 0:n.status}`),color:xe(n==null?void 0:n.status),sx:{borderRadius:"4px",textTransform:"capitalize"}},`status-${n.status}`)}}},{label:a("common.createdAt"),name:"createdAt",minWidth:200,options:{customBodyRender:i=>F(i)}},{label:a("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRenderLite:(i,x)=>{const n=u[x],m=(n==null?void 0:n.status)==="enabled";return e.jsx(Ve,{actions:[{icon:m?e.jsx(Xe,{}):e.jsx(Ze,{}),text:a(m?"webhookEndpoint.disable":"webhookEndpoint.enable"),onClick:v=>{v.stopPropagation(),w(n,m)}},{icon:e.jsx(Je,{}),text:a("common.edit"),onClick:v=>{v.stopPropagation(),l(P=>({...P,createEdit:{open:!0,id:n.id,url:n.url,description:n.description,enabledEvents:n.enabledEvents}}))}},{icon:e.jsx(Ke,{}),text:a("common.delete"),onClick:v=>{v.stopPropagation(),l(P=>({...P,deleteConfirm:{title:a("webhookEndpoint.deleteWebhook.title"),description:a("webhookEndpoint.deleteWebhook.description"),confirm:a("common.confirm"),cancel:a("common.cancel"),onConfirm:()=>j(n.id),onCancel:()=>l(M=>({...M,deleteConfirm:null}))}}))}}]})}}}];return e.jsxs(e.Fragment,{children:[e.jsx(lt,{durable:d,durableKeys:["page","rowsPerPage"],data:u,columns:I,options:{count:h.count,page:k.page-1,rowsPerPage:k.pageSize,viewColumns:!1,onRowClick:(i,{dataIndex:x})=>{const n=h.list[x];l(m=>({...m,webhookDetail:{open:!0,id:n.id}}))}},loading:g,onChange:E,title:e.jsx(S,{variant:"h6",children:a("webhookEndpoint.title")}),emptyNodeText:e.jsxs(z,{gap:1,children:[a("webhookEndpoint.noWebhooksAdded"),e.jsx(N,{variant:"contained",color:"primary",onClick:()=>l(i=>({...i,createEdit:{...i.createEdit,open:!0}})),children:a("webhookEndpoint.createWebhook")})]}),customButtons:[e.jsxs(N,{sx:{color:"common.white"},edge:"end",variant:"contained",color:"primary",onClick:()=>l(i=>({...i,createEdit:{...i.createEdit,open:!0}})),className:"rule-action",children:[g?e.jsx(H,{size:16}):e.jsx(Be,{style:{fontSize:16}}),a("common.create")]},"add")]}),s.webhookDetail.open&&e.jsx(be,{open:!0,onClose:()=>l(i=>({...i,webhookDetail:{open:!1,id:null}})),id:s.webhookDetail.id}),s.createEdit.open&&e.jsx(ne,{onSubmit:r,...s.createEdit,onClose:()=>l(i=>({...i,createEdit:{id:null,url:"",description:"",enabledEvents:[],open:!1}}))}),s.deleteConfirm&&e.jsx(Le,{title:s.deleteConfirm.title,description:s.deleteConfirm.description,confirm:s.deleteConfirm.confirm,cancel:s.deleteConfirm.cancel,params:s.deleteConfirm.params,onConfirm:s.deleteConfirm.onConfirm,onCancel:s.deleteConfirm.onCancel})]})}export{Pt as default};
141
+ `,lt=ie;function Pt(){const{teamDid:t}=U(),d=`webhook-endpoints-${t}`,c=ge(d),{t:a}=L(),{api:b}=_(),[R,p]=C.useState(""),[s,l]=C.useState({webhookDetail:{open:!1,id:null},createEdit:{open:!1,id:null,url:"",description:"",enabledEvents:[]},deleteConfirm:null}),[k,T]=qe(d,{defaultValue:{pageSize:c.rowsPerPage||20,page:c.page?c.page+1:1}}),{loading:g,error:y,data:h,refresh:r}=pe(()=>b.getWebhookEndpoints({input:{teamDid:t,paging:{page:k.page,pageSize:k.pageSize}}}));C.useEffect(()=>{r()},[k,r]);const w=C.useCallback(async(i,x)=>{try{await b.updateWebhookEndpoint({input:{teamDid:t,id:i.id,data:{status:x?"disabled":"enabled"}}}),r(),O.success(`${a(x?"webhookEndpoint.disable":"webhookEndpoint.enable")}${a("webhookEndpoint.success")}`)}catch(n){O.error(n==null?void 0:n.message)}},[b,t,r,a]),j=C.useCallback(async i=>{try{await b.deleteWebhookEndpoint({input:{teamDid:t,id:i}}),r(),l(x=>({...x,deleteConfirm:null})),O.success(`${a("common.delete")}${a("webhookEndpoint.success")}`)}catch(x){O.error(x==null?void 0:x.message)}},[b,t,r,a]),E=(i,x)=>{let n=i.page+1;const m=i.searchText||"";if(m!==R){p(m);return}if(x==="changePage"||x==="changeRowsPerPage"){x!=="changePage"&&(n=1);const v={page:n,pageSize:i.rowsPerPage};p(""),T(v)}};if(y)return e.jsx(Z,{severity:"error",children:y.message});if(g||!h)return e.jsx(f,{display:"flex",justifyContent:"center",alignItems:"center",width:1,height:500,children:e.jsx(H,{})});const u=((h==null?void 0:h.list)||[]).filter(i=>{if(!R)return!0;const x=R.toLowerCase();return i.description.toLowerCase().includes(x)||i.url.toLowerCase().includes(x)}),I=[{label:"URL",name:"url",options:{customBodyRenderLite:(i,x)=>{const n=u[x];return e.jsxs(f,{sx:{display:"flex",alignItems:"center",cursor:"pointer",gap:.5},children:[e.jsx(S,{variant:"body2",children:n.description}),e.jsx(f,{sx:{display:"flex"},onClick:m=>{m.stopPropagation()},children:e.jsx(W,{title:n.url,children:e.jsx(X,{sx:{fontSize:"15px",marginTop:"1px"}})})})]})}}},{label:"Events",name:"events",options:{customBodyRenderLite:(i,x)=>{const n=u[x];return e.jsx(f,{sx:{display:"flex",alignItems:"center",gap:1,flexWrap:"wrap"},children:n.enabledEvents.map(m=>e.jsx($,{size:"small",variant:"filled",label:m.type,sx:{borderRadius:"4px",textTransform:"capitalize"}},`${n.source}-${m.type}`))})}}},{label:a("common.status"),name:"status",options:{customBodyRenderLite:(i,x)=>{const n=u[x];return e.jsx($,{size:"small",variant:"filled",label:a(`webhookEndpoint.${n==null?void 0:n.status}`),color:xe(n==null?void 0:n.status),sx:{borderRadius:"4px",textTransform:"capitalize"}},`status-${n.status}`)}}},{label:a("common.createdAt"),name:"createdAt",minWidth:200,options:{customBodyRender:i=>F(i)}},{label:a("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRenderLite:(i,x)=>{const n=u[x],m=(n==null?void 0:n.status)==="enabled";return e.jsx(Ve,{actions:[{icon:m?e.jsx(Ze,{}):e.jsx(Xe,{}),text:a(m?"webhookEndpoint.disable":"webhookEndpoint.enable"),onClick:v=>{v.stopPropagation(),w(n,m)}},{icon:e.jsx(Ke,{}),text:a("common.edit"),onClick:v=>{v.stopPropagation(),l(P=>({...P,createEdit:{open:!0,id:n.id,url:n.url,description:n.description,enabledEvents:n.enabledEvents}}))}},{icon:e.jsx(Ye,{}),text:a("common.delete"),onClick:v=>{v.stopPropagation(),l(P=>({...P,deleteConfirm:{title:a("webhookEndpoint.deleteWebhook.title"),description:a("webhookEndpoint.deleteWebhook.description"),confirm:a("common.confirm"),cancel:a("common.cancel"),onConfirm:()=>j(n.id),onCancel:()=>l(M=>({...M,deleteConfirm:null}))}}))}}]})}}}];return e.jsxs(e.Fragment,{children:[e.jsx(lt,{durable:d,durableKeys:["page","rowsPerPage"],data:u,columns:I,options:{count:h.count,page:k.page-1,rowsPerPage:k.pageSize,viewColumns:!1,onRowClick:(i,{dataIndex:x})=>{const n=h.list[x];l(m=>({...m,webhookDetail:{open:!0,id:n.id}}))}},loading:g,onChange:E,title:e.jsx(S,{variant:"h6",children:a("webhookEndpoint.title")}),emptyNodeText:e.jsxs(z,{gap:1,children:[a("webhookEndpoint.noWebhooksAdded"),e.jsx(N,{variant:"contained",color:"primary",onClick:()=>l(i=>({...i,createEdit:{...i.createEdit,open:!0}})),children:a("webhookEndpoint.createWebhook")})]}),customButtons:[e.jsxs(N,{sx:{color:"common.white"},edge:"end",variant:"contained",color:"primary",onClick:()=>l(i=>({...i,createEdit:{...i.createEdit,open:!0}})),className:"rule-action",children:[g?e.jsx(H,{size:16}):e.jsx(Be,{style:{fontSize:16}}),a("common.create")]},"add")]}),s.webhookDetail.open&&e.jsx(be,{open:!0,onClose:()=>l(i=>({...i,webhookDetail:{open:!1,id:null}})),id:s.webhookDetail.id}),s.createEdit.open&&e.jsx(ne,{onSubmit:r,...s.createEdit,onClose:()=>l(i=>({...i,createEdit:{id:null,url:"",description:"",enabledEvents:[],open:!1}}))}),s.deleteConfirm&&e.jsx(Le,{title:s.deleteConfirm.title,description:s.deleteConfirm.description,confirm:s.deleteConfirm.confirm,cancel:s.deleteConfirm.cancel,params:s.deleteConfirm.params,onConfirm:s.deleteConfirm.onConfirm,onCancel:s.deleteConfirm.onCancel})]})}export{Pt as default};
@@ -1,4 +1,4 @@
1
- import{bs as xt,r as j,bF as ee,bi as V,z as Q,E as k,j as e,P as d,T as bt,aQ as Qe,aR as Je,fE as jt,ay as yt,h as ie,aC as vt,k as J,N as C,m as te,ee as ke,Q as Pe,kC as Ze,bn as Te,aZ as Re,X as Ie,ek as Se,b8 as Ve,b6 as Ee,C as et,n as ce,aU as De,W as St,ax as tt,gh as Fe,B as Ae,dO as st,f_ as je,bv as nt,ak as ue,fa as Ct,dP as Nt,G as Ge,kD as wt,kE as Tt,D as Rt,kF as It,kG as Et,kH as Dt,kI as At,bA as at,S as Ot,U as Lt,V as Xe,M as kt,kJ as Pt}from"./index-KdOmwCM0.js";import{k as Ft,D as it,g as _t}from"./index-BhA9P09u.js";import{S as he}from"./shorten-label-B1taCLSu.js";import{I as ot}from"./index-yrfr0MWP.js";import{T as Bt}from"./index-DPJjuq8y.js";import{a as _e}from"./actions-CIvfyQ4N.js";import{d as zt}from"./Refresh-DsQW01Ya.js";import{D as Wt,g as Mt}from"./traffic-BZMRS6o_.js";import"./TableRow-BMSWmGPk.js";import"./useThemeProps-BT_RONtx.js";import"./emotion-react.browser.esm-DwA9twTe.js";import"./ViewColumn-BIPD356c.js";import"./Search-DnEqCvoa.js";import"./Clear-C7odY-6_.js";import"./Delete-DpNbJCJA.js";import"./index-D6UMpm4p.js";import"./MoreVert-UFPlWjze.js";import"./TableSearch-Dobasaj8.js";import"./useLocalStorage-DqX-zdwD.js";import"./get-safe-url-fVLOWjDv.js";import"./ButtonGroup-DP9Um2zw.js";import"./getValidReactChildren-BybUhg_p.js";import"./url-evaluation-BMmqZ9Xm.js";import"./permission-DR4c0ARF.js";import"./iframe-B52MZmUp.js";import"./ChevronLeft-CVA4N8rQ.js";import"./ChevronRight-sZUpX7tH.js";import"./index-Btu7Neya.js";import"./CardContent-CV6vnW6h.js";import"./AdapterDayjs-DN3WVSzh.js";import"./CSSTransition-Ce16mrqT.js";import"./refType-BFp6Mdcn.js";const rt=j.createContext({}),{Provider:qt,Consumer:Ys}=rt;function Kt({children:t,blocklet:s=""}){const{api:n,inService:r,ws:{useSubscription:o}}=xt(),[a,x]=j.useState([]),[u,R]=j.useState({total:0,pageSize:20,pageCount:0,page:1}),m=ee(()=>{var h;return(h=s.meta)==null?void 0:h.did},[s]),[v,S]=j.useState([]),[I,M]=j.useState({}),E=ee(()=>a.length?new Set(a.map(h=>h.id)):new Set,[a]),L=async({page:h=1,pageSize:O=20,...A}={})=>{if(!m)return[];try{const P={paging:{page:h,pageSize:O},...A,teamDid:m,dateRange:A.dateRange?[V(A.dateRange[0]).toISOString(),V(A.dateRange[1]).toISOString()]:void 0},{dids:B,...q}=P;let Z="";B&&B.includes("system")&&(Z="system");const z=B?B.filter(f=>f!=="system"):[],oe={...q,source:Z,componentDids:z},se=await n.getNotificationSendLog({input:oe});return M(oe),x(se.list),R(se.paging),se.list}catch(P){return Q.error(P.message),[]}},D=async()=>{const h=await n.getNotificationComponents({input:{teamDid:m}});S(h.componentDids)},G=j.useCallback(h=>{const O=s.children.find(A=>{var P;return((P=A.meta)==null?void 0:P.did)===h});if(O)return O.ancestors=[s],O},[s]),U=async({notificationId:h,receivers:O,channels:A,...P})=>{await n.resendNotification({input:{teamDid:m,notificationId:h,receivers:O,channels:A.map(B=>B==="wallet"?k.NOTIFICATION_SEND_CHANNEL.WALLET:B==="pushKit"?k.NOTIFICATION_SEND_CHANNEL.PUSH:B),...P}})},H=j.useCallback(async h=>(await n.getUser({input:{teamDid:m,user:{did:h}}})).user,[n,m]),N=j.useCallback(async({page:h=1,pageSize:O=20,...A}={})=>{try{const P={paging:{page:h,pageSize:O},...A,userName:A.searchText||"",teamDid:m,dateRange:A.dateRange?[V(A.dateRange[0]).toISOString(),V(A.dateRange[1]).toISOString()]:void 0};return await n.getReceivers({input:P})}catch(P){throw Q.error(P.message),P}},[n,m]);j.useEffect(()=>{m&&D()},[m]),o(k.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,h=>{E.has(h.notificationId)&&L(I)},[E,I]),o(k.EVENTS.NOTIFICATION_BLOCKLET_CREATE,h=>{E.has(h.id)||L(I)},[E,I]);const _={fetch:L,data:a,paging:u,blocklet:s,getComponent:G,resendNotification:U,getUser:H,componentDids:v,getReceivers:N,inService:r,teamDid:m};return e.jsx(qt,{value:{notificationRecords:_},children:t})}function Be(){const{notificationRecords:t}=j.useContext(rt);return t}ge.propTypes={severity:d.oneOf(Object.values(["info","success","error","warning"])).isRequired};const Ut={info:"primary",success:"success",error:"error",warning:"warning"};function ge({severity:t="info"}){return e.jsx(bt,{type:Ut[t],children:t})}var ze={},Ht=Je;Object.defineProperty(ze,"__esModule",{value:!0});var lt=ze.default=void 0,$t=Ht(Qe()),Vt=e;lt=ze.default=(0,$t.default)((0,Vt.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 We={},Gt=Je;Object.defineProperty(We,"__esModule",{value:!0});var ct=We.default=void 0,Xt=Gt(Qe()),Yt=e;ct=We.default=(0,Xt.default)((0,Yt.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");const Qt=(t,s,n="")=>{if(!n||!s)return"";switch(n){case k.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:s});case k.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:s});case k.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:s});case k.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return n}};function dt(t,s,n={}){const{status:r,updatedAt:o,reason:a="",channel:x="wallet"}=n,u=o?t("notification.sendStatus.sentTime",{date:yt(o,s)}):"",R=Qt(t,x,a);return r===k.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:u,reason:R}:r===k.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:u}:{status:"pending",title:t("notification.sendStatus.pending"),reason:R,sentTime:u}}const Oe={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Le=["wallet","pushKit","email"],Ye=["info","success","error","warning"],ut=t=>{var n,r;const{settings:s}=t;return(r=(n=s==null?void 0:s.notification)==null?void 0:n.email)==null?void 0:r.enabled},pt=t=>{var n,r;const{settings:s}=t;return(r=(n=s==null?void 0:s.notification)==null?void 0:n.pushKit)==null?void 0:r.enabled},Jt=(t,s)=>{const n=ie(s,"extra.notifications.email",!0);return{available:ut(t),enabled:n}},Zt=(t,s)=>{const n=ie(s,"extra.notifications.push",!0);return{available:pt(t),enabled:n}},es=t=>({enabled:ie(t,"extra.notifications.wallet",!0)}),ts=t=>({enabled:ie(t,"extra.webhooks",[]).length>0}),xe=(t=3)=>new Promise(s=>{setTimeout(()=>{s()},t*1e3)}),ss=(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})}]:[],be=(t=[])=>{const s=V().startOf("day");return t.filter(n=>V(n.sendAt).isSame(s,"day")).length},ns=(t,s="")=>{if(s&&Le.includes(s)){const a=`${s}SendRecord`,x=ie(t,a,[]);return be(x)}const n=ie(t,"webhook",{}),r=Object.keys(n??{})??[];if(s&&r.includes(s)){const a=n[s]??[];return be(a)}const o={};return Le.forEach(a=>{const x=`${a}SendRecord`,u=ie(t,x,[]),R=be(u);o[a]=R}),r.length>0&&r.forEach(a=>{const x=n[a]??[],u=be(x);o[a]=u}),o},ye=(t,s,n)=>{if(!Array.isArray(t))throw new Error("Invalid filterList or index");return t[n].splice(s,1),t},ve=(t,s)=>{if(!Array.isArray(s))throw new Error("filters must be an array");return s.length?!s.includes(t):!1},as=t=>{switch(t){case k.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case k.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case k.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case k.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},ft=()=>jt({typography:{fontSize:14,button:{textTransform:"none"}},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 ne({config:t,enableTooltip:s=!0,showTitle:n=!1,children:r}){const{status:o,title:a="",sentTime:x="",reason:u=""}=t,R=[a,u].filter(Boolean).join(", ");return e.jsx(vt,{title:s?e.jsxs(e.Fragment,{children:[e.jsx(J,{color:"inherit",sx:{fontSize:12},children:R}),e.jsx("span",{children:x})]}):null,arrow:!0,placement:"top",children:e.jsxs(C,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(C,{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center",children:[e.jsx(C,{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Oe[o],style:{opacity:.15}}),e.jsx(C,{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Oe[o]})]}),e.jsx(J,{color:"inherit",sx:{fontSize:12},children:n?a:r})]})})}ne.propTypes={config:d.object.isRequired,enableTooltip:d.bool,showTitle:d.bool,children:d.node};ne.defaultProps={enableTooltip:!0,showTitle:!1,children:null};pe.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};pe.defaultProps={onDelete:()=>{}};function pe({list:t,label:s,onDelete:n}){const{t:r,locale:o}=te();return e.jsxs(C,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(J,{children:[s,": "]}),t.map(a=>{const x=dt(r,o,{status:a});return e.jsx(ke,{size:"small",label:e.jsx(C,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(ne,{config:x,enableTooltip:!1,children:x.title})}),onDelete:u=>n(u,a)},a)})]})}Me.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 Me({filterList:t,onChange:s,index:n,column:r,filterValues:o,label:a,renderLabel:x}){return e.jsxs(Pe,{className:"filter-container",children:[e.jsx(Ze,{component:"legend",children:a}),e.jsx(Te,{row:!0,children:o.map(u=>e.jsx(Re,{control:e.jsx(Ie,{checked:t[n].indexOf(u.value??u)>-1,onChange:R=>{const m=[...t];R.target.checked?m[n]=[...m[n],u.value??u]:m[n]=m[n].filter(v=>v!==(u.value??u)),s(m[n],n,r)},name:u.value??u}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:x(u)})},u.value??u))})]})}function we(t){return e.jsx(Me,{...t,renderLabel:s=>e.jsx(ne,{enableTooltip:!1,config:{status:s.status},children:s.label})})}de.propTypes={status:d.number.isRequired,updatedAt:d.string.isRequired,reason:d.string,channel:d.string,onResend:d.func};function de({status:t,updatedAt:s,reason:n="",channel:r="wallet",onResend:o}){const{t:a,locale:x}=te(),u=dt(a,x,{status:t,updatedAt:s,reason:n,channel:r});return e.jsxs(C,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(ne,{config:u,showTitle:!0}),u.status!=="success"&&e.jsx(Se,{className:"resend-btn",size:"small",startIcon:e.jsx(_e,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:o,children:a("notification.resend")})]})}qe.propTypes={value:d.array.isRequired,onChange:d.func};function qe({value:t,onChange:s}){const{locale:n}=te(),r=V().toDate(),[o,a]=j.useState(null),x=j.useCallback(m=>{a(o?null:m.currentTarget)},[o]),u=!!o,R=j.useCallback(m=>{if(!m.startDate||!m.endDate){Q.error("Please select a date range");return}if(V(m.startDate).isAfter(m.endDate)||!V(m.startDate).isValid()||!V(m.endDate).isValid()){Q.error("Invalid date range");return}s([m.startDate,m.endDate]),a(null)},[s]);return e.jsxs("div",{children:[e.jsx(J,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:0,children:e.jsxs(Se,{onClick:x,variant:"outlined",size:"small",color:"inherit",children:[Ve(t[0],n)," - ",Ve(t[1],n)]})}),e.jsx(Ee,{open:u,anchorEl:o,onClose:()=>{a(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(Wt,{open:!0,maxDate:r,initialDateRange:{startDate:t[0],endDate:t[1]},toggle:x,definedRanges:Mt(r),onChange:R})})]})}Ke.propTypes={itemComponent:d.elementType.isRequired};function Ke({itemComponent:t,...s}){var o;const{t:n}=te();return!((o=s==null?void 0:s.filterList)!=null&&o.filter(a=>a.length).length)?null:e.jsxs(C,{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 Ce({label:t,onDelete:s,canDelete:n=()=>!0,...r}){const o=s&&typeof s=="function"?s:void 0;let a=!0;return n&&typeof n=="function"&&(a=n({label:t,...r})),e.jsx(ke,{label:t,variant:"outlined",...o&&a?{onDelete:o}:{}})}Ce.propTypes={label:d.string.isRequired,onDelete:d.func,canDelete:d.func};Ce.defaultProps={canDelete:()=>!0};const is=[{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}];Ue.propTypes={loading:d.bool,onCancel:d.func,onConfirm:d.func};Ue.defaultProps={loading:!1,onCancel:()=>{},onConfirm:()=>{}};function Ue({loading:t=!1,onCancel:s,onConfirm:n}){const{t:r}=te(),[o,a]=j.useState(is),[x,u]=j.useState(!0),R=(v,S)=>{S.checked=v.target.checked;const I=o.map(M=>({...M,checked:M.value===S.value?S.checked:M.checked}));a(I)},m=v=>{v.stopPropagation(),n({channels:o.filter(S=>S.checked).map(S=>S.value),isResendFailedOnly:x})};return e.jsxs(C,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(J,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(C,{className:"choose-channel",children:e.jsxs(Pe,{component:"fieldset",variant:"standard",children:[e.jsx(Ze,{component:"legend",children:r("notification.selectChannels")}),e.jsx(Te,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:o.map(v=>e.jsx(Re,{control:e.jsx(Ie,{checked:v.checked,onChange:S=>R(S,v),name:v.value}),label:v.label},v.value))})]})}),e.jsx(C,{className:"resend-config-footer",children:e.jsx(Te,{children:e.jsx(Re,{control:e.jsx(Ie,{checked:x,onChange:v=>u(v.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(C,{display:"flex",justifyContent:"flex-end",gap:1,className:"resend-config-footer-tip",children:[e.jsx(Se,{onClick:v=>{v.stopPropagation(),s()},color:"inherit",children:r("common.cancel")}),e.jsxs(Se,{onClick:m,color:"primary",disabled:t,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[t&&e.jsx(et,{size:16}),r("common.confirm")]})]})]})}mt.propTypes={notificationId:d.string.isRequired,handleResend:d.func,resending:d.bool};function mt({notificationId:t,handleResend:s,resending:n=!1}){const{t:r,locale:o}=te(),{getReceivers:a,inService:x,teamDid:u,getUser:R,blocklet:m}=Be(),[v,S]=j.useState(!1),[I,M]=j.useState([]),E=De({anchorEl:null,position:null}),L=De({anchorEl:null,position:null}),[D,G]=j.useState(null),[U,H]=j.useState({total:0,pageSize:10,pageCount:0,page:1}),[N,_]=j.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[V().subtract(1,"month").startOf("day").toDate(),V().endOf("day").toDate()]}),[h,O]=j.useState([]),A=[{label:r("notification.sendStatus.pending"),value:0,status:"pending"},{label:r("notification.sendStatus.success"),value:1,status:"success"},{label:r("notification.sendStatus.failed"),value:2,status:"failed"}],P=async()=>{if(!v&&t)try{S(!0);const i=await a({notificationId:t,...N}),l=i.list.map(c=>({...c,receiverUser:{...c.receiverUser,avatar:nt(c.receiverUser.avatar,u,x)}}));M(l),H(i.paging),S(!1)}catch(i){Q.error(i.message),S(!1)}};j.useEffect(()=>{P()},[N]);const B=i=>{i.stopPropagation();const l=i.currentTarget;L.anchorEl=l;const c=l.getBoundingClientRect();L.position={top:c.top+window.scrollY,left:c.left+window.scrollX}},q=i=>i.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(_e,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:B,children:r("notification.resend")})}):null,Z={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:U.page-1,rowsPerPage:U.pageSize,count:U.total,searchText:N.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:h,onRowSelectionChange:(i,l)=>{O(l.map(c=>c.dataIndex))},customToolbarSelect:q},z=({page:i,rowsPerPage:l,searchText:c,filterList:y})=>{const[,F=[],$=[],K=[]]=y;N.pageSize!==l?_(W=>({...W,pageSize:l,page:1})):N.page!==i+1?_(W=>({...W,page:i+1})):N.searchText!==c?_(W=>({...W,searchText:c,page:1})):ue(F,N.walletSendStatus)?ue($,N.pushKitSendStatus)?ue(K,N.emailSendStatus)||_(W=>({...W,emailSendStatus:K,page:1})):_(W=>({...W,pushKitSendStatus:$,page:1})):_(W=>({...W,walletSendStatus:F,page:1}))},oe=j.useCallback(async(i,l)=>{if(!l)return!1;const c=await R(l);return c?i==="wallet"?es(c):i==="email"?Jt(m,c):i==="pushKit"?Zt(m,c):i==="webhook"?ts(c):!0:!1},[R,m]),se=j.useCallback(i=>ss(r,i),[r]),f=()=>{E.anchorEl=null,E.position=null,G(null)},p=()=>{L.anchorEl=null,L.position=null},g=async(i,l,c=!0,y="")=>{if(!(!l.length||!i.length))try{s(i,l,c,y),L.anchorEl||(await xe(.5),f())}catch(F){console.error("handleResend error",{error:F})}},b=async({channels:i,isResendFailedOnly:l})=>{const c=h.map(y=>I[y].receiver);await g(i,c,l),await xe(.5),p(),O([])},T=async(i,l=[],c=!0)=>{try{await g(["webhook"],[i.receiver],c,l)}catch(y){Q.error(y.response?y.response.statusText:y.message)}},w=async(i,l,c,y=[],F=!0)=>{if(i.stopPropagation(),ns(l,c)>=4){Q.warning(r("notification.resendLimit"));return}if(!Le.includes(c)){await T(l,y,F);return}if(i){const K=i.currentTarget,W=K.getBoundingClientRect();E.anchorEl=K,E.position={top:W.top+window.scrollY,left:W.left+window.scrollX}}G({channel:c});try{const K=await oe(c,l.receiver);await xe(1),G({channel:c,result:K}),(typeof K=="boolean"&&K||Ct(K)&&Object.values(K).every(W=>!!W))&&(await s([c],[l.receiver],F),L.anchorEl||(await xe(.5),f()))}catch(K){Q.error(K.message)}},X=i=>{_(l=>({...l,dateRange:i,page:1}))},Y=(i,l,c,y)=>{i.stopPropagation();const F=c.filter($=>$!==l);_($=>({...$,[y]:F,page:1}))},ae=ee(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:i=>{const{receiverUser:l,receiver:c}=I[i];return l?e.jsxs(C,{"data-cy":`member-name-${l.fullName}`,display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start",children:[e.jsx(tt,{src:`${l.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:c,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(he,{children:l.fullName})]},c):e.jsx(St,{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:N.walletSendStatus??[],customFilterListOptions:{render:i=>e.jsx(pe,{list:i,label:"Wallet",onDelete:(l,c)=>{l.stopPropagation(),Y(l,c,ae[1].options.filterList,"walletSendStatus")}}),update:ye},filterOptions:{names:A,fullWidth:!0,logic:ve,display:(i,l,c,y)=>e.jsx(we,{label:"Wallet",filterList:i,onChange:l,index:c,column:y,filterValues:A})},customBodyRenderLite:i=>{const{walletSendStatus:l,walletSendAt:c,walletSendFailedReason:y}=I[i];return e.jsx(de,{status:l,updatedAt:c,reason:y,channel:"wallet",onResend:F=>w(F,I[i],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:i=>{const{pushKitSendStatus:l,pushKitSendAt:c,pushKitSendFailedReason:y}=I[i];return e.jsx(de,{status:l,updatedAt:c,reason:y,channel:"pushkit",onResend:F=>w(F,I[i],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:N.pushKitSendStatus??[],customFilterListOptions:{render:i=>e.jsx(pe,{list:i,label:"Push Kit",onDelete:(l,c)=>{l.stopPropagation(),Y(l,c,ae[2].options.filterList,"pushKitSendStatus")}}),update:ye},filterOptions:{names:A,fullWidth:!0,logic:ve,display:(i,l,c,y)=>e.jsx(we,{label:"Push Kit",filterList:i,onChange:l,index:c,column:y,filterValues:A})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:i=>{const{emailSendStatus:l,emailSendAt:c,emailSendFailedReason:y}=I[i];return e.jsx(de,{status:l,updatedAt:c,reason:y,channel:"email",onResend:F=>w(F,I[i],"email",[],!1)})},filter:!0,filterType:"custom",filterList:N.emailSendStatus??[],customFilterListOptions:{render:i=>e.jsx(pe,{list:i,label:"Email",onDelete:(l,c)=>{l.stopPropagation(),Y(l,c,ae[3].options.filterList,"emailSendStatus")}}),update:ye},filterOptions:{names:A,fullWidth:!0,logic:ve,display:(i,l,c,y)=>e.jsx(we,{label:"Email",filterList:i,onChange:l,index:c,column:y,filterValues:A})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:i=>{const{webhook:l}=I[i];if(!l)return null;const c=Object.entries(l)[0];if(!c)return null;const[y,F]=c,$=F[0];return e.jsx(C,{display:"flex",flexDirection:"column",gap:1,children:e.jsxs(C,{className:"webhook-item",fontSize:12,children:[e.jsx(he,{maxLength:30,children:y},y),e.jsx(de,{status:$.status,updatedAt:$.sendAt,reason:$.failedReason,channel:"webhook",onResend:K=>w(K,I[i],"webhook",[y],!1)})]},y)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:i=>{const{createdAt:l}=I[i];return e.jsx(Fe,{value:l,locale:o,shouldUpdate:!0})}}}],[I,o,N,r]),$e=[e.jsx(qe,{value:N.dateRange,onChange:X},"date-picker"),e.jsx(Ae,{variant:"contained",size:"small",color:"primary",loading:v,startIcon:e.jsx(zt,{}),onClick:()=>P(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(C,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(rs,{children:e.jsxs(st,{theme:ft(),children:[e.jsx(it,{className:"receivers-table",locale:o,loading:v,columns:ae,data:I,onChange:z,options:Z,customButtons:$e,components:{TableFilterList:i=>e.jsx(Ke,{...i,itemComponent:l=>e.jsx(Ce,{...l,canDelete:()=>!1})})}}),E.anchorEl&&e.jsx(Ee,{open:!!E.anchorEl,anchorReference:"anchorPosition",anchorPosition:E.position,onClose:f,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(ls,{children:[e.jsxs(J,{variant:"body1",component:"div",className:"check-title",children:[D==null?void 0:D.channel," Checking"]}),e.jsx(C,{display:"flex",flexDirection:"column",sx:{gap:"4px"},children:se(D==null?void 0:D.channel).map(i=>{var F,$;const{type:l,pass:c,fail:y}=i;return!(D!=null&&D.result)||(F=D==null?void 0:D.result)!=null&&F[l]?e.jsxs(J,{variant:"body1",component:"div",className:"check-item",display:"flex",alignItems:"center",sx:{gap:"4px",color:($=D==null?void 0:D.result)!=null&&$[l]?je.success.main:"inherit"},children:[D!=null&&D.result?e.jsx(lt,{}):e.jsx(et,{size:12,sx:{color:je.primary.main}}),e.jsx("span",{children:c})]},l):e.jsxs(J,{variant:"body1",component:"div",display:"flex",alignItems:"center",className:"check-item",sx:{gap:"4px",color:je.error.main},children:[e.jsx(ct,{}),e.jsx("span",{children:y})]},l)})})]})}),L.anchorEl&&e.jsx(Ee,{open:!!L.anchorEl,anchorReference:"anchorPosition",anchorPosition:L.position,onClose:p,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(Ue,{loading:n,onCancel:p,onConfirm:b})})]})})})}const os=j.memo(mt),rs=ce.div`
1
+ import{bs as xt,r as j,bF as ee,bi as V,z as Q,E as k,j as e,P as d,T as bt,aQ as Qe,aR as Ze,fD as jt,ay as yt,h as ie,aC as vt,k as Z,N as C,m as te,ed as ke,Q as Pe,kD as Je,bn as Te,aZ as Re,X as Ie,ej as Se,b8 as Ve,b6 as Ee,C as et,n as ce,aU as De,W as St,ax as tt,gg as Fe,B as Ae,dN as st,fZ as je,bv as nt,ak as ue,f9 as Ct,dO as Nt,G as Ge,kE as wt,kF as Tt,D as Rt,kG as It,kH as Et,kI as Dt,kJ as At,bA as at,S as Ot,U as Lt,V as Xe,M as kt,kK as Pt}from"./index-AJgIDgSg.js";import{k as Ft,D as it,g as _t}from"./index-D1Twij0A.js";import{S as he}from"./shorten-label-C5x3QBkr.js";import{I as ot}from"./index-2OI_OVBD.js";import{T as Bt}from"./index-C94nEH1q.js";import{a as _e}from"./actions-R0k2zQ3B.js";import{d as zt}from"./Refresh-CtWiwbL8.js";import{D as Wt,g as Mt}from"./traffic-CmwKqX64.js";import"./TableRow-Cr41eTmp.js";import"./useThemeProps-DI7JqlIy.js";import"./emotion-react.browser.esm-Dyrm_eeQ.js";import"./ViewColumn-CQJvMaMH.js";import"./Search-CzTpAOa9.js";import"./Clear-C23RMA8O.js";import"./Delete-X-iZLu8W.js";import"./index-D2TTRLM_.js";import"./MoreVert-T7jlVzCd.js";import"./TableSearch-DBDA-JAl.js";import"./useLocalStorage-DErQTCC8.js";import"./get-safe-url-DfM7C7Hf.js";import"./ButtonGroup-CETfqQqG.js";import"./getValidReactChildren-q1n8NmWG.js";import"./url-evaluation-CyY2eIYi.js";import"./permission-bQJb4Wfm.js";import"./iframe-DWi9MO_j.js";import"./ChevronLeft-CQJA5jUj.js";import"./ChevronRight-B3ioYqvf.js";import"./index-BLslsStt.js";import"./CardContent-BsBNKLwR.js";import"./AdapterDayjs-Dd7kIQDg.js";import"./CSSTransition-8GXDrEVI.js";import"./refType-Dp49VYzY.js";const rt=j.createContext({}),{Provider:qt,Consumer:Ys}=rt;function Kt({children:t,blocklet:s=""}){const{api:n,inService:r,ws:{useSubscription:o}}=xt(),[a,x]=j.useState([]),[u,R]=j.useState({total:0,pageSize:20,pageCount:0,page:1}),m=ee(()=>{var h;return(h=s.meta)==null?void 0:h.did},[s]),[v,S]=j.useState([]),[I,M]=j.useState({}),E=ee(()=>a.length?new Set(a.map(h=>h.id)):new Set,[a]),L=async({page:h=1,pageSize:O=20,...A}={})=>{if(!m)return[];try{const P={paging:{page:h,pageSize:O},...A,teamDid:m,dateRange:A.dateRange?[V(A.dateRange[0]).toISOString(),V(A.dateRange[1]).toISOString()]:void 0},{dids:B,...q}=P;let J="";B&&B.includes("system")&&(J="system");const z=B?B.filter(f=>f!=="system"):[],oe={...q,source:J,componentDids:z},se=await n.getNotificationSendLog({input:oe});return M(oe),x(se.list),R(se.paging),se.list}catch(P){return Q.error(P.message),[]}},D=async()=>{const h=await n.getNotificationComponents({input:{teamDid:m}});S(h.componentDids)},G=j.useCallback(h=>{const O=s.children.find(A=>{var P;return((P=A.meta)==null?void 0:P.did)===h});if(O)return O.ancestors=[s],O},[s]),U=async({notificationId:h,receivers:O,channels:A,...P})=>{await n.resendNotification({input:{teamDid:m,notificationId:h,receivers:O,channels:A.map(B=>B==="wallet"?k.NOTIFICATION_SEND_CHANNEL.WALLET:B==="pushKit"?k.NOTIFICATION_SEND_CHANNEL.PUSH:B),...P}})},H=j.useCallback(async h=>(await n.getUser({input:{teamDid:m,user:{did:h}}})).user,[n,m]),N=j.useCallback(async({page:h=1,pageSize:O=20,...A}={})=>{try{const P={paging:{page:h,pageSize:O},...A,userName:A.searchText||"",teamDid:m,dateRange:A.dateRange?[V(A.dateRange[0]).toISOString(),V(A.dateRange[1]).toISOString()]:void 0};return await n.getReceivers({input:P})}catch(P){throw Q.error(P.message),P}},[n,m]);j.useEffect(()=>{m&&D()},[m]),o(k.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,h=>{E.has(h.notificationId)&&L(I)},[E,I]),o(k.EVENTS.NOTIFICATION_BLOCKLET_CREATE,h=>{E.has(h.id)||L(I)},[E,I]);const _={fetch:L,data:a,paging:u,blocklet:s,getComponent:G,resendNotification:U,getUser:H,componentDids:v,getReceivers:N,inService:r,teamDid:m};return e.jsx(qt,{value:{notificationRecords:_},children:t})}function Be(){const{notificationRecords:t}=j.useContext(rt);return t}ge.propTypes={severity:d.oneOf(Object.values(["info","success","error","warning"])).isRequired};const Ut={info:"primary",success:"success",error:"error",warning:"warning"};function ge({severity:t="info"}){return e.jsx(bt,{type:Ut[t],children:t})}var ze={},Ht=Ze;Object.defineProperty(ze,"__esModule",{value:!0});var lt=ze.default=void 0,$t=Ht(Qe()),Vt=e;lt=ze.default=(0,$t.default)((0,Vt.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 We={},Gt=Ze;Object.defineProperty(We,"__esModule",{value:!0});var ct=We.default=void 0,Xt=Gt(Qe()),Yt=e;ct=We.default=(0,Xt.default)((0,Yt.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");const Qt=(t,s,n="")=>{if(!n||!s)return"";switch(n){case k.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:s});case k.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:s});case k.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:s});case k.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return n}};function dt(t,s,n={}){const{status:r,updatedAt:o,reason:a="",channel:x="wallet"}=n,u=o?t("notification.sendStatus.sentTime",{date:yt(o,s)}):"",R=Qt(t,x,a);return r===k.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:u,reason:R}:r===k.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:u}:{status:"pending",title:t("notification.sendStatus.pending"),reason:R,sentTime:u}}const Oe={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Le=["wallet","pushKit","email"],Ye=["info","success","error","warning"],ut=t=>{var n,r;const{settings:s}=t;return(r=(n=s==null?void 0:s.notification)==null?void 0:n.email)==null?void 0:r.enabled},pt=t=>{var n,r;const{settings:s}=t;return(r=(n=s==null?void 0:s.notification)==null?void 0:n.pushKit)==null?void 0:r.enabled},Zt=(t,s)=>{const n=ie(s,"extra.notifications.email",!0);return{available:ut(t),enabled:n}},Jt=(t,s)=>{const n=ie(s,"extra.notifications.push",!0);return{available:pt(t),enabled:n}},es=t=>({enabled:ie(t,"extra.notifications.wallet",!0)}),ts=t=>({enabled:ie(t,"extra.webhooks",[]).length>0}),xe=(t=3)=>new Promise(s=>{setTimeout(()=>{s()},t*1e3)}),ss=(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})}]:[],be=(t=[])=>{const s=V().startOf("day");return t.filter(n=>V(n.sendAt).isSame(s,"day")).length},ns=(t,s="")=>{if(s&&Le.includes(s)){const a=`${s}SendRecord`,x=ie(t,a,[]);return be(x)}const n=ie(t,"webhook",{}),r=Object.keys(n??{})??[];if(s&&r.includes(s)){const a=n[s]??[];return be(a)}const o={};return Le.forEach(a=>{const x=`${a}SendRecord`,u=ie(t,x,[]),R=be(u);o[a]=R}),r.length>0&&r.forEach(a=>{const x=n[a]??[],u=be(x);o[a]=u}),o},ye=(t,s,n)=>{if(!Array.isArray(t))throw new Error("Invalid filterList or index");return t[n].splice(s,1),t},ve=(t,s)=>{if(!Array.isArray(s))throw new Error("filters must be an array");return s.length?!s.includes(t):!1},as=t=>{switch(t){case k.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case k.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case k.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case k.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},ft=()=>jt({typography:{fontSize:14,button:{textTransform:"none"}},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 ne({config:t,enableTooltip:s=!0,showTitle:n=!1,children:r}){const{status:o,title:a="",sentTime:x="",reason:u=""}=t,R=[a,u].filter(Boolean).join(", ");return e.jsx(vt,{title:s?e.jsxs(e.Fragment,{children:[e.jsx(Z,{color:"inherit",sx:{fontSize:12},children:R}),e.jsx("span",{children:x})]}):null,arrow:!0,placement:"top",children:e.jsxs(C,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(C,{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center",children:[e.jsx(C,{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Oe[o],style:{opacity:.15}}),e.jsx(C,{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Oe[o]})]}),e.jsx(Z,{color:"inherit",sx:{fontSize:12},children:n?a:r})]})})}ne.propTypes={config:d.object.isRequired,enableTooltip:d.bool,showTitle:d.bool,children:d.node};ne.defaultProps={enableTooltip:!0,showTitle:!1,children:null};pe.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};pe.defaultProps={onDelete:()=>{}};function pe({list:t,label:s,onDelete:n}){const{t:r,locale:o}=te();return e.jsxs(C,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(Z,{children:[s,": "]}),t.map(a=>{const x=dt(r,o,{status:a});return e.jsx(ke,{size:"small",label:e.jsx(C,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(ne,{config:x,enableTooltip:!1,children:x.title})}),onDelete:u=>n(u,a)},a)})]})}Me.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 Me({filterList:t,onChange:s,index:n,column:r,filterValues:o,label:a,renderLabel:x}){return e.jsxs(Pe,{className:"filter-container",children:[e.jsx(Je,{component:"legend",children:a}),e.jsx(Te,{row:!0,children:o.map(u=>e.jsx(Re,{control:e.jsx(Ie,{checked:t[n].indexOf(u.value??u)>-1,onChange:R=>{const m=[...t];R.target.checked?m[n]=[...m[n],u.value??u]:m[n]=m[n].filter(v=>v!==(u.value??u)),s(m[n],n,r)},name:u.value??u}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:x(u)})},u.value??u))})]})}function we(t){return e.jsx(Me,{...t,renderLabel:s=>e.jsx(ne,{enableTooltip:!1,config:{status:s.status},children:s.label})})}de.propTypes={status:d.number.isRequired,updatedAt:d.string.isRequired,reason:d.string,channel:d.string,onResend:d.func};function de({status:t,updatedAt:s,reason:n="",channel:r="wallet",onResend:o}){const{t:a,locale:x}=te(),u=dt(a,x,{status:t,updatedAt:s,reason:n,channel:r});return e.jsxs(C,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(ne,{config:u,showTitle:!0}),u.status!=="success"&&e.jsx(Se,{className:"resend-btn",size:"small",startIcon:e.jsx(_e,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:o,children:a("notification.resend")})]})}qe.propTypes={value:d.array.isRequired,onChange:d.func};function qe({value:t,onChange:s}){const{locale:n}=te(),r=V().toDate(),[o,a]=j.useState(null),x=j.useCallback(m=>{a(o?null:m.currentTarget)},[o]),u=!!o,R=j.useCallback(m=>{if(!m.startDate||!m.endDate){Q.error("Please select a date range");return}if(V(m.startDate).isAfter(m.endDate)||!V(m.startDate).isValid()||!V(m.endDate).isValid()){Q.error("Invalid date range");return}s([m.startDate,m.endDate]),a(null)},[s]);return e.jsxs("div",{children:[e.jsx(Z,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:0,children:e.jsxs(Se,{onClick:x,variant:"outlined",size:"small",color:"inherit",children:[Ve(t[0],n)," - ",Ve(t[1],n)]})}),e.jsx(Ee,{open:u,anchorEl:o,onClose:()=>{a(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(Wt,{open:!0,maxDate:r,initialDateRange:{startDate:t[0],endDate:t[1]},toggle:x,definedRanges:Mt(r),onChange:R})})]})}Ke.propTypes={itemComponent:d.elementType.isRequired};function Ke({itemComponent:t,...s}){var o;const{t:n}=te();return!((o=s==null?void 0:s.filterList)!=null&&o.filter(a=>a.length).length)?null:e.jsxs(C,{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 Ce({label:t,onDelete:s,canDelete:n=()=>!0,...r}){const o=s&&typeof s=="function"?s:void 0;let a=!0;return n&&typeof n=="function"&&(a=n({label:t,...r})),e.jsx(ke,{label:t,variant:"outlined",...o&&a?{onDelete:o}:{}})}Ce.propTypes={label:d.string.isRequired,onDelete:d.func,canDelete:d.func};Ce.defaultProps={canDelete:()=>!0};const is=[{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}];Ue.propTypes={loading:d.bool,onCancel:d.func,onConfirm:d.func};Ue.defaultProps={loading:!1,onCancel:()=>{},onConfirm:()=>{}};function Ue({loading:t=!1,onCancel:s,onConfirm:n}){const{t:r}=te(),[o,a]=j.useState(is),[x,u]=j.useState(!0),R=(v,S)=>{S.checked=v.target.checked;const I=o.map(M=>({...M,checked:M.value===S.value?S.checked:M.checked}));a(I)},m=v=>{v.stopPropagation(),n({channels:o.filter(S=>S.checked).map(S=>S.value),isResendFailedOnly:x})};return e.jsxs(C,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(Z,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(C,{className:"choose-channel",children:e.jsxs(Pe,{component:"fieldset",variant:"standard",children:[e.jsx(Je,{component:"legend",children:r("notification.selectChannels")}),e.jsx(Te,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:o.map(v=>e.jsx(Re,{control:e.jsx(Ie,{checked:v.checked,onChange:S=>R(S,v),name:v.value}),label:v.label},v.value))})]})}),e.jsx(C,{className:"resend-config-footer",children:e.jsx(Te,{children:e.jsx(Re,{control:e.jsx(Ie,{checked:x,onChange:v=>u(v.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(C,{display:"flex",justifyContent:"flex-end",gap:1,className:"resend-config-footer-tip",children:[e.jsx(Se,{onClick:v=>{v.stopPropagation(),s()},color:"inherit",children:r("common.cancel")}),e.jsxs(Se,{onClick:m,color:"primary",disabled:t,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[t&&e.jsx(et,{size:16}),r("common.confirm")]})]})]})}mt.propTypes={notificationId:d.string.isRequired,handleResend:d.func,resending:d.bool};function mt({notificationId:t,handleResend:s,resending:n=!1}){const{t:r,locale:o}=te(),{getReceivers:a,inService:x,teamDid:u,getUser:R,blocklet:m}=Be(),[v,S]=j.useState(!1),[I,M]=j.useState([]),E=De({anchorEl:null,position:null}),L=De({anchorEl:null,position:null}),[D,G]=j.useState(null),[U,H]=j.useState({total:0,pageSize:10,pageCount:0,page:1}),[N,_]=j.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[V().subtract(1,"month").startOf("day").toDate(),V().endOf("day").toDate()]}),[h,O]=j.useState([]),A=[{label:r("notification.sendStatus.pending"),value:0,status:"pending"},{label:r("notification.sendStatus.success"),value:1,status:"success"},{label:r("notification.sendStatus.failed"),value:2,status:"failed"}],P=async()=>{if(!v&&t)try{S(!0);const i=await a({notificationId:t,...N}),l=i.list.map(c=>({...c,receiverUser:{...c.receiverUser,avatar:nt(c.receiverUser.avatar,u,x)}}));M(l),H(i.paging),S(!1)}catch(i){Q.error(i.message),S(!1)}};j.useEffect(()=>{P()},[N]);const B=i=>{i.stopPropagation();const l=i.currentTarget;L.anchorEl=l;const c=l.getBoundingClientRect();L.position={top:c.top+window.scrollY,left:c.left+window.scrollX}},q=i=>i.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(_e,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:B,children:r("notification.resend")})}):null,J={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:U.page-1,rowsPerPage:U.pageSize,count:U.total,searchText:N.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:h,onRowSelectionChange:(i,l)=>{O(l.map(c=>c.dataIndex))},customToolbarSelect:q},z=({page:i,rowsPerPage:l,searchText:c,filterList:y})=>{const[,F=[],$=[],K=[]]=y;N.pageSize!==l?_(W=>({...W,pageSize:l,page:1})):N.page!==i+1?_(W=>({...W,page:i+1})):N.searchText!==c?_(W=>({...W,searchText:c,page:1})):ue(F,N.walletSendStatus)?ue($,N.pushKitSendStatus)?ue(K,N.emailSendStatus)||_(W=>({...W,emailSendStatus:K,page:1})):_(W=>({...W,pushKitSendStatus:$,page:1})):_(W=>({...W,walletSendStatus:F,page:1}))},oe=j.useCallback(async(i,l)=>{if(!l)return!1;const c=await R(l);return c?i==="wallet"?es(c):i==="email"?Zt(m,c):i==="pushKit"?Jt(m,c):i==="webhook"?ts(c):!0:!1},[R,m]),se=j.useCallback(i=>ss(r,i),[r]),f=()=>{E.anchorEl=null,E.position=null,G(null)},p=()=>{L.anchorEl=null,L.position=null},g=async(i,l,c=!0,y="")=>{if(!(!l.length||!i.length))try{s(i,l,c,y),L.anchorEl||(await xe(.5),f())}catch(F){console.error("handleResend error",{error:F})}},b=async({channels:i,isResendFailedOnly:l})=>{const c=h.map(y=>I[y].receiver);await g(i,c,l),await xe(.5),p(),O([])},T=async(i,l=[],c=!0)=>{try{await g(["webhook"],[i.receiver],c,l)}catch(y){Q.error(y.response?y.response.statusText:y.message)}},w=async(i,l,c,y=[],F=!0)=>{if(i.stopPropagation(),ns(l,c)>=4){Q.warning(r("notification.resendLimit"));return}if(!Le.includes(c)){await T(l,y,F);return}if(i){const K=i.currentTarget,W=K.getBoundingClientRect();E.anchorEl=K,E.position={top:W.top+window.scrollY,left:W.left+window.scrollX}}G({channel:c});try{const K=await oe(c,l.receiver);await xe(1),G({channel:c,result:K}),(typeof K=="boolean"&&K||Ct(K)&&Object.values(K).every(W=>!!W))&&(await s([c],[l.receiver],F),L.anchorEl||(await xe(.5),f()))}catch(K){Q.error(K.message)}},X=i=>{_(l=>({...l,dateRange:i,page:1}))},Y=(i,l,c,y)=>{i.stopPropagation();const F=c.filter($=>$!==l);_($=>({...$,[y]:F,page:1}))},ae=ee(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:i=>{const{receiverUser:l,receiver:c}=I[i];return l?e.jsxs(C,{"data-cy":`member-name-${l.fullName}`,display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start",children:[e.jsx(tt,{src:`${l.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:c,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(he,{children:l.fullName})]},c):e.jsx(St,{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:N.walletSendStatus??[],customFilterListOptions:{render:i=>e.jsx(pe,{list:i,label:"Wallet",onDelete:(l,c)=>{l.stopPropagation(),Y(l,c,ae[1].options.filterList,"walletSendStatus")}}),update:ye},filterOptions:{names:A,fullWidth:!0,logic:ve,display:(i,l,c,y)=>e.jsx(we,{label:"Wallet",filterList:i,onChange:l,index:c,column:y,filterValues:A})},customBodyRenderLite:i=>{const{walletSendStatus:l,walletSendAt:c,walletSendFailedReason:y}=I[i];return e.jsx(de,{status:l,updatedAt:c,reason:y,channel:"wallet",onResend:F=>w(F,I[i],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:i=>{const{pushKitSendStatus:l,pushKitSendAt:c,pushKitSendFailedReason:y}=I[i];return e.jsx(de,{status:l,updatedAt:c,reason:y,channel:"pushkit",onResend:F=>w(F,I[i],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:N.pushKitSendStatus??[],customFilterListOptions:{render:i=>e.jsx(pe,{list:i,label:"Push Kit",onDelete:(l,c)=>{l.stopPropagation(),Y(l,c,ae[2].options.filterList,"pushKitSendStatus")}}),update:ye},filterOptions:{names:A,fullWidth:!0,logic:ve,display:(i,l,c,y)=>e.jsx(we,{label:"Push Kit",filterList:i,onChange:l,index:c,column:y,filterValues:A})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:i=>{const{emailSendStatus:l,emailSendAt:c,emailSendFailedReason:y}=I[i];return e.jsx(de,{status:l,updatedAt:c,reason:y,channel:"email",onResend:F=>w(F,I[i],"email",[],!1)})},filter:!0,filterType:"custom",filterList:N.emailSendStatus??[],customFilterListOptions:{render:i=>e.jsx(pe,{list:i,label:"Email",onDelete:(l,c)=>{l.stopPropagation(),Y(l,c,ae[3].options.filterList,"emailSendStatus")}}),update:ye},filterOptions:{names:A,fullWidth:!0,logic:ve,display:(i,l,c,y)=>e.jsx(we,{label:"Email",filterList:i,onChange:l,index:c,column:y,filterValues:A})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:i=>{const{webhook:l}=I[i];if(!l)return null;const c=Object.entries(l)[0];if(!c)return null;const[y,F]=c,$=F[0];return e.jsx(C,{display:"flex",flexDirection:"column",gap:1,children:e.jsxs(C,{className:"webhook-item",fontSize:12,children:[e.jsx(he,{maxLength:30,children:y},y),e.jsx(de,{status:$.status,updatedAt:$.sendAt,reason:$.failedReason,channel:"webhook",onResend:K=>w(K,I[i],"webhook",[y],!1)})]},y)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:i=>{const{createdAt:l}=I[i];return e.jsx(Fe,{value:l,locale:o,shouldUpdate:!0})}}}],[I,o,N,r]),$e=[e.jsx(qe,{value:N.dateRange,onChange:X},"date-picker"),e.jsx(Ae,{variant:"contained",size:"small",color:"primary",loading:v,startIcon:e.jsx(zt,{}),onClick:()=>P(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(C,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(rs,{children:e.jsxs(st,{theme:ft(),children:[e.jsx(it,{className:"receivers-table",locale:o,loading:v,columns:ae,data:I,onChange:z,options:J,customButtons:$e,components:{TableFilterList:i=>e.jsx(Ke,{...i,itemComponent:l=>e.jsx(Ce,{...l,canDelete:()=>!1})})}}),E.anchorEl&&e.jsx(Ee,{open:!!E.anchorEl,anchorReference:"anchorPosition",anchorPosition:E.position,onClose:f,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(ls,{children:[e.jsxs(Z,{variant:"body1",component:"div",className:"check-title",children:[D==null?void 0:D.channel," Checking"]}),e.jsx(C,{display:"flex",flexDirection:"column",sx:{gap:"4px"},children:se(D==null?void 0:D.channel).map(i=>{var F,$;const{type:l,pass:c,fail:y}=i;return!(D!=null&&D.result)||(F=D==null?void 0:D.result)!=null&&F[l]?e.jsxs(Z,{variant:"body1",component:"div",className:"check-item",display:"flex",alignItems:"center",sx:{gap:"4px",color:($=D==null?void 0:D.result)!=null&&$[l]?je.success.main:"inherit"},children:[D!=null&&D.result?e.jsx(lt,{}):e.jsx(et,{size:12,sx:{color:je.primary.main}}),e.jsx("span",{children:c})]},l):e.jsxs(Z,{variant:"body1",component:"div",display:"flex",alignItems:"center",className:"check-item",sx:{gap:"4px",color:je.error.main},children:[e.jsx(ct,{}),e.jsx("span",{children:y})]},l)})})]})}),L.anchorEl&&e.jsx(Ee,{open:!!L.anchorEl,anchorReference:"anchorPosition",anchorPosition:L.position,onClose:p,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(Ue,{loading:n,onCancel:p,onConfirm:b})})]})})})}const os=j.memo(mt),rs=ce.div`
2
2
  td.MuiTableCell-footer {
3
3
  border: none !important;
4
4
  }
@@ -27,7 +27,7 @@ import{bs as xt,r as j,bF as ee,bi as V,z as Q,E as k,j as e,P as d,T as bt,aQ a
27
27
  }
28
28
  font-size: 12px;
29
29
  }
30
- `,fe=t=>t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t;function cs(t){const{wallet:s,push:n,email:r,webhook:o}=t;return[{name:"Wallet",value:e.jsx(re,{item:s})},{name:"Push",value:e.jsx(re,{item:n})},{name:"Email",value:e.jsx(re,{item:r})},...o.total>0?[{name:"Webhook",value:e.jsx(re,{item:o,isWebhook:!0})}]:[]]}function ds(t,s,n){const{wallet:r,push:o,email:a,webhook:x}=t;return[{name:"Wallet",value:e.jsx(le,{loading:n,channel:k.NOTIFICATION_SEND_CHANNEL.WALLET,item:r,onResend:s})},{name:"Push",value:e.jsx(le,{loading:n,channel:k.NOTIFICATION_SEND_CHANNEL.PUSH,item:o,onResend:s})},{name:"Email",value:e.jsx(le,{loading:n,channel:k.NOTIFICATION_SEND_CHANNEL.EMAIL,item:a,onResend:s})},...x.total>0?[{name:"Webhook",value:e.jsx(le,{loading:n,channel:k.NOTIFICATION_SEND_CHANNEL.WEBHOOK,item:x,isWebhook:!0,onResend:s})}]:[]]}Ne.propTypes={statistics:d.object.isRequired,onResend:d.func,mode:d.oneOf(["simple","detail"]),resending:d.bool};Ne.defaultProps={mode:"simple",onResend:()=>{},resending:!1};re.propTypes={item:d.object.isRequired,isWebhook:d.bool};re.defaultProps={isWebhook:!1};function re({item:t,isWebhook:s=!1}){const{t:n}=te(),r=s?t.success.length:t.success,o=t.total,a=r===o?"success":"failed";return e.jsx(C,{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:2,children:e.jsx(C,{display:"flex",alignItems:"center",gap:1,children:e.jsxs(ne,{config:{status:a},enableTooltip:!1,children:[fe(r)," / ",fe(o)," ",n("notification.sendStatus.success")]})})})}le.propTypes={item:d.object.isRequired,isWebhook:d.bool,channel:d.string,onResend:d.func,loading:d.bool};le.defaultProps={isWebhook:!1,channel:k.NOTIFICATION_SEND_CHANNEL.WALLET,onResend:()=>{},loading:!1};function le({channel:t,item:s,isWebhook:n=!1,onResend:r,loading:o}){const{t:a}=te(),{success:x,failed:u,pending:R}=s,m=as(t),v=n?x.length:x,S=n?u.length:u,I=n?R.length:R,M=async G=>{G.stopPropagation();const U=n?[...new Set([...x,...u].map(H=>H))]:[];await r([t],[],!0,U)},E=v+S,L=E>0?v/E*100:0,D=E>0?S/E*100:0;return e.jsxs(us,{successRatio:L,failedRatio:D,children:[e.jsxs(J,{variant:"h6",children:[m," (",s.total,")"]}),e.jsxs(J,{variant:"body1",sx:{mb:2},children:[e.jsx("span",{style:{color:Oe.success,fontWeight:600,fontSize:24},children:fe(v)}),e.jsx("small",{style:{paddingLeft:4},children:a("notification.sendStatus.success")})]}),e.jsxs(C,{className:"unsent-area",children:[e.jsxs(C,{children:[e.jsxs(ne,{config:{status:"failed"},enableTooltip:!1,children:[fe(S)," ",a("notification.sendStatus.failed")]}),e.jsxs(ne,{config:{status:"pending"},enableTooltip:!1,children:[fe(I)," ",a("notification.sendStatus.pending")]})]}),S>0&&e.jsx(C,{className:"resend-btn",children:e.jsx(Ae,{size:"small",color:"primary",loading:o,variant:"contained",startIcon:e.jsx(_e,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:M,children:a("notification.resend")})})]})]})}function Ne({statistics:t,mode:s="simple",onResend:n,resending:r}){const o=ee(()=>s==="simple"?cs(t):ds(t,n,r),[t,s]);return s==="simple"?e.jsx("div",{children:o.map(a=>e.jsx(ot,{style:{alignItems:"flex-start",marginBottom:s==="simple"?0:16},valueComponent:"div",nameWidth:100,name:a.name,children:a.value},a.name))}):e.jsx(Ge,{container:!0,spacing:2,children:o.map(a=>e.jsx(Ge,{item:!0,md:4,sm:6,xs:12,children:a.value},a.name))})}const us=ce(C)`
30
+ `,fe=t=>t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t;function cs(t){const{wallet:s,push:n,email:r,webhook:o}=t;return[{name:"Wallet",value:e.jsx(re,{item:s})},{name:"Push",value:e.jsx(re,{item:n})},{name:"Email",value:e.jsx(re,{item:r})},...o.total>0?[{name:"Webhook",value:e.jsx(re,{item:o,isWebhook:!0})}]:[]]}function ds(t,s,n){const{wallet:r,push:o,email:a,webhook:x}=t;return[{name:"Wallet",value:e.jsx(le,{loading:n,channel:k.NOTIFICATION_SEND_CHANNEL.WALLET,item:r,onResend:s})},{name:"Push",value:e.jsx(le,{loading:n,channel:k.NOTIFICATION_SEND_CHANNEL.PUSH,item:o,onResend:s})},{name:"Email",value:e.jsx(le,{loading:n,channel:k.NOTIFICATION_SEND_CHANNEL.EMAIL,item:a,onResend:s})},...x.total>0?[{name:"Webhook",value:e.jsx(le,{loading:n,channel:k.NOTIFICATION_SEND_CHANNEL.WEBHOOK,item:x,isWebhook:!0,onResend:s})}]:[]]}Ne.propTypes={statistics:d.object.isRequired,onResend:d.func,mode:d.oneOf(["simple","detail"]),resending:d.bool};Ne.defaultProps={mode:"simple",onResend:()=>{},resending:!1};re.propTypes={item:d.object.isRequired,isWebhook:d.bool};re.defaultProps={isWebhook:!1};function re({item:t,isWebhook:s=!1}){const{t:n}=te(),r=s?t.success.length:t.success,o=t.total,a=r===o?"success":"failed";return e.jsx(C,{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:2,children:e.jsx(C,{display:"flex",alignItems:"center",gap:1,children:e.jsxs(ne,{config:{status:a},enableTooltip:!1,children:[fe(r)," / ",fe(o)," ",n("notification.sendStatus.success")]})})})}le.propTypes={item:d.object.isRequired,isWebhook:d.bool,channel:d.string,onResend:d.func,loading:d.bool};le.defaultProps={isWebhook:!1,channel:k.NOTIFICATION_SEND_CHANNEL.WALLET,onResend:()=>{},loading:!1};function le({channel:t,item:s,isWebhook:n=!1,onResend:r,loading:o}){const{t:a}=te(),{success:x,failed:u,pending:R}=s,m=as(t),v=n?x.length:x,S=n?u.length:u,I=n?R.length:R,M=async G=>{G.stopPropagation();const U=n?[...new Set([...x,...u].map(H=>H))]:[];await r([t],[],!0,U)},E=v+S,L=E>0?v/E*100:0,D=E>0?S/E*100:0;return e.jsxs(us,{successRatio:L,failedRatio:D,children:[e.jsxs(Z,{variant:"h6",children:[m," (",s.total,")"]}),e.jsxs(Z,{variant:"body1",sx:{mb:2},children:[e.jsx("span",{style:{color:Oe.success,fontWeight:600,fontSize:24},children:fe(v)}),e.jsx("small",{style:{paddingLeft:4},children:a("notification.sendStatus.success")})]}),e.jsxs(C,{className:"unsent-area",children:[e.jsxs(C,{children:[e.jsxs(ne,{config:{status:"failed"},enableTooltip:!1,children:[fe(S)," ",a("notification.sendStatus.failed")]}),e.jsxs(ne,{config:{status:"pending"},enableTooltip:!1,children:[fe(I)," ",a("notification.sendStatus.pending")]})]}),S>0&&e.jsx(C,{className:"resend-btn",children:e.jsx(Ae,{size:"small",color:"primary",loading:o,variant:"contained",startIcon:e.jsx(_e,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:M,children:a("notification.resend")})})]})]})}function Ne({statistics:t,mode:s="simple",onResend:n,resending:r}){const o=ee(()=>s==="simple"?cs(t):ds(t,n,r),[t,s]);return s==="simple"?e.jsx("div",{children:o.map(a=>e.jsx(ot,{style:{alignItems:"flex-start",marginBottom:s==="simple"?0:16},valueComponent:"div",nameWidth:100,name:a.name,children:a.value},a.name))}):e.jsx(Ge,{container:!0,spacing:2,children:o.map(a=>e.jsx(Ge,{item:!0,md:4,sm:6,xs:12,children:a.value},a.name))})}const us=ce(C)`
31
31
  display: flex;
32
32
  flex-direction: column;
33
33
  align-items: flex-start;
@@ -45,7 +45,7 @@ import{bs as xt,r as j,bF as ee,bi as V,z as Q,E as k,j as e,P as d,T as bt,aQ a
45
45
  bottom: 0;
46
46
  }
47
47
  }
48
- `;ht.propTypes={notification:d.object.isRequired,onCancel:d.func,blocklet:d.object.isRequired,tab:d.string};function ht({notification:t,onCancel:s=()=>{},blocklet:n,tab:r="info"}){const{t:o,locale:a}=te(),{getComponent:x,resendNotification:u}=Be(),[R,m]=j.useState(!1),v=ee(()=>x(t.componentDid)||n,[n,t.componentDid]),S=De({tab:r||"info"}),I=j.useCallback(async(h,O,A=!0,P=[])=>{var Z;if(!h.length||!t.id)return;const B=O.length>0?O:(Z=t==null?void 0:t.receivers)==null?void 0:Z.map(z=>z.receiver);if(!B.length)return;let q=[...h];if(q.includes(k.NOTIFICATION_SEND_CHANNEL.PUSH)&&!pt(n)&&(Q.warning(o("notification.sendStatus.reason.unavailable",{channel:"Push Kit"})),q=q.filter(z=>z!==k.NOTIFICATION_SEND_CHANNEL.PUSH)),q.includes(k.NOTIFICATION_SEND_CHANNEL.EMAIL)&&!ut(n)&&(Q.warning(o("notification.sendStatus.reason.unavailable",{channel:"Email"})),q=q.filter(z=>z!==k.NOTIFICATION_SEND_CHANNEL.EMAIL)),!!q.length)try{m(!0),await u({notificationId:t.id,receivers:B,channels:q,resendFailedOnly:A,...q.includes("webhook")&&P.length?{webhookUrls:P}:{}}),Q.success("Message has been sent!")}catch(z){console.error("handleResend error",{error:z}),Q.error(z.response?z.response.statusText:z.message)}finally{m(!1)}},[n,t.id,t==null?void 0:t.receivers,u,o]),M=ee(()=>wt(t),[t]),E=ee(()=>Tt(t),[t]),L=ee(()=>M?t==null?void 0:t.actorInfo:[],[t]),D=ee(()=>{var h;return(n==null?void 0:n.did)||((h=n==null?void 0:n.meta)==null?void 0:h.did)||""},[n]);function G(){return[{name:o("notification.from"),value:M&&E?e.jsx(It,{actors:L,teamDid:D,size:32,showName:!0}):e.jsx(Et,{size:32,blocklet:v,showName:!0,hideDot:!0})},{name:o("notification.notificationTitle"),value:e.jsx(he,{maxLength:50,children:t.title})},{name:o("notification.body"),value:M?e.jsx(Dt,{notification:t,blocklet:n}):e.jsx(At,{notification:t,rows:0})},{name:o("notification.severity"),value:e.jsx(ge,{severity:t.severity})},{name:o("notification.createdAt"),value:e.jsx(Fe,{value:t.createdAt,locale:a,shouldUpdate:!0})}].map(O=>e.jsx(ot,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:120,name:O.name,children:O.value},O.name))}const U={info:{label:o("common.basicInfo"),value:"info",component:G},receivers:{label:o("notification.receiver"),value:"receivers"},statistics:{label:o("notification.statistics"),value:"statistics"}},H=Object.values(U).map(({label:h,value:O})=>({label:h,value:O})),N=U[S.tab]||U.info,_=h=>{S.tab=h};return e.jsx(Rt,{title:o("notification.notificationDetails"),fullWidth:!0,maxWidth:"lg",onClose:()=>{S.tab="info",s()},open:!0,actionsPosition:"left",sx:{".ux-dialog_header":{paddingBottom:0},".MuiDialogContent-root":{paddingTop:0}},children:e.jsxs(fs,{children:[e.jsx(C,{mx:3,className:"tabs",children:e.jsx(Bt,{tabs:H,current:S.tab,onChange:_,scrollButtons:"auto"})}),e.jsxs("div",{className:"body",children:[S.tab==="receivers"&&e.jsx(os,{notificationId:t.id,resending:R,handleResend:I}),S.tab==="statistics"&&e.jsx(Ne,{statistics:t.statistics,mode:"detail",resending:R,onResend:I}),S.tab==="info"&&e.jsx(N.component,{})]})]})})}const ps=j.memo(ht),fs=ce.div`
48
+ `;ht.propTypes={notification:d.object.isRequired,onCancel:d.func,blocklet:d.object.isRequired,tab:d.string};function ht({notification:t,onCancel:s=()=>{},blocklet:n,tab:r="info"}){const{t:o,locale:a}=te(),{getComponent:x,resendNotification:u}=Be(),[R,m]=j.useState(!1),v=ee(()=>x(t.componentDid)||n,[n,t.componentDid]),S=De({tab:r||"info"}),I=j.useCallback(async(h,O,A=!0,P=[])=>{var J;if(!h.length||!t.id)return;const B=O.length>0?O:(J=t==null?void 0:t.receivers)==null?void 0:J.map(z=>z.receiver);if(!B.length)return;let q=[...h];if(q.includes(k.NOTIFICATION_SEND_CHANNEL.PUSH)&&!pt(n)&&(Q.warning(o("notification.sendStatus.reason.unavailable",{channel:"Push Kit"})),q=q.filter(z=>z!==k.NOTIFICATION_SEND_CHANNEL.PUSH)),q.includes(k.NOTIFICATION_SEND_CHANNEL.EMAIL)&&!ut(n)&&(Q.warning(o("notification.sendStatus.reason.unavailable",{channel:"Email"})),q=q.filter(z=>z!==k.NOTIFICATION_SEND_CHANNEL.EMAIL)),!!q.length)try{m(!0),await u({notificationId:t.id,receivers:B,channels:q,resendFailedOnly:A,...q.includes("webhook")&&P.length?{webhookUrls:P}:{}}),Q.success("Message has been sent!")}catch(z){console.error("handleResend error",{error:z}),Q.error(z.response?z.response.statusText:z.message)}finally{m(!1)}},[n,t.id,t==null?void 0:t.receivers,u,o]),M=ee(()=>wt(t),[t]),E=ee(()=>Tt(t),[t]),L=ee(()=>M?t==null?void 0:t.actorInfo:[],[t]),D=ee(()=>{var h;return(n==null?void 0:n.did)||((h=n==null?void 0:n.meta)==null?void 0:h.did)||""},[n]);function G(){return[{name:o("notification.from"),value:M&&E?e.jsx(It,{actors:L,teamDid:D,size:32,showName:!0}):e.jsx(Et,{size:32,blocklet:v,showName:!0,hideDot:!0})},{name:o("notification.notificationTitle"),value:e.jsx(he,{maxLength:50,children:t.title})},{name:o("notification.body"),value:M?e.jsx(Dt,{notification:t,blocklet:n}):e.jsx(At,{notification:t,rows:0})},{name:o("notification.severity"),value:e.jsx(ge,{severity:t.severity})},{name:o("notification.createdAt"),value:e.jsx(Fe,{value:t.createdAt,locale:a,shouldUpdate:!0})}].map(O=>e.jsx(ot,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:120,name:O.name,children:O.value},O.name))}const U={info:{label:o("common.basicInfo"),value:"info",component:G},receivers:{label:o("notification.receiver"),value:"receivers"},statistics:{label:o("notification.statistics"),value:"statistics"}},H=Object.values(U).map(({label:h,value:O})=>({label:h,value:O})),N=U[S.tab]||U.info,_=h=>{S.tab=h};return e.jsx(Rt,{title:o("notification.notificationDetails"),fullWidth:!0,maxWidth:"lg",onClose:()=>{S.tab="info",s()},open:!0,actionsPosition:"left",sx:{".ux-dialog_header":{paddingBottom:0},".MuiDialogContent-root":{paddingTop:0}},children:e.jsxs(fs,{children:[e.jsx(C,{mx:3,className:"tabs",children:e.jsx(Bt,{tabs:H,current:S.tab,onChange:_,scrollButtons:"auto"})}),e.jsxs("div",{className:"body",children:[S.tab==="receivers"&&e.jsx(os,{notificationId:t.id,resending:R,handleResend:I}),S.tab==="statistics"&&e.jsx(Ne,{statistics:t.statistics,mode:"detail",resending:R,onResend:I}),S.tab==="info"&&e.jsx(N.component,{})]})]})})}const ps=j.memo(ht),fs=ce.div`
49
49
  & > .notification-row {
50
50
  padding: 0;
51
51
  }
@@ -92,7 +92,7 @@ import{bs as xt,r as j,bF as ee,bi as V,z as Q,E as k,j as e,P as d,T as bt,aQ a
92
92
  overflow: hidden;
93
93
  text-overflow: ellipsis;
94
94
  }
95
- `;function me({blocklet:t,label:s}){var n;return e.jsx(ms,{children:t?e.jsxs(e.Fragment,{children:[e.jsx(at,{size:24,blocklet:t,ancestors:t.ancestors}),e.jsx("span",{className:"name",children:t.title||((n=t.meta)==null?void 0:n.title)})]}):e.jsx("span",{className:"name",children:s})})}He.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};He.defaultProps={onDelete:()=>{}};function He({list:t,label:s,onDelete:n}){return e.jsxs(C,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(J,{children:[s,": "]}),t.map(r=>e.jsx(ke,{size:"small",label:e.jsx(C,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(ge,{severity:r})}),onDelete:o=>n(o,r)},r))]})}function hs(t){return e.jsx(Me,{...t,renderLabel:s=>e.jsx(ge,{severity:s})})}function gs({customTableButtons:t}){var se;const{t:s,locale:n}=te(),[r,o]=j.useState(!1),{data:a,paging:x,blocklet:u,fetch:R,getComponent:m,componentDids:v,inService:S,teamDid:I}=Be(),M=j.useRef(null),[E,L]=j.useState(null),[D,G]=j.useState("info"),U=`notification-records-${(se=u.meta)==null?void 0:se.did}`,H=_t(U),[N,_]=j.useState({pageSize:H.rowsPerPage||10,page:H.page?H.page+1:1,dids:H.dids||[],dateRange:H.dateRange||[V().subtract(1,"month").startOf("day").toDate(),V().endOf("day").toDate()]}),h=ee(()=>{if(!u.children||!u.children.length)return[];const f=[];return u.children.forEach(p=>{var b;const g=p.did||((b=p.meta)==null?void 0:b.did);v.includes(g)&&(p.ancestors=[u],f.push(p))}),f},[v,u]),O=async f=>{try{o(!0),await R(f),o(!1)}finally{o(!1)}};j.useEffect(()=>{O(N)},[N]),j.useEffect(()=>{const f=a.find(p=>p.id===(E==null?void 0:E.id));E&&f&&L({...f})},[a]);const A=(f,p,g,b)=>{f.stopPropagation();const T=g.filter(w=>w!==p);_(w=>({...w,[b]:T,page:1}))},P=({page:f,rowsPerPage:p,filterList:g})=>{const[b=[],,,,T=[]]=g;N.pageSize!==p?_(w=>({...w,pageSize:p,page:1})):N.page!==f+1?_(w=>({...w,page:f+1})):ue(N.dids,b)?ue(N.severities,T)||_(w=>({...w,severities:T,page:1})):_(w=>({...w,dids:b,page:1}))},B=j.useCallback(()=>{L(null),G("info")},[]),q=j.useCallback(()=>{R(N)},[R,N]),Z=[{label:s("notification.from"),name:"sender",width:400,options:{filter:!0,filterType:"custom",customFilterListOptions:{render:f=>f.map((p,g)=>{var T;if(p==="system")return e.jsx("span",{children:s("notification.system")},`system-${g}`);const b=h.find(w=>{var Y;return(w.did||((Y=w.meta)==null?void 0:Y.did))===p});return e.jsx(me,{blocklet:b,label:(b==null?void 0:b.title)||((T=b==null?void 0:b.meta)==null?void 0:T.title)},p)}),update:(f,p,g)=>(f[g].splice(p,1),f)},filterOptions:{names:h,logic:(f,p)=>p.length?!p.includes(f):!1,display:(f,p,g,b)=>e.jsxs(Pe,{style:{width:"380px"},children:[e.jsx(Ot,{id:"demo-simple-select-label",style:{background:"#ffffff"},children:"Sender"}),e.jsxs(Lt,{multiple:!0,value:f[g],renderValue:T=>e.jsx(C,{display:"flex",gap:1,alignItems:"center",style:{overflow:"hidden",textOverflow:"ellipsis"},children:T.map(w=>{var Y;if(w==="system")return e.jsx("span",{children:s("notification.system")},w);const X=h.find(ae=>{var i;return(ae.did||((i=ae.meta)==null?void 0:i.did))===w});return e.jsx(me,{blocklet:X,label:(X==null?void 0:X.title)||((Y=X==null?void 0:X.meta)==null?void 0:Y.title)},w)})}),onChange:T=>{f[g]=T.target.value,p(f[g],g,b)},children:[e.jsx(Xe,{value:"system",children:s("notification.system")}),h.map(T=>{var X,Y;const w=T.did||((X=T.meta)==null?void 0:X.did);return e.jsx(Xe,{value:w,children:e.jsx(me,{blocklet:T,label:T.title||((Y=T.meta)==null?void 0:Y.title)})},w)})]})]})},customBodyRenderLite:f=>{var b,T;const p=a[f],g=m(p.componentDid);return e.jsxs(C,{display:"flex",alignItems:"center",gap:1,children:[g?e.jsx(at,{size:32,blocklet:g,ancestors:g.ancestors??[]}):e.jsx(kt,{blocklet:u,size:32}),e.jsx(he,{maxLength:50,children:((b=g==null?void 0:g.meta)==null?void 0:b.title)||((T=u==null?void 0:u.meta)==null?void 0:T.title)})]})}}},{label:s("notification.receiver"),name:"receivers",width:300,options:{filter:!1,customBodyRenderLite:f=>{const p=a[f],{receivers:g}=p;return e.jsx(Pt,{total:g.length,renderSurplus:b=>b<100?e.jsxs("span",{children:["+",b]}):e.jsx("span",{children:"99+"}),max:3,sx:{justifyContent:"flex-end",height:"32px",".MuiAvatar-root":{width:"32px",height:"32px",fontSize:"12px",border:0,zIndex:2}},onClick:b=>{b.stopPropagation(),L(p),G("receivers")},children:g.map(b=>{const{receiverUser:T}=b,w=nt(T.avatar,I,S);return e.jsx(tt,{alt:T.fullName,src:`${w}?imageFilter=resize&w=48&h=48`,size:32,did:b.receiver,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}},b.receiver)})})}}},{label:s("notification.statistics"),name:"statistics",width:400,options:{filter:!1,customBodyRenderLite:f=>{const p=a[f];return e.jsx(C,{onClick:g=>{g.stopPropagation(),L(p),G("statistics")},children:e.jsx(Ne,{statistics:p.statistics})})}}},{label:s("notification.notificationPreview"),name:"data",options:{filter:!1,customBodyRenderLite:f=>{const p=a[f];return e.jsx(he,{maxLength:50,children:p.title})}}},{label:s("notification.severity"),name:"severity",width:200,options:{setCellProps:()=>({className:"severity-cell"}),customBodyRenderLite:f=>{const p=a[f];return e.jsx(ge,{severity:p.severity})},filter:!0,filterType:"custom",filterList:N.severities??[],customFilterListOptions:{render:f=>e.jsx(He,{list:f,label:s("notification.severity"),onDelete:(p,g)=>{p.stopPropagation(),A(p,g,Z[4].options.filterList,"severities")}}),update:ye},filterOptions:{names:Ye,fullWidth:!0,logic:ve,display:(f,p,g,b)=>e.jsx(hs,{label:s("notification.severity"),filterList:f,onChange:p,index:g,column:b,filterValues:Ye})}}},{label:s("common.createdAt"),name:"createdAt",width:300,options:{filter:!1,customBodyRenderLite:f=>{const{createdAt:p}=a[f];return e.jsx(Fe,{value:p,locale:n,shouldUpdate:!0})}}}],z=f=>{_(p=>({...p,dateRange:f,page:1}))},oe=[...t||[]];return e.jsxs(C,{ref:M,sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:[e.jsx(xs,{children:e.jsx(st,{theme:ft(),children:e.jsx(it,{className:"main-table",verticalKeyWidth:100,loading:r,locale:n,columns:Z,data:a,durable:U,onChange:P,options:{sort:!1,download:!1,print:!1,search:!1,expandableRowsOnClick:!0,page:x.page-1,rowsPerPage:x.pageSize,count:x.total,...H,onRowClick:(f,{dataIndex:p})=>{L(a[p])}},customPreButtons:[e.jsx(qe,{value:N.dateRange,onChange:z})],customButtons:oe,components:{TableFilterList:f=>e.jsx(Ke,{...f,itemComponent:p=>e.jsx(Ce,{...p,canDelete:g=>{var T;const b=(T=g==null?void 0:g.columnNames)==null?void 0:T[(g==null?void 0:g.index)||0];return(b==null?void 0:b.name)==="sender"}})})}})})}),E&&e.jsx(ps,{refresh:q,onCancel:B,notification:E,blocklet:u,tab:D})]})}const xs=ce.div`
95
+ `;function me({blocklet:t,label:s}){var n;return e.jsx(ms,{children:t?e.jsxs(e.Fragment,{children:[e.jsx(at,{size:24,blocklet:t,ancestors:t.ancestors}),e.jsx("span",{className:"name",children:t.title||((n=t.meta)==null?void 0:n.title)})]}):e.jsx("span",{className:"name",children:s})})}He.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};He.defaultProps={onDelete:()=>{}};function He({list:t,label:s,onDelete:n}){return e.jsxs(C,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(Z,{children:[s,": "]}),t.map(r=>e.jsx(ke,{size:"small",label:e.jsx(C,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(ge,{severity:r})}),onDelete:o=>n(o,r)},r))]})}function hs(t){return e.jsx(Me,{...t,renderLabel:s=>e.jsx(ge,{severity:s})})}function gs({customTableButtons:t}){var se;const{t:s,locale:n}=te(),[r,o]=j.useState(!1),{data:a,paging:x,blocklet:u,fetch:R,getComponent:m,componentDids:v,inService:S,teamDid:I}=Be(),M=j.useRef(null),[E,L]=j.useState(null),[D,G]=j.useState("info"),U=`notification-records-${(se=u.meta)==null?void 0:se.did}`,H=_t(U),[N,_]=j.useState({pageSize:H.rowsPerPage||10,page:H.page?H.page+1:1,dids:H.dids||[],dateRange:H.dateRange||[V().subtract(1,"month").startOf("day").toDate(),V().endOf("day").toDate()]}),h=ee(()=>{if(!u.children||!u.children.length)return[];const f=[];return u.children.forEach(p=>{var b;const g=p.did||((b=p.meta)==null?void 0:b.did);v.includes(g)&&(p.ancestors=[u],f.push(p))}),f},[v,u]),O=async f=>{try{o(!0),await R(f),o(!1)}finally{o(!1)}};j.useEffect(()=>{O(N)},[N]),j.useEffect(()=>{const f=a.find(p=>p.id===(E==null?void 0:E.id));E&&f&&L({...f})},[a]);const A=(f,p,g,b)=>{f.stopPropagation();const T=g.filter(w=>w!==p);_(w=>({...w,[b]:T,page:1}))},P=({page:f,rowsPerPage:p,filterList:g})=>{const[b=[],,,,T=[]]=g;N.pageSize!==p?_(w=>({...w,pageSize:p,page:1})):N.page!==f+1?_(w=>({...w,page:f+1})):ue(N.dids,b)?ue(N.severities,T)||_(w=>({...w,severities:T,page:1})):_(w=>({...w,dids:b,page:1}))},B=j.useCallback(()=>{L(null),G("info")},[]),q=j.useCallback(()=>{R(N)},[R,N]),J=[{label:s("notification.from"),name:"sender",width:400,options:{filter:!0,filterType:"custom",customFilterListOptions:{render:f=>f.map((p,g)=>{var T;if(p==="system")return e.jsx("span",{children:s("notification.system")},`system-${g}`);const b=h.find(w=>{var Y;return(w.did||((Y=w.meta)==null?void 0:Y.did))===p});return e.jsx(me,{blocklet:b,label:(b==null?void 0:b.title)||((T=b==null?void 0:b.meta)==null?void 0:T.title)},p)}),update:(f,p,g)=>(f[g].splice(p,1),f)},filterOptions:{names:h,logic:(f,p)=>p.length?!p.includes(f):!1,display:(f,p,g,b)=>e.jsxs(Pe,{style:{width:"380px"},children:[e.jsx(Ot,{id:"demo-simple-select-label",style:{background:"#ffffff"},children:"Sender"}),e.jsxs(Lt,{multiple:!0,value:f[g],renderValue:T=>e.jsx(C,{display:"flex",gap:1,alignItems:"center",style:{overflow:"hidden",textOverflow:"ellipsis"},children:T.map(w=>{var Y;if(w==="system")return e.jsx("span",{children:s("notification.system")},w);const X=h.find(ae=>{var i;return(ae.did||((i=ae.meta)==null?void 0:i.did))===w});return e.jsx(me,{blocklet:X,label:(X==null?void 0:X.title)||((Y=X==null?void 0:X.meta)==null?void 0:Y.title)},w)})}),onChange:T=>{f[g]=T.target.value,p(f[g],g,b)},children:[e.jsx(Xe,{value:"system",children:s("notification.system")}),h.map(T=>{var X,Y;const w=T.did||((X=T.meta)==null?void 0:X.did);return e.jsx(Xe,{value:w,children:e.jsx(me,{blocklet:T,label:T.title||((Y=T.meta)==null?void 0:Y.title)})},w)})]})]})},customBodyRenderLite:f=>{var b,T;const p=a[f],g=m(p.componentDid);return e.jsxs(C,{display:"flex",alignItems:"center",gap:1,children:[g?e.jsx(at,{size:32,blocklet:g,ancestors:g.ancestors??[]}):e.jsx(kt,{blocklet:u,size:32}),e.jsx(he,{maxLength:50,children:((b=g==null?void 0:g.meta)==null?void 0:b.title)||((T=u==null?void 0:u.meta)==null?void 0:T.title)})]})}}},{label:s("notification.receiver"),name:"receivers",width:300,options:{filter:!1,customBodyRenderLite:f=>{const p=a[f],{receivers:g}=p;return e.jsx(Pt,{total:g.length,renderSurplus:b=>b<100?e.jsxs("span",{children:["+",b]}):e.jsx("span",{children:"99+"}),max:3,sx:{justifyContent:"flex-end",height:"32px",".MuiAvatar-root":{width:"32px",height:"32px",fontSize:"12px",border:0,zIndex:2}},onClick:b=>{b.stopPropagation(),L(p),G("receivers")},children:g.map(b=>{const{receiverUser:T}=b,w=nt(T.avatar,I,S);return e.jsx(tt,{alt:T.fullName,src:`${w}?imageFilter=resize&w=48&h=48`,size:32,did:b.receiver,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}},b.receiver)})})}}},{label:s("notification.statistics"),name:"statistics",width:400,options:{filter:!1,customBodyRenderLite:f=>{const p=a[f];return e.jsx(C,{onClick:g=>{g.stopPropagation(),L(p),G("statistics")},children:e.jsx(Ne,{statistics:p.statistics})})}}},{label:s("notification.notificationPreview"),name:"data",options:{filter:!1,customBodyRenderLite:f=>{const p=a[f];return e.jsx(he,{maxLength:50,children:p.title})}}},{label:s("notification.severity"),name:"severity",width:200,options:{setCellProps:()=>({className:"severity-cell"}),customBodyRenderLite:f=>{const p=a[f];return e.jsx(ge,{severity:p.severity})},filter:!0,filterType:"custom",filterList:N.severities??[],customFilterListOptions:{render:f=>e.jsx(He,{list:f,label:s("notification.severity"),onDelete:(p,g)=>{p.stopPropagation(),A(p,g,J[4].options.filterList,"severities")}}),update:ye},filterOptions:{names:Ye,fullWidth:!0,logic:ve,display:(f,p,g,b)=>e.jsx(hs,{label:s("notification.severity"),filterList:f,onChange:p,index:g,column:b,filterValues:Ye})}}},{label:s("common.createdAt"),name:"createdAt",width:300,options:{filter:!1,customBodyRenderLite:f=>{const{createdAt:p}=a[f];return e.jsx(Fe,{value:p,locale:n,shouldUpdate:!0})}}}],z=f=>{_(p=>({...p,dateRange:f,page:1}))},oe=[...t||[]];return e.jsxs(C,{ref:M,sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:[e.jsx(xs,{children:e.jsx(st,{theme:ft(),children:e.jsx(it,{className:"main-table",verticalKeyWidth:100,loading:r,locale:n,columns:J,data:a,durable:U,onChange:P,options:{sort:!1,download:!1,print:!1,search:!1,expandableRowsOnClick:!0,page:x.page-1,rowsPerPage:x.pageSize,count:x.total,...H,onRowClick:(f,{dataIndex:p})=>{L(a[p])}},customPreButtons:[e.jsx(qe,{value:N.dateRange,onChange:z})],customButtons:oe,components:{TableFilterList:f=>e.jsx(Ke,{...f,itemComponent:p=>e.jsx(Ce,{...p,canDelete:g=>{var T;const b=(T=g==null?void 0:g.columnNames)==null?void 0:T[(g==null?void 0:g.index)||0];return(b==null?void 0:b.name)==="sender"}})})}})})}),E&&e.jsx(ps,{refresh:q,onCancel:B,notification:E,blocklet:u,tab:D})]})}const xs=ce.div`
96
96
  td.MuiTableCell-footer {
97
97
  border: none !important;
98
98
  }