@abtnode/blocklet-services 1.16.43-beta-20250507-124320-c405ab23 → 1.16.43-beta-20250508-132430-79f0da2d

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 (218) hide show
  1. package/api/emails/_components/activity.js +31 -0
  2. package/api/emails/_components/content.js +3 -2
  3. package/api/emails/_templates/activity-notification.js +23 -0
  4. package/api/libs/email.js +50 -14
  5. package/api/services/auth/session.js +23 -4
  6. package/dist/assets/{AdapterDayjs-QizZbjYO.js → AdapterDayjs-DdJ4VT-y.js} +1 -1
  7. package/dist/assets/{ArrowDropDown-CDVfAOPe.js → ArrowDropDown-eLxSrK0e.js} +1 -1
  8. package/dist/assets/{CheckCircle-CJmQq3zs.js → CheckCircle-DxRgzKvx.js} +1 -1
  9. package/dist/assets/{ChevronLeft-BWWdEYiT.js → ChevronLeft-B15pinY6.js} +1 -1
  10. package/dist/assets/{ChevronRight-tpAiXojW.js → ChevronRight-B2sjje0T.js} +1 -1
  11. package/dist/assets/{Community-CGFOsRKB.js → Community-HWgwjOzD.js} +1 -1
  12. package/dist/assets/{DeleteOutline-DqdSj9ec.js → DeleteOutline-DYyAnzFX.js} +1 -1
  13. package/dist/assets/{Done-DtZ1RTXT.js → Done-CiSqPhhR.js} +1 -1
  14. package/dist/assets/{Download-CC6n4Puh.js → Download-Zxb7WMKn.js} +1 -1
  15. package/dist/assets/{Edit-CJyJLpRB.js → Edit-RoUmIPTL.js} +1 -1
  16. package/dist/assets/{EditIcon-KKx_adUe.js → EditIcon-_JnvyTnF.js} +1 -1
  17. package/dist/assets/{Email-CXOl4bM_.js → Email-22EBBQEA.js} +1 -1
  18. package/dist/assets/{Error-BfFrp5Y1.js → Error-C782OBuj.js} +1 -1
  19. package/dist/assets/{ExpandLess-Ddif_UHH.js → ExpandLess-CJztBroj.js} +1 -1
  20. package/dist/assets/{Google-DMO1DD8q.js → Google-DwaWO1n0.js} +1 -1
  21. package/dist/assets/{Holiday-B4FuMZHi.js → Holiday-Lj9LTNQ5.js} +1 -1
  22. package/dist/assets/{InfoOutlined-CoMCPk7a.js → InfoOutlined-BCqZENBx.js} +1 -1
  23. package/dist/assets/{Launch-DNHBfbtb.js → Launch-BbLsJvEN.js} +1 -1
  24. package/dist/assets/{LaunchOutlined-CypNgDc2.js → LaunchOutlined-BdTDYYqz.js} +1 -1
  25. package/dist/assets/{Location-afhZgOLn.js → Location-R9yMI3QX.js} +1 -1
  26. package/dist/assets/{LockIcon-BlopdQoN.js → LockIcon-DEqu2BZe.js} +1 -1
  27. package/dist/assets/{Meeting-Ct6JoGYc.js → Meeting-CYNfXiDR.js} +1 -1
  28. package/dist/assets/{MoreHoriz-D6Wvugul.js → MoreHoriz-Bp9phGCA.js} +1 -1
  29. package/dist/assets/{OffSick-CT2gezXK.js → OffSick-BWarRVS4.js} +1 -1
  30. package/dist/assets/{Phone-alkdVkQC.js → Phone-Df90pdBA.js} +1 -1
  31. package/dist/assets/{PlayArrow-gSxq4eiM.js → PlayArrow-qTn22j6x.js} +1 -1
  32. package/dist/assets/{QuestionMarkCircle-DK54eXUx.js → QuestionMarkCircle-DV5837_n.js} +1 -1
  33. package/dist/assets/{ServerLogo-b4GZ-IpN.js → ServerLogo-7OspbhQZ.js} +1 -1
  34. package/dist/assets/{Timezone-6KelONy7.js → Timezone-BfjUkoy7.js} +1 -1
  35. package/dist/assets/{TuneOutlined-D2mm0fk8.js → TuneOutlined-BkH0zJXZ.js} +1 -1
  36. package/dist/assets/{ViewList-wWyYUeZC.js → ViewList-BBNBkCo1.js} +1 -1
  37. package/dist/assets/{WorkingRemotely-qYwywlWG.js → WorkingRemotely-C3lk6KRk.js} +1 -1
  38. package/dist/assets/access-control-DVj3Uudk.js +14 -0
  39. package/dist/assets/{actions-CHh4ckCh.js → actions-CcV0Tb1p.js} +1 -1
  40. package/dist/assets/{add-component-core-BxQ8IvTn.js → add-component-core-BxVPX1qJ.js} +13 -13
  41. package/dist/assets/{add-resource-CyKCNshd.js → add-resource-CR93luK2.js} +1 -1
  42. package/dist/assets/{addon-CxsW-e44.js → addon-igarTbiO.js} +1 -1
  43. package/dist/assets/advanced-C22Mc4mt.js +14 -0
  44. package/dist/assets/api-DPHyou8y.js +1 -0
  45. package/dist/assets/{appearance-jvoZTz94.js → appearance-CuEL_wAd.js} +1 -1
  46. package/dist/assets/{audit-logs-Bw0__Kyr.js → audit-logs-DXfN0Akp.js} +2 -2
  47. package/dist/assets/{authorize-BROUnOQh.js → authorize-DyX7LBCN.js} +1 -1
  48. package/dist/assets/{base32-M2-tdl6O.js → base32-sa8QWx2s.js} +1 -1
  49. package/dist/assets/{branding-DFP3MWL7.js → branding-B8w6MlXP.js} +2 -2
  50. package/dist/assets/{branding-DEzRXw2N.js → branding-CVWmoAus.js} +1 -1
  51. package/dist/assets/bundle-avatar-DJNl27pn.js +1 -0
  52. package/dist/assets/button-D0USBc4l.js +1 -0
  53. package/dist/assets/{click-to-copy-BxPDzy5A.js → click-to-copy-Dhxc_blG.js} +1 -1
  54. package/dist/assets/cloneDeep-DBPWtvi_.js +1 -0
  55. package/dist/assets/{complete-BoUxpUyG.js → complete-jXf2IsN1.js} +3 -3
  56. package/dist/assets/{component-C0TbBOxr.js → component-DFHLfmfe.js} +1 -1
  57. package/dist/assets/{config-quCUUlRH.js → config-DIa982AP.js} +1 -1
  58. package/dist/assets/{config-cqUeiJ9T.js → config-E-Dkdpbo.js} +2 -2
  59. package/dist/assets/{config-navigation-BE8cOsAr.js → config-navigation-BbbAAFTA.js} +3 -3
  60. package/dist/assets/config-space-B3L4cc62.js +1 -0
  61. package/dist/assets/confirm-CHZbNj0g.js +7 -0
  62. package/dist/assets/connect-60F826H5.js +1 -0
  63. package/dist/assets/connect-to-Do1R8dL3.js +1 -0
  64. package/dist/assets/connect-xMiXau0y.js +5 -0
  65. package/dist/assets/{content-layout-qHJyxPYq.js → content-layout-clTZd0qL.js} +1 -1
  66. package/dist/assets/dashboard-BjhEdRo6.js +280 -0
  67. package/dist/assets/{delete-confirm-D1Xe3pLh.js → delete-confirm-D-jVITSf.js} +1 -1
  68. package/dist/assets/did-address-anPrguG7.js +1 -0
  69. package/dist/assets/domain-CYWI_G__.js +9 -0
  70. package/dist/assets/{domain-action-card-CkNEkjHm.js → domain-action-card-CDfoYMjV.js} +2 -2
  71. package/dist/assets/domains-D-YYFzTK.js +1 -0
  72. package/dist/assets/dot-Bc3KtmUA.js +7 -0
  73. package/dist/assets/{email-D4hA0NBb.js → email-CQL_CvUV.js} +2 -2
  74. package/dist/assets/{empty-spinner-Bx6dYuKk.js → empty-spinner-Bm-LVesB.js} +1 -1
  75. package/dist/assets/exchange-passport-nsHr64lM.js +1 -0
  76. package/dist/assets/{fuel-DLt1un1y.js → fuel-BEbwZqYG.js} +1 -1
  77. package/dist/assets/{gen-access-key-B3TK0S95.js → gen-access-key-DsEy5ZlI.js} +1 -1
  78. package/dist/assets/get-safe-url-CH0a4wzx.js +1 -0
  79. package/dist/assets/get-safe-url-Cn647BYQ.js +1 -0
  80. package/dist/assets/{home-CM-H3jsN.js → home-DUvgZ0gR.js} +1 -1
  81. package/dist/assets/iframe-D7qMCC0L.js +1 -0
  82. package/dist/assets/{index--MMFwLMX.js → index-0ncGiO4u.js} +1 -1
  83. package/dist/assets/{index-Cv_RcwHF.js → index-B1yanBlZ.js} +1 -1
  84. package/dist/assets/{index-Dz5GK-zs.js → index-B6vKQTr4.js} +1 -1
  85. package/dist/assets/{index-hOO84dse.js → index-BJfBmMvG.js} +1 -1
  86. package/dist/assets/{index-B9ltKwuq.js → index-BUwaZJ5Y.js} +32 -32
  87. package/dist/assets/{index-CYBG7pwa.js → index-BmpX2Oqa.js} +2 -2
  88. package/dist/assets/{index-ChWzsQ7e.js → index-Bpz-SuLt.js} +4 -4
  89. package/dist/assets/{index-DisBCigl.js → index-CYz41Upz.js} +1 -1
  90. package/dist/assets/{index-b5IHPDP2.js → index-CZqp_6Zr.js} +14 -14
  91. package/dist/assets/{index-DODYa3Im.js → index-CiWjpC34.js} +1 -1
  92. package/dist/assets/index-Ctbrsvlm.js +113 -0
  93. package/dist/assets/{index-guZXH6v0.js → index-DBajhv2h.js} +18 -18
  94. package/dist/assets/{index-DF637rKa.js → index-DFkZuM1_.js} +1 -1
  95. package/dist/assets/{index-DHkSP6Is.js → index-DQncaTCr.js} +9 -9
  96. package/dist/assets/index-DZ9Jqm_w.js +141 -0
  97. package/dist/assets/index-DiZbt9Ww.js +161 -0
  98. package/dist/assets/{index-3mcmABlM.js → index-DyU89GO9.js} +1 -1
  99. package/dist/assets/index-OVTGvi9j.js +55 -0
  100. package/dist/assets/index-Pu5My3eU.js +1 -0
  101. package/dist/assets/{index-MN19wC90.js → index-egCz4jdE.js} +1 -1
  102. package/dist/assets/{index-D7lbThr3.js → index-hgktawrH.js} +7 -7
  103. package/dist/assets/{index-DzlQfRxQ.js → index-iTlCZ1FK.js} +2 -2
  104. package/dist/assets/index-pvu3nbgn.js +10 -0
  105. package/dist/assets/{index-DY3sJM14.js → index-w68bai-3.js} +1 -1
  106. package/dist/assets/{invitation-V9dvI_l-.js → invitation-DqKIvv6t.js} +4 -4
  107. package/dist/assets/invite-uMWH0SpB.js +1 -0
  108. package/dist/assets/{issue-passport-DHlsRvAU.js → issue-passport-BurnsPQZ.js} +1 -1
  109. package/dist/assets/item-C69diC1y.js +2 -0
  110. package/dist/assets/landing-page-CUkHfAZ5.js +1 -0
  111. package/dist/assets/{launch-result-message-DucKBLPI.js → launch-result-message-CiDoyZ_1.js} +1 -1
  112. package/dist/assets/{layout-D5xp7LhQ.js → layout-CLOmXrMq.js} +1 -1
  113. package/dist/assets/list-D69IwVXI.js +236 -0
  114. package/dist/assets/{list-header-jygAFPJa.js → list-header-D9r1Z68x.js} +1 -1
  115. package/dist/assets/localization-CAh5vCty.js +1 -0
  116. package/dist/assets/{log-CXoK__fA.js → log-CskQJ4o-.js} +1 -1
  117. package/dist/assets/{logger-hgBwjvHi.js → logger-D6jfI5U_.js} +1 -1
  118. package/dist/assets/login-DWvvPy3b.js +1 -0
  119. package/dist/assets/{login-oauth-callback-BdgRJj-p.js → login-oauth-callback-gLyMSemT.js} +1 -1
  120. package/dist/assets/{logo-uploader-50bLEHwJ.js → logo-uploader-D5rcqbIA.js} +3 -3
  121. package/dist/assets/{lost-passport-BKKp14el.js → lost-passport-BWY_TJIl.js} +2 -2
  122. package/dist/assets/omit-CM6MPIu5.js +1 -0
  123. package/dist/assets/{open-window-D__BoNEX.js → open-window-DKiwPBLK.js} +1 -1
  124. package/dist/assets/{overview-CrfEBdKU.js → overview-DedgPJyh.js} +2 -2
  125. package/dist/assets/{page-header-Kn6r_XKH.js → page-header-D7vhn9dN.js} +1 -1
  126. package/dist/assets/{passport-item-B_2v7D20.js → passport-item-B45OGe4c.js} +1 -1
  127. package/dist/assets/payment-kit-DYSjmihw.png +0 -0
  128. package/dist/assets/{permission-CC2IdTdZ.js → permission-6aZ4MNgh.js} +1 -1
  129. package/dist/assets/preferences-DU_A8Q43.js +1 -0
  130. package/dist/assets/profile-embed-B8hvxRm0.js +1 -0
  131. package/dist/assets/publish-resource-riTnsr3y.js +1 -0
  132. package/dist/assets/{react-beautiful-dnd.esm-djvJS7-9.js → react-beautiful-dnd.esm-DPnGSgvn.js} +1 -1
  133. package/dist/assets/relative-time-CKENJIpb.js +1 -0
  134. package/dist/assets/{runtime-C6Oj0Mr3.js → runtime-Dfcxeun4.js} +1 -1
  135. package/dist/assets/sdk-DUAPwTSQ.js +1 -0
  136. package/dist/assets/{security-CqxS0KtD.js → security-zb06EOxl.js} +4 -4
  137. package/dist/assets/session-Ir9UAnhf.js +1 -0
  138. package/dist/assets/setup-Pi8eih8l.js +30 -0
  139. package/dist/assets/{shorten-label-BhyIJhRI.js → shorten-label-DTcisg7Q.js} +1 -1
  140. package/dist/assets/{simple-select-CF7l1q3Q.js → simple-select-DpNtA3N5.js} +1 -1
  141. package/dist/assets/{slicedToArray-D2u5vDM0.js → slicedToArray-CM_xB2K2.js} +1 -1
  142. package/dist/assets/{spaces-U3nGmGRa.js → spaces-DfgQftqB.js} +1 -1
  143. package/dist/assets/start-CnF5I9iM.js +187 -0
  144. package/dist/assets/{starting-progress-BhqlnMjX.js → starting-progress-CUkPGiLq.js} +1 -1
  145. package/dist/assets/{status-C2R9Wncp.js → status-w7wNdwd8.js} +1 -1
  146. package/dist/assets/{step-actions-DTD9vsMp.js → step-actions-CvAYbv4K.js} +1 -1
  147. package/dist/assets/{studio-DdhbfCKD.js → studio-mvCiDQFy.js} +1 -1
  148. package/dist/assets/{switch-control-CvOsxpit.js → switch-control-BP0JyiwP.js} +1 -1
  149. package/dist/assets/{traffic-BppWD3GK.js → traffic-Bo3Bp96o.js} +1 -1
  150. package/dist/assets/{transfer-BreEw1xj.js → transfer-DsERsnl1.js} +1 -1
  151. package/dist/assets/unsubscribe-l6QkVxmr.js +1 -0
  152. package/dist/assets/use-blocklet-logo-BiDCl8v3.js +2 -0
  153. package/dist/assets/{use-mobile-DbhbAmWG.js → use-mobile-BleYjZfN.js} +1 -1
  154. package/dist/assets/{use-mobile-fdqINXKQ.js → use-mobile-BnYZ5d8f.js} +1 -1
  155. package/dist/assets/useAsync-BTtZas5A.js +1 -0
  156. package/dist/assets/{useLocalStorage-vveKfojd.js → useLocalStorage-C7usthsI.js} +1 -1
  157. package/dist/assets/user-center-CSjvhqGU.js +76 -0
  158. package/dist/assets/{util-D5pnqiqz.js → util-CKfiFLd5.js} +1 -1
  159. package/dist/assets/{util-BXETl5KI.js → util-CRVGSd5f.js} +1 -1
  160. package/dist/assets/{vendor-arcblock-TgIfa3ko.js → vendor-arcblock-Bi9JkCAO.js} +88 -88
  161. package/dist/assets/{vendor-hooks-DXGUREV9.js → vendor-hooks-zv9Oe7Yx.js} +1 -1
  162. package/dist/assets/{vendor-mui-core-BKQDHvL6.js → vendor-mui-core-FzKVVAue.js} +1 -1
  163. package/dist/assets/{vendor-mui-x-Db_Ss6fv.js → vendor-mui-x-B9zuOzS0.js} +1 -1
  164. package/dist/assets/vendor-utils-lR6P1BXz.js +208 -0
  165. package/dist/assets/vendor-ux-did-connect-CaDmrsW1.js +2296 -0
  166. package/dist/assets/wrap-locale-BmmKAsYR.js +1 -0
  167. package/dist/index.html +6 -6
  168. package/dist/service-worker.js +1 -1
  169. package/package.json +46 -46
  170. package/dist/assets/access-control-BIwE_lpL.js +0 -14
  171. package/dist/assets/advanced-5-3CdUNs.js +0 -14
  172. package/dist/assets/api-Bf1onQOz.js +0 -1
  173. package/dist/assets/bundle-avatar-N2eRPvA4.js +0 -1
  174. package/dist/assets/button-CO4tv2XS.js +0 -1
  175. package/dist/assets/cloneDeep-WT_kDeVd.js +0 -1
  176. package/dist/assets/config-space-XXX-dnS8.js +0 -1
  177. package/dist/assets/confirm-C55dFhba.js +0 -7
  178. package/dist/assets/connect-CxcQRkKB.js +0 -1
  179. package/dist/assets/connect-Cyda_keb.js +0 -5
  180. package/dist/assets/connect-to-gwpYimRA.js +0 -1
  181. package/dist/assets/dashboard-3gdmABlO.js +0 -280
  182. package/dist/assets/did-address-CaOBKHpX.js +0 -1
  183. package/dist/assets/domain-BEDI7va7.js +0 -9
  184. package/dist/assets/domains-BzOFZDiL.js +0 -1
  185. package/dist/assets/dot-DqINfNl1.js +0 -7
  186. package/dist/assets/exchange-passport-DYYQAnfj.js +0 -1
  187. package/dist/assets/get-safe-url-BBjUrzRU.js +0 -1
  188. package/dist/assets/get-safe-url-zHRp3aBu.js +0 -1
  189. package/dist/assets/iframe-BuwO7sH1.js +0 -1
  190. package/dist/assets/index-BLdu7KNf.js +0 -10
  191. package/dist/assets/index-BY2ztvNA.js +0 -113
  192. package/dist/assets/index-BktGjdcJ.js +0 -1
  193. package/dist/assets/index-C6GiJKvt.js +0 -192
  194. package/dist/assets/index-Cmwh6ZNi.js +0 -141
  195. package/dist/assets/index-KH-9aJF9.js +0 -55
  196. package/dist/assets/invite-DZjAPDTn.js +0 -1
  197. package/dist/assets/item-ChX1dT7k.js +0 -2
  198. package/dist/assets/landing-page-xXstO1rJ.js +0 -1
  199. package/dist/assets/list-BuihU737.js +0 -236
  200. package/dist/assets/localization-DxZ5mhWl.js +0 -1
  201. package/dist/assets/login-DggkjNzD.js +0 -1
  202. package/dist/assets/omit-DNeUY6_X.js +0 -1
  203. package/dist/assets/preferences-yjK1dIpN.js +0 -1
  204. package/dist/assets/profile-embed-BwWjXkMu.js +0 -1
  205. package/dist/assets/publish-resource-qPWRQ9Qg.js +0 -1
  206. package/dist/assets/relative-time-BTKzBWA6.js +0 -1
  207. package/dist/assets/sdk-CtDt6ZE4.js +0 -1
  208. package/dist/assets/session-C3Z84LF2.js +0 -1
  209. package/dist/assets/setup-B4ffVVKP.js +0 -30
  210. package/dist/assets/start-Cz_Kd33A.js +0 -187
  211. package/dist/assets/unsubscribe-CqTo6HGm.js +0 -1
  212. package/dist/assets/use-blocklet-logo-CWUmcmJR.js +0 -1
  213. package/dist/assets/useAsync-B8Nbc8so.js +0 -1
  214. package/dist/assets/useAsync-CLWvmBXN.js +0 -1
  215. package/dist/assets/user-center-DKy5PNdi.js +0 -76
  216. package/dist/assets/vendor-utils-CjMBJT5V.js +0 -208
  217. package/dist/assets/vendor-ux-did-connect-Dr2W2Pc9.js +0 -2296
  218. package/dist/assets/wrap-locale-DAxfLWy4.js +0 -1
@@ -1,10 +0,0 @@
1
- import{j as t,be as H,aa as m,ad as k,bU as W,T as p,ah as L,bd as A,e as K,w as V}from"./vendor-mui-core-BKQDHvL6.js";import{r as x}from"./vendor-react-DEoibe3W.js";import{m as J,k as X,aM as Z,a1 as $,a0 as G,I as Y,R as P}from"./vendor-ux-did-connect-Dr2W2Pc9.js";import{f as v,u as q}from"./vendor-hooks-DXGUREV9.js";import{ah as R,A as Q,Y as ee}from"./vendor-utils-CjMBJT5V.js";import{x as re,y as O,z as te}from"./vendor-arcblock-TgIfa3ko.js";import ne from"./Phone-alkdVkQC.js";import ae from"./Location-afhZgOLn.js";import oe from"./Email-CXOl4bM_.js";import E from"./Timezone-6KelONy7.js";let g=function(e){return e.AvatarOnly="AvatarOnly",e.Detailed="Detailed",e}({}),S=function(e){return e.NameOnly="NameOnly",e.Minimal="Minimal",e.Basic="Basic",e}({}),N=null;try{N=new J}catch(e){console.error("Failed to initialize BlockletSDK:",e),N=null}const M="ux_user_",ie=60*60*1e3,se=e=>{if(typeof sessionStorage>"u")return null;try{const r=`${M}${e}`,a=sessionStorage.getItem(r);if(!a)return null;const n=JSON.parse(a),i=n.timestamp||0;return Date.now()-i>ie?(sessionStorage.removeItem(r),null):n.user}catch(r){return console.error(`Failed to load user cache for did ${e}:`,r),null}},le=(e,r)=>{if(!(typeof sessionStorage>"u"))try{const a=`${M}${e}`,n={user:r,timestamp:Date.now()};sessionStorage.setItem(a,JSON.stringify(n))}catch(a){console.error(`Failed to save user cache for did ${e}:`,a)}};function ce(e){if(!e)return null;let r="";return e.fullName?r=e.fullName.charAt(0).toUpperCase():e.email?r=e.email.split("@")[0].charAt(0).toUpperCase():r=e.did?e.did.charAt(0).toUpperCase():"?",r}function de(e){if(!e||typeof e!="string")return!1;try{const r=X.toTypeInfo(e);return r.role!==void 0&&r.role!==Z.types.RoleType.ROLE_APPLICATION}catch(r){return console.error("Failed to check if did is user did:",r),!1}}async function ue(e){if(!e)return null;const r=se(e);if(r)return r;if(!N)return null;try{const a=await N.user.getUserPublicInfo({did:e});return a&&le(e,a),a}catch(a){return console.error("Failed to get user by did:",a),null}}const B=(e,r=48,a=void 0,n=void 0,i=!1)=>{const o=l=>{n==null||n(e,l)};if(!e.avatar){const l=ce(e),{className:u,style:h,alt:y}=a||{};return t.jsx(H,{onClick:o,className:u,style:h,alt:y,sx:{width:r,height:r,fontSize:r*.4,cursor:i||n?"pointer":"default"},variant:"circular",children:l})}return t.jsx($,{size:r,did:e.did,variant:"circle",style:{cursor:i||n?"pointer":"default"},onClick:o,src:e.avatar,alt:e.fullName||"",...a||{}})},fe=(e,r=120)=>e?t.jsx(m,{sx:{maxWidth:r},className:"user-card__top-right-content",children:e()}):null;function I({user:e,avatarSize:r,shouldShowHoverCard:a,renderCardContent:n,tooltipTitle:i,tooltipProps:o,avatarProps:l,onAvatarClick:u}){const h=t.jsx(m,{display:"inline-block",children:B(e,r,l,u,a||!!i)});return i?t.jsx(k,{enterDelay:200,title:i,placement:"bottom",...o??{},children:h}):a?t.jsx(k,{enterDelay:200,title:n?n():null,placement:"bottom",arrow:!1,TransitionComponent:W,PopperProps:{sx:{"& .MuiTooltip-tooltip":{backgroundColor:"transparent",p:0,maxWidth:500,zIndex:1e3}}},...o??{},children:h}):h}function me(e){const{user:r,infoType:a,avatarSize:n=48,shouldShowHoverCard:i=!1,renderCardContent:o,...l}=e;return a===S.NameOnly?t.jsx(I,{user:r,avatarSize:n,shouldShowHoverCard:!1,renderCardContent:o,tooltipTitle:r.fullName||r.email||r.did,...l}):t.jsx(I,{user:r,avatarSize:n,shouldShowHoverCard:i,renderCardContent:o,...l})}function he(e){const{user:r,avatarSize:a=48,onAvatarClick:n}=e;return t.jsxs(t.Fragment,{children:[B(r,a,e.avatarProps,n),t.jsx(p,{variant:"body1",children:r.fullName||r.email||r.did})]})}function xe(e,r=10){return e?e.length<=r?e:`${e.slice(0,r-1)}...${e.slice(-2)}`:""}function pe({children:e,maxLength:r=10,sx:a=void 0,hiddenTip:n=!1}){const i=x.useMemo(()=>xe(e,r),[e,r]);return(e==null?void 0:e.length)<=r?t.jsx(p,{sx:a,children:e}):n?t.jsx(p,{sx:a,children:i}):t.jsx(k,{title:e,placement:"top",children:t.jsx(p,{sx:a,children:i})})}function ye(e){const{user:r,showDid:a,didProps:n,avatarSize:i,shouldShowHoverCard:o,renderCardContent:l,renderTopRightContent:u,topRightMaxWidth:h,avatarProps:y,shortenLabelProps:b,renderName:C,...w}=e;return t.jsxs(m,{display:"flex",justifyContent:"space-between",alignItems:"center",className:"user-card__avatar-content",children:[t.jsxs(m,{display:"flex",justifyContent:"flex-start",alignItems:"center",gap:1,flex:1,minWidth:0,children:[t.jsx(I,{user:r,avatarSize:i,shouldShowHoverCard:o,renderCardContent:l,avatarProps:y,...w}),t.jsxs(m,{children:[t.jsx(p,{variant:"subtitle1",fontWeight:500,color:"text.primary",className:"user-card__full-name-label",fontSize:18,noWrap:!0,sx:{lineHeight:1.1},children:C?C(r):t.jsx(pe,{sx:{fontWeight:500},...b,children:r.fullName||r.email||r.did})}),a&&r.did?t.jsx(G,{did:r.did,size:14,copyable:!0,compact:!0,locale:"en",sx:{lineHeight:1.5},...n??{}}):null]})]}),fe(u,h)]})}const je=x.memo(ye),ge={timezone:E,email:oe,phone:ne,location:ae,link:O};function be(e){return ee(e)}const D={width:16,height:16};function Ce({value:e}){return t.jsxs(m,{display:"flex",alignItems:"center",gap:1,className:"user-card__timezone-field",children:[t.jsx(E,{...D}),t.jsx(re,{value:e,variant:"body2",color:"grey.800"})]})}function ve({value:e}){const[r,a]=x.useState(!1),n=v(()=>{try{const o=new URL(e);return Q(o.origin,"favicon.ico")}catch{return""}},[e]),i=()=>{a(!0)};return t.jsxs(m,{display:"flex",alignItems:"center",gap:1,className:"user-card__link-field",children:[n&&!r?t.jsx("img",{src:n,alt:"site icon",style:{width:16,height:16,objectFit:"contain"},onError:i}):t.jsx(O,{...D}),t.jsx(_,{variant:"body2",color:"grey.800",children:t.jsx(p,{component:"a",href:e,style:{textDecoration:"none",color:"inherit",fontSize:"inherit"},target:"_blank",variant:"body2",color:"grey.800",rel:"noopener noreferrer",children:be(e)})})]})}function T({field:e,value:r,children:a}){const n=ge[e];return t.jsxs(m,{display:"flex",alignItems:"center",gap:1,className:`user-card__${e}-field`,children:[n?t.jsx(n,{...D}):t.jsx(Y,{icon:te,...D}),t.jsx(_,{variant:"body2",color:"grey.800",children:a??r})]},e)}function Se({user:e,isFull:r=!1,renderFields:a}){var z;const n=v(()=>a??["bio","email","phone","location","timezone","link"],[a]),i=v(()=>n.includes("bio"),[n]),o=v(()=>e.metadata??{joinedAt:e==null?void 0:e.createdAt,email:e==null?void 0:e.email,phone:{country:"cn",phoneNumber:(e==null?void 0:e.phone)??""}},[e]),l=v(()=>e.address,[e.address]),u=x.useCallback(s=>{var f,c,d;if(!s)return"";switch(s){case"bio":return((f=e.metadata)==null?void 0:f.bio)||"";case"email":return o.email||e.email||"";case"phone":return((c=o.phone)==null?void 0:c.phoneNumber)||e.phone||"";case"location":return(l==null?void 0:l.city)||o.location||"";case"timezone":return o.timezone||"";case"link":return((d=o.links)==null?void 0:d.map(j=>j.url).filter(Boolean))||[];default:return e[s]||""}},[e,o,l]),{effectiveRenderCount:h}=x.useMemo(()=>{const s=n.filter(c=>{if(c==="bio")return!1;const d=u(c);return d==null||d===""?!1:R(d)?d.length>0:String(d).trim().length>0}),f=s.reduce((c,d)=>{const j=u(d);return c+(Array.isArray(j)?j.filter(F=>F&&String(F).trim()).length:1)},0);return{visibleFields:s,effectiveRenderCount:f}},[n,u]),y=h>4,b=q(s=>s!=null&&String(s).trim().length>0),C=x.useMemo(()=>{const s=[];return n.forEach(f=>{if(f==="bio")return;const c=u(f);c&&(R(c)?c.forEach((d,j)=>{b(d)&&s.push({field:f,value:d,key:`${f}-${j}`})}):b(c)&&s.push({field:f,value:c,key:f}))}),s},[n,u,b]);if(n.length===0)return null;const w=s=>{const{field:f,value:c,key:d}=s;switch(f){case"link":return t.jsx(ve,{value:c},d);case"timezone":return t.jsx(Ce,{value:c},d);case"email":return t.jsx(T,{field:f,value:c,children:t.jsx(p,{component:"a",href:`mailto:${c}`,rel:"noopener noreferrer",referrerPolicy:"no-referrer",style:{color:"inherit",textDecoration:"none",fontSize:"inherit"},children:c})});default:return t.jsx(T,{field:f,value:c},d)}};return t.jsxs(m,{mt:1,display:"flex",flexDirection:"column",gap:1.5,className:"user-card__basic-content",children:[i&&((z=e.metadata)==null?void 0:z.bio)&&t.jsx(_,{variant:"body2",color:"grey.800",className:"user-card__bio-field",children:e.metadata.bio}),y?t.jsx(A,{container:!0,spacing:.5,children:C.map(s=>t.jsx(A,{item:!0,xs:6,children:w(s)},s.key))}):t.jsx(m,{display:"flex",flexDirection:"column",gap:.5,children:C.map(s=>w(s))})]})}const _=L(p)`
2
- flex: 1;
3
- display: -webkit-box;
4
- line-height: 1.5;
5
- -webkit-line-clamp: 1;
6
- -webkit-box-orient: vertical;
7
- overflow: hidden;
8
- text-overflow: ellipsis;
9
- word-break: break-word;
10
- `;function we(e){const{user:r,avatarSize:a=40,renderCustomContent:n,isFull:i=!0,infoType:o=S.Minimal,renderFields:l,popupRenderFields:u,...h}=e;return t.jsxs(m,{display:"flex",flexDirection:"column",width:"100%",flex:1,height:"100%",children:[t.jsx(je,{user:r,avatarSize:a,...h}),o===S.Basic&&t.jsx(Se,{user:r,isFull:i,renderFields:l}),t.jsx(m,{className:"user-card__footer",children:n&&t.jsx(m,{sx:{mt:1.5},children:n()})})]})}function U(e){const{infoType:r=S.Minimal}=e;switch(r){case S.NameOnly:return t.jsx(he,{...e});default:return t.jsx(we,{...e})}}function Ne({children:e,sx:r}){const a=K();return t.jsx(m,{sx:P({p:2,backgroundColor:a.palette.background.paper,border:"1px solid",borderColor:"divider",borderRadius:1,maxWidth:500,minWidth:320,display:"flex"},r||null),children:e})}function De({children:e,cardType:r=g.Detailed,variant:a="box",containerRef:n,sx:i}){const o={minWidth:320,p:2,borderRadius:1,...r===g.Detailed?{border:"1px solid",borderColor:"divider"}:{}};return a==="paper"?t.jsx(V,{ref:n,elevation:0,sx:o,children:e}):t.jsx(m,{ref:n,sx:P(o,{display:"flex",alignItems:r===g.AvatarOnly?"center":"flex-start",gap:2},i||null),children:e})}function Pe(e){const{cardType:r=g.Detailed,showHoverCard:a}=e,n=a!==void 0?a:r===g.AvatarOnly,i=x.useRef(null),[o,l]=x.useState(()=>e.user||null);if(x.useEffect(()=>{let h=!0;return e.user?l(e.user):e.did&&de(e.did)&&!e.user&&ue(e.did).then(y=>{h&&l(y||{fullName:"Anonymous",did:e.did,avatar:""})}),()=>{h=!1}},[e.did,e.user]),!o)return t.jsx($,{did:e.did,size:e.avatarSize,...e.avatarProps});const u=()=>t.jsx(Ne,{sx:e.popupSx,children:t.jsx(U,{...e,shouldShowHoverCard:!1,user:o,avatarProps:e.popupAvatarProps,shortenLabelProps:e.popupShortenLabelProps,renderFields:e.popupRenderFields,renderName:e.popupRenderName,infoType:e.popupInfoType||e.infoType})});return r===g.AvatarOnly?t.jsx(me,{...e,shouldShowHoverCard:n,renderCardContent:u,user:o}):t.jsx(De,{containerRef:i,cardType:r,sx:e.sx,children:t.jsx(U,{...e,shouldShowHoverCard:n,renderCardContent:u,user:o})})}export{g as C,S as I,Pe as U};
@@ -1,113 +0,0 @@
1
- import{r as j}from"./vendor-react-DEoibe3W.js";import{j as e,H as d,a9 as Pe,ad as jt,T as J,aa as C,E as _e,bp as Fe,bA as et,bR as Te,bt as Re,bS as Ie,y as Se,b4 as Ee,ab as tt,ah as ce,a1 as st,m as yt,bd as Xe,bs as vt,bo as St,q as Ze,bZ as Ct}from"./vendor-mui-core-BKQDHvL6.js";import{e as ie,aA as ue,C as Nt}from"./vendor-utils-CjMBJT5V.js";import{a2 as Z,n as P,ba as wt,r as ke,F as Tt,u as te,bT as Rt,a1 as nt,a as De,ab as at,bq as je,aq as It,av as Et,bx as Dt}from"./vendor-ux-did-connect-Dr2W2Pc9.js";import{z as At,t as V,l as Ot,I as Je}from"./index-B9ltKwuq.js";import{f as ee,a as Ae}from"./vendor-hooks-DXGUREV9.js";import{S as he}from"./shorten-label-BhyIJhRI.js";import{I as it}from"./index-DisBCigl.js";import{A as Lt,S as Pt,a as _t,b as Ft,B as kt}from"./list-BuihU737.js";import{R as Be}from"./relative-time-BTKzBWA6.js";import{a as ze}from"./dashboard-3gdmABlO.js";import{W as Bt}from"./did-address-CaOBKHpX.js";import{p as ot}from"./util-BXETl5KI.js";import{D as zt,g as Wt}from"./traffic-BppWD3GK.js";import{i as qt,b as Mt}from"./use-blocklet-logo-CWUmcmJR.js";import{B as rt}from"./bundle-avatar-N2eRPvA4.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-TgIfa3ko.js";import"./index-DF637rKa.js";import"./sdk-CtDt6ZE4.js";import"./InfoOutlined-CoMCPk7a.js";import"./CheckCircle-CJmQq3zs.js";import"./index-BLdu7KNf.js";import"./Phone-alkdVkQC.js";import"./Location-afhZgOLn.js";import"./Email-CXOl4bM_.js";import"./Timezone-6KelONy7.js";import"./useLocalStorage-vveKfojd.js";import"./confirm-C55dFhba.js";import"./format-error-BrmqJs5a.js";import"./PlayArrow-gSxq4eiM.js";import"./get-safe-url-BBjUrzRU.js";import"./session-C3Z84LF2.js";import"./dot-DqINfNl1.js";import"./useAsync-CLWvmBXN.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-fdqINXKQ.js";import"./base32-M2-tdl6O.js";import"./iframe-BuwO7sH1.js";import"./LaunchOutlined-CypNgDc2.js";import"./ChevronLeft-BWWdEYiT.js";import"./ChevronRight-tpAiXojW.js";import"./index-Dz5GK-zs.js";import"./vendor-mui-x-Db_Ss6fv.js";import"./AdapterDayjs-QizZbjYO.js";const lt=j.createContext({}),{Provider:Kt,Consumer:mn}=lt;function $t({children:t,blocklet:s=""}){const{api:n,inService:r,ws:{useSubscription:o}}=At(),[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,q]=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 _={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,...M}=_;let Q="";B&&B.includes("system")&&(Q="system");const z=B?B.filter(f=>f!=="system"):[],oe={...M,source:Q,componentDids:z},se=await n.getNotificationSendLog({input:oe});return q(oe),x(se.list),R(se.paging),se.list}catch(_){return Z.error(_.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 _;return((_=A.meta)==null?void 0:_.did)===h});if(O)return O.ancestors=[s],O},[s]),$=async({notificationId:h,receivers:O,channels:A,..._})=>{await n.resendNotification({input:{teamDid:m,notificationId:h,receivers:O,channels:A.map(B=>B==="wallet"?P.NOTIFICATION_SEND_CHANNEL.WALLET:B==="pushKit"?P.NOTIFICATION_SEND_CHANNEL.PUSH:B),..._}})},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 _={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:_})}catch(_){throw Z.error(_.message),_}},[n,m]);j.useEffect(()=>{m&&D()},[m]),o(P.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,h=>{E.has(h.notificationId)&&L(I)},[E,I]),o(P.EVENTS.NOTIFICATION_BLOCKLET_CREATE,h=>{E.has(h.id)||L(I)},[E,I]);const k={fetch:L,data:a,paging:u,blocklet:s,getComponent:G,resendNotification:$,getUser:H,componentDids:v,getReceivers:N,inService:r,teamDid:m};return e.jsx(Kt,{value:{notificationRecords:k},children:t})}function We(){const{notificationRecords:t}=j.useContext(lt);return t}ge.propTypes={severity:d.oneOf(Object.values(["info","success","error","warning"])).isRequired};const Ht={info:"primary",success:"success",error:"error",warning:"warning"};function ge({severity:t="info"}){return e.jsx(wt,{type:Ht[t],children:t})}var qe={},Ut=Pe;Object.defineProperty(qe,"__esModule",{value:!0});var ct=qe.default=void 0,Vt=Ut(ke()),Gt=e;ct=qe.default=(0,Vt.default)((0,Gt.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 Me={},Yt=Pe;Object.defineProperty(Me,"__esModule",{value:!0});var dt=Me.default=void 0,Xt=Yt(ke()),Zt=e;dt=Me.default=(0,Xt.default)((0,Zt.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12m8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8"}),"Block");var Ke={},Jt=Pe;Object.defineProperty(Ke,"__esModule",{value:!0});var ut=Ke.default=void 0,Qt=Jt(ke()),es=e;ut=Ke.default=(0,Qt.default)((0,es.jsx)("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"}),"Refresh");const ts=(t,s,n="")=>{if(!n||!s)return"";switch(n){case P.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:s});case P.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:s});case P.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:s});case P.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return n}};function pt(t,s,n={}){const{status:r,updatedAt:o,reason:a="",channel:x="wallet"}=n,u=o?t("notification.sendStatus.sentTime",{date:Ot(o,s)}):"",R=ts(t,x,a);return r===P.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:u,reason:R}:r===P.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"],Qe=["info","success","error","warning"],ft=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},mt=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},ss=(t,s)=>{const n=ie(s,"extra.notifications.email",!0);return{available:ft(t),enabled:n}},ns=(t,s)=>{const n=ie(s,"extra.notifications.push",!0);return{available:mt(t),enabled:n}},as=t=>({enabled:ie(t,"extra.notifications.wallet",!0)}),is=t=>({enabled:ie(t,"extra.webhooks",[]).length>0}),xe=(t=3)=>new Promise(s=>{setTimeout(()=>{s()},t*1e3)}),os=(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},rs=(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},ls=t=>{switch(t){case P.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case P.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case P.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case P.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},ht=()=>Tt({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(jt,{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=pt(r,o,{status:a});return e.jsx(_e,{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)})]})}$e.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 $e({filterList:t,onChange:s,index:n,column:r,filterValues:o,label:a,renderLabel:x}){return e.jsxs(Fe,{className:"filter-container",children:[e.jsx(et,{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($e,{...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=pt(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(ze,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:o,children:a("notification.resend")})]})}He.propTypes={value:d.array.isRequired,onChange:d.func};function He({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){Z.error("Please select a date range");return}if(V(m.startDate).isAfter(m.endDate)||!V(m.startDate).isValid()||!V(m.endDate).isValid()){Z.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:[Je(t[0],n)," - ",Je(t[1],n)]})}),e.jsx(Ee,{open:u,anchorEl:o,onClose:()=>{a(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(zt,{open:!0,maxDate:r,initialDateRange:{startDate:t[0],endDate:t[1]},toggle:x,definedRanges:Wt(r),onChange:R})})]})}Ue.propTypes={itemComponent:d.elementType.isRequired};function Ue({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(Rt.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(_e,{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 cs=[{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}];Ve.propTypes={loading:d.bool,onCancel:d.func,onConfirm:d.func};Ve.defaultProps={loading:!1,onCancel:()=>{},onConfirm:()=>{}};function Ve({loading:t=!1,onCancel:s,onConfirm:n}){const{t:r}=te(),[o,a]=j.useState(cs),[x,u]=j.useState(!0),R=(v,S)=>{S.checked=v.target.checked;const I=o.map(q=>({...q,checked:q.value===S.value?S.checked:q.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(Fe,{component:"fieldset",variant:"standard",children:[e.jsx(et,{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(tt,{size:16}),r("common.confirm")]})]})]})}gt.propTypes={notificationId:d.string.isRequired,handleResend:d.func,resending:d.bool};function gt({notificationId:t,handleResend:s,resending:n=!1}){const{t:r,locale:o}=te(),{getReceivers:a,inService:x,teamDid:u,getUser:R,blocklet:m}=We(),[v,S]=j.useState(!1),[I,q]=j.useState([]),E=Ae({anchorEl:null,position:null}),L=Ae({anchorEl:null,position:null}),[D,G]=j.useState(null),[$,H]=j.useState({total:0,pageSize:10,pageCount:0,page:1}),[N,k]=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"}],_=async()=>{if(!v&&t)try{S(!0);const i=await a({notificationId:t,...N}),l=i.list.map(c=>({...c,receiverUser:{...c.receiverUser,avatar:ot(c.receiverUser.avatar,u,x)}}));q(l),H(i.paging),S(!1)}catch(i){Z.error(i.message),S(!1)}};j.useEffect(()=>{_()},[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}},M=i=>i.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(De,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(ze,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:B,children:r("notification.resend")})}):null,Q={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:$.page-1,rowsPerPage:$.pageSize,count:$.total,searchText:N.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:h,onRowSelectionChange:(i,l)=>{O(l.map(c=>c.dataIndex))},customToolbarSelect:M},z=({page:i,rowsPerPage:l,searchText:c,filterList:y})=>{const[,F=[],U=[],K=[]]=y;N.pageSize!==l?k(W=>({...W,pageSize:l,page:1})):N.page!==i+1?k(W=>({...W,page:i+1})):N.searchText!==c?k(W=>({...W,searchText:c,page:1})):ue(F,N.walletSendStatus)?ue(U,N.pushKitSendStatus)?ue(K,N.emailSendStatus)||k(W=>({...W,emailSendStatus:K,page:1})):k(W=>({...W,pushKitSendStatus:U,page:1})):k(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"?as(c):i==="email"?ss(m,c):i==="pushKit"?ns(m,c):i==="webhook"?is(c):!0:!1},[R,m]),se=j.useCallback(i=>os(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){Z.error(y.response?y.response.statusText:y.message)}},w=async(i,l,c,y=[],F=!0)=>{if(i.stopPropagation(),rs(l,c)>=4){Z.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||Nt(K)&&Object.values(K).every(W=>!!W))&&(await s([c],[l.receiver],F),L.anchorEl||(await xe(.5),f()))}catch(K){Z.error(K.message)}},Y=i=>{k(l=>({...l,dateRange:i,page:1}))},X=(i,l,c,y)=>{i.stopPropagation();const F=c.filter(U=>U!==l);k(U=>({...U,[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(nt,{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(Bt,{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(),X(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(),X(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(),X(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,U=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:U.status,updatedAt:U.sendAt,reason:U.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(Be,{value:l,locale:o,shouldUpdate:!0})}}}],[I,o,N,r]),Ye=[e.jsx(He,{value:N.dateRange,onChange:Y},"date-picker"),e.jsx(De,{variant:"contained",size:"small",color:"primary",loading:v,startIcon:e.jsx(ut,{}),onClick:()=>_(),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(us,{children:e.jsxs(st,{theme:ht(),children:[e.jsx(at,{className:"receivers-table",locale:o,loading:v,columns:ae,data:I,onChange:z,options:Q,customButtons:Ye,components:{TableFilterList:i=>e.jsx(Ue,{...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(ps,{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,U;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:(U=D==null?void 0:D.result)!=null&&U[l]?je.success.main:"inherit"},children:[D!=null&&D.result?e.jsx(ct,{}):e.jsx(tt,{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(dt,{}),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(Ve,{loading:n,onCancel:p,onConfirm:b})})]})})})}const ds=j.memo(gt),us=ce.div`
2
- td.MuiTableCell-footer {
3
- border: none !important;
4
- }
5
- .sent-status-cell {
6
- .resend-btn {
7
- display: none;
8
- }
9
- &:hover {
10
- .resend-btn {
11
- display: flex;
12
- }
13
- }
14
- }
15
- `,ps=ce.div`
16
- padding: 8px 16px;
17
- .check-title {
18
- font-weight: 500;
19
- margin-bottom: 8px;
20
- &::first-letter {
21
- text-transform: uppercase;
22
- }
23
- }
24
- .check-item {
25
- svg {
26
- font-size: 16px;
27
- }
28
- font-size: 12px;
29
- }
30
- `,fe=t=>t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t;function fs(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 ms(t,s,n){const{wallet:r,push:o,email:a,webhook:x}=t;return[{name:"Wallet",value:e.jsx(le,{loading:n,channel:P.NOTIFICATION_SEND_CHANNEL.WALLET,item:r,onResend:s})},{name:"Push",value:e.jsx(le,{loading:n,channel:P.NOTIFICATION_SEND_CHANNEL.PUSH,item:o,onResend:s})},{name:"Email",value:e.jsx(le,{loading:n,channel:P.NOTIFICATION_SEND_CHANNEL.EMAIL,item:a,onResend:s})},...x.total>0?[{name:"Webhook",value:e.jsx(le,{loading:n,channel:P.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:P.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=ls(t),v=n?x.length:x,S=n?u.length:u,I=n?R.length:R,q=async G=>{G.stopPropagation();const $=n?[...new Set([...x,...u].map(H=>H))]:[];await r([t],[],!0,$)},E=v+S,L=E>0?v/E*100:0,D=E>0?S/E*100:0;return e.jsxs(hs,{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(De,{size:"small",color:"primary",loading:o,variant:"contained",startIcon:e.jsx(ze,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:q,children:a("notification.resend")})})]})]})}function Ne({statistics:t,mode:s="simple",onResend:n,resending:r}){const o=ee(()=>s==="simple"?fs(t):ms(t,n,r),[t,s]);return s==="simple"?e.jsx("div",{children:o.map(a=>e.jsx(it,{style:{alignItems:"flex-start",marginBottom:s==="simple"?0:16},valueComponent:"div",nameWidth:100,name:a.name,children:a.value},a.name))}):e.jsx(Xe,{container:!0,spacing:2,children:o.map(a=>e.jsx(Xe,{item:!0,md:4,sm:6,xs:12,children:a.value},a.name))})}const hs=ce(C)`
31
- display: flex;
32
- flex-direction: column;
33
- align-items: flex-start;
34
- padding: 16px;
35
- border-radius: 8px;
36
- background: ${({successRatio:t,failedRatio:s,theme:n})=>t===0&&s===0?n.palette.grey[300]:`linear-gradient(to right, ${yt(n.palette.success.light,.4)} ${t}%, ${n.palette.grey[100]} ${t}%)`};
37
- transition: 'background 0.5s ease';
38
- cursor: pointer;
39
- .unsent-area {
40
- width: 100%;
41
- position: relative;
42
- .resend-btn {
43
- position: absolute;
44
- right: 0;
45
- bottom: 0;
46
- }
47
- }
48
- `;xt.propTypes={notification:d.object.isRequired,onCancel:d.func,blocklet:d.object.isRequired,tab:d.string};function xt({notification:t,onCancel:s=()=>{},blocklet:n,tab:r="info"}){const{t:o,locale:a}=te(),{getComponent:x,resendNotification:u}=We(),[R,m]=j.useState(!1),v=ee(()=>x(t.componentDid)||n,[n,t.componentDid]),S=Ae({tab:r||"info"}),I=j.useCallback(async(h,O,A=!0,_=[])=>{var Q;if(!h.length||!t.id)return;const B=O.length>0?O:(Q=t==null?void 0:t.receivers)==null?void 0:Q.map(z=>z.receiver);if(!B.length)return;let M=[...h];if(M.includes(P.NOTIFICATION_SEND_CHANNEL.PUSH)&&!mt(n)&&(Z.warning(o("notification.sendStatus.reason.unavailable",{channel:"Push Kit"})),M=M.filter(z=>z!==P.NOTIFICATION_SEND_CHANNEL.PUSH)),M.includes(P.NOTIFICATION_SEND_CHANNEL.EMAIL)&&!ft(n)&&(Z.warning(o("notification.sendStatus.reason.unavailable",{channel:"Email"})),M=M.filter(z=>z!==P.NOTIFICATION_SEND_CHANNEL.EMAIL)),!!M.length)try{m(!0),await u({notificationId:t.id,receivers:B,channels:M,resendFailedOnly:A,...M.includes("webhook")&&_.length?{webhookUrls:_}:{}}),Z.success("Message has been sent!")}catch(z){console.error("handleResend error",{error:z}),Z.error(z.response?z.response.statusText:z.message)}finally{m(!1)}},[n,t.id,t==null?void 0:t.receivers,u,o]),q=ee(()=>qt(t),[t]),E=ee(()=>Mt(t),[t]),L=ee(()=>q?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:q&&E?e.jsx(Lt,{actors:L,teamDid:D,size:32,showName:!0}):e.jsx(Pt,{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:q?e.jsx(_t,{notification:t,blocklet:n}):e.jsx(Ft,{notification:t,rows:0})},{name:o("notification.severity"),value:e.jsx(ge,{severity:t.severity})},{name:o("notification.createdAt"),value:e.jsx(Be,{value:t.createdAt,locale:a,shouldUpdate:!0})}].map(O=>e.jsx(it,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:120,name:O.name,children:O.value},O.name))}const $={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($).map(({label:h,value:O})=>({label:h,value:O})),N=$[S.tab]||$.info,k=h=>{S.tab=h};return e.jsx(It,{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(xs,{children:[e.jsx(C,{mx:3,className:"tabs",children:e.jsx(Et,{tabs:H,current:S.tab,onChange:k,scrollButtons:"auto"})}),e.jsxs("div",{className:"body",children:[S.tab==="receivers"&&e.jsx(ds,{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 gs=j.memo(xt),xs=ce.div`
49
- & > .notification-row {
50
- padding: 0;
51
- }
52
-
53
- .tabs {
54
- margin: 0;
55
- }
56
- .body {
57
- margin-top: 16px;
58
- }
59
-
60
- .channel-item {
61
- display: flex;
62
- padding: 4px;
63
- justify-content: flex-start;
64
- align-items: center;
65
- gap: 8px;
66
- > p {
67
- font-size: 15px;
68
- }
69
- .resend-btn {
70
- svg {
71
- font-size: 16px;
72
- }
73
- display: flex;
74
- align-items: center;
75
- font-size: 12px;
76
- cursor: pointer;
77
- &.disabled {
78
- cursor: not-allowed;
79
- color: ${je.text.disabled};
80
- }
81
- }
82
- }
83
- `;me.propTypes={blocklet:d.object,label:d.string};me.defaultProps={blocklet:null,label:""};const bs=ce.div`
84
- display: flex;
85
- justify-items: flex-start;
86
- align-items: center;
87
- gap: 8px;
88
- .name {
89
- display: block;
90
- max-width: 260px;
91
- white-space: nowrap;
92
- overflow: hidden;
93
- text-overflow: ellipsis;
94
- }
95
- `;function me({blocklet:t,label:s}){var n;return e.jsx(bs,{children:t?e.jsxs(e.Fragment,{children:[e.jsx(rt,{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})})}Ge.propTypes={list:d.array.isRequired,label:d.string.isRequired,onDelete:d.func};Ge.defaultProps={onDelete:()=>{}};function Ge({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(_e,{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 js(t){return e.jsx($e,{...t,renderLabel:s=>e.jsx(ge,{severity:s})})}function ys({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}=We(),q=j.useRef(null),[E,L]=j.useState(null),[D,G]=j.useState("info"),$=`notification-records-${(se=u.meta)==null?void 0:se.did}`,H=Dt($),[N,k]=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);k(w=>({...w,[b]:T,page:1}))},_=({page:f,rowsPerPage:p,filterList:g})=>{const[b=[],,,,T=[]]=g;N.pageSize!==p?k(w=>({...w,pageSize:p,page:1})):N.page!==f+1?k(w=>({...w,page:f+1})):ue(N.dids,b)?ue(N.severities,T)||k(w=>({...w,severities:T,page:1})):k(w=>({...w,dids:b,page:1}))},B=j.useCallback(()=>{L(null),G("info")},[]),M=j.useCallback(()=>{R(N)},[R,N]),Q=[{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 X;return(w.did||((X=w.meta)==null?void 0:X.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(Fe,{style:{width:"380px"},children:[e.jsx(vt,{id:"demo-simple-select-label",style:{background:"#ffffff"},children:"Sender"}),e.jsxs(St,{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 X;if(w==="system")return e.jsx("span",{children:s("notification.system")},w);const Y=h.find(ae=>{var i;return(ae.did||((i=ae.meta)==null?void 0:i.did))===w});return e.jsx(me,{blocklet:Y,label:(Y==null?void 0:Y.title)||((X=Y==null?void 0:Y.meta)==null?void 0:X.title)},w)})}),onChange:T=>{f[g]=T.target.value,p(f[g],g,b)},children:[e.jsx(Ze,{value:"system",children:s("notification.system")}),h.map(T=>{var Y,X;const w=T.did||((Y=T.meta)==null?void 0:Y.did);return e.jsx(Ze,{value:w,children:e.jsx(me,{blocklet:T,label:T.title||((X=T.meta)==null?void 0:X.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(rt,{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(Ct,{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=ot(T.avatar,I,S);return e.jsx(nt,{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(Ge,{list:f,label:s("notification.severity"),onDelete:(p,g)=>{p.stopPropagation(),A(p,g,Q[4].options.filterList,"severities")}}),update:ye},filterOptions:{names:Qe,fullWidth:!0,logic:ve,display:(f,p,g,b)=>e.jsx(js,{label:s("notification.severity"),filterList:f,onChange:p,index:g,column:b,filterValues:Qe})}}},{label:s("common.createdAt"),name:"createdAt",width:300,options:{filter:!1,customBodyRenderLite:f=>{const{createdAt:p}=a[f];return e.jsx(Be,{value:p,locale:n,shouldUpdate:!0})}}}],z=f=>{k(p=>({...p,dateRange:f,page:1}))},oe=[...t||[]];return e.jsxs(C,{ref:q,sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:[e.jsx(vs,{children:e.jsx(st,{theme:ht(),children:e.jsx(at,{className:"main-table",verticalKeyWidth:100,loading:r,locale:n,columns:Q,data:a,durable:$,onChange:_,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(He,{value:N.dateRange,onChange:z})],customButtons:oe,components:{TableFilterList:f=>e.jsx(Ue,{...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(gs,{refresh:M,onCancel:B,notification:E,blocklet:u,tab:D})]})}const vs=ce.div`
96
- td.MuiTableCell-footer {
97
- border: none !important;
98
- }
99
- .sent-status-cell {
100
- .resend-btn {
101
- display: none;
102
- }
103
- &:hover {
104
- .resend-btn {
105
- display: flex;
106
- }
107
- }
108
- }
109
-
110
- .custom-toobar-btns {
111
- gap: 4px;
112
- }
113
- `;bt.propTypes={blocklet:d.object.isRequired,customTableButtons:d.array};bt.defaultProps={customTableButtons:[]};function bt({blocklet:t={},customTableButtons:s}){return e.jsx($t,{blocklet:t,children:e.jsx(ys,{customTableButtons:s})})}export{bt as default};
@@ -1 +0,0 @@
1
- import{j as t,ah as r}from"./vendor-mui-core-BKQDHvL6.js";import{r as s}from"./vendor-react-DEoibe3W.js";import{b5 as a}from"./vendor-ux-did-connect-Dr2W2Pc9.js";import{R as e}from"./vendor-arcblock-TgIfa3ko.js";import"./vendor-utils-CjMBJT5V.js";import"./vendor-hooks-DXGUREV9.js";import"./lottie-web-jYmAQWuC.js";function x(){const{t:o}=s.useContext(a);return t.jsx(n,{style:{paddingTop:"25vh"},children:t.jsx(e,{status:"404",description:o("noMatch.desc"),style:{backgroundColor:"transparent"}})})}const n=r.main``;export{x as default};
@@ -1,192 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/lottie-react.esm-D2t-u0YU.js","assets/vendor-react-DEoibe3W.js"])))=>i.map(i=>d[i]);
2
- import{j as e,aa as n,bd as g,T as z,O as U,bv as q,bt as H,bw as W,cI as E,y as T,ah as I,ai as M,cn as J,dz as X,dA as K,I as Y,dB as Q,e as Z,c1 as ee}from"./vendor-mui-core-BKQDHvL6.js";import{r as b}from"./vendor-react-DEoibe3W.js";import{H as te,a as L,e as re,i as oe,b as ie}from"./vendor-hooks-DXGUREV9.js";import{T as ae,bw as se}from"./vendor-ux-did-connect-Dr2W2Pc9.js";import{_}from"./vendor-arcblock-TgIfa3ko.js";import{aO as ne}from"./vendor-utils-CjMBJT5V.js";import{getAIKitComponent as le}from"./index-guZXH6v0.js";import"./lottie-web-jYmAQWuC.js";import"./index-DODYa3Im.js";import"./index-B9ltKwuq.js";import"./index-DVQCgvFb.js";const N=b.createContext({}),B=()=>b.useContext(N);function de({children:t,restrictions:c,i18n:s,theme:i}){const[l,f]=te({loading:!1}),u=a=>f(j=>({...j,loading:a})),x=b.useMemo(()=>({...l,onLoading:u,restrictions:c,i18n:s}),[l]);return e.jsx(ae,{theme:i,children:e.jsx(N.Provider,{value:x,children:t})})}const ce=["1024x1024","1024x1792","1792x1024"],ue=["256x256","512x512","1024x1024"],xe=[{label:"DALL·E 3",value:"dall-e-3"},{label:"DALL·E 2",value:"dall-e-2"}];function me({onSubmit:t}){const{loading:c,i18n:s}=B(),i=L({model:"dall-e-3",prompt:"",size:"1024x1024",number:1}),l=()=>{const a=JSON.parse(JSON.stringify(i));Object.values(i).every(y=>!!y)&&t(a)},{run:f}=re(l,{wait:500}),u={width:"100%",pl:"12px",pr:"16px"},x=i.model==="dall-e-2"?ue:ce;return e.jsxs(pe,{onSubmit:a=>a.preventDefault(),children:[e.jsx(n,{sx:{flex:1,overflowY:"auto",overflowX:"hidden",m:2,mb:0},children:e.jsxs(g,{container:!0,gap:2.5,children:[e.jsxs(g,{item:!0,xs:12,children:[e.jsx(z,{gutterBottom:!0,className:"title label",children:s("aiImagePrompt")}),e.jsx(U,{sx:{width:1,mt:1},size:"small",type:"text",required:!0,placeholder:s("aiImagePromptTip"),multiline:!0,minRows:5,maxRows:6,value:i.prompt??"",onChange:a=>{a.stopPropagation(),i.prompt=a.target.value},inputProps:{maxLength:1e3}})]}),e.jsxs(g,{item:!0,xs:12,children:[e.jsx(z,{gutterBottom:!0,className:"title label",children:`${s("aiImageModel")}`}),e.jsx(q,{row:!0,sx:{".MuiFormControlLabel-label":{fontSize:"12px"}},value:i.model,onChange:a=>{i.number=1,i.size="1024x1024",i.model=a.target.value},children:xe.map(a=>e.jsx(H,{value:a.value,control:e.jsx(W,{size:"small"}),label:a.label},a.label))})]}),e.jsxs(g,{item:!0,xs:12,children:[e.jsx(z,{gutterBottom:!0,className:"title label",children:`${s("aiImageSize")}: ${i.size}`}),e.jsx(g,{container:!0,sx:{gap:2.5,pt:1},children:e.jsx(n,{flex:1,children:e.jsx(n,{...u,children:e.jsx(E,{size:"small",min:0,max:x.length-1,step:1,value:x.findIndex(a=>a==i.size),onChange:(a,j)=>{i.size=x[j]}})})})})]}),i.model==="dall-e-2"&&e.jsxs(g,{item:!0,xs:12,children:[e.jsx(z,{gutterBottom:!0,className:"title label",children:`${s("aiImageNumber")}: ${i.number}`}),e.jsx(n,{...u,children:e.jsx(E,{size:"small",defaultValue:1,valueLabelDisplay:"auto",step:1,min:1,max:10,value:i.number,onChange:(a,j)=>{a.stopPropagation(),i.number=Number(j)}})})]})]})}),e.jsx(T,{sx:{m:2,transition:"all 0.3s"},className:"submit-ai",variant:"contained",onClick:f,disabled:c,children:s(c?"aiImageGenerating":"aiImageGenerate")},c?"loading-submit":"submit")]})}const pe=I(n)`
3
- display: flex;
4
- flex-direction: column;
5
- height: 100%;
6
- overflow: hidden;
7
-
8
- .title {
9
- padding: 0 0 4px 1px;
10
- }
11
-
12
- .label {
13
- font-weight: 500;
14
- font-size: 15px;
15
- line-height: 100%;
16
- margin: 0;
17
- word-wrap: break-word;
18
- text-align: left;
19
- }
20
-
21
- .submit-ai {
22
- height: 40px;
23
- background: linear-gradient(90deg, #45e4fa 0%, #8a45fa 52.08%, #fa45bc 100%);
24
- color: #fff;
25
- border-radius: 30px;
26
- box-shadow: none;
27
- text-transform: none;
28
-
29
- &.Mui-disabled {
30
- color: rgba(0, 0, 0, 0.26) !important;
31
- background: rgba(0, 0, 0, 0.12) !important;
32
- }
33
- }
34
-
35
- .MuiFormHelperText-root {
36
- font-style: normal;
37
- font-weight: 500;
38
- font-size: 12px;
39
- line-height: 14px;
40
- color: #9397a1;
41
- margin: 0;
42
- margin-top: 4px;
43
- }
44
-
45
- .MuiOutlinedInput-root {
46
- background: #fbfbfb;
47
- border-radius: 4px;
48
- padding: 0;
49
-
50
- textarea {
51
- padding: 8.5px 14px;
52
- }
53
-
54
- fieldset {
55
- border: 1px solid #f6f6f6;
56
- }
57
-
58
- &:hover fieldset {
59
- border: 1px solid #a482fe;
60
- }
61
- }
62
-
63
- .Mui-focused {
64
- &.MuiFormLabel-root {
65
- color: #a482fe;
66
- }
67
-
68
- &.MuiOutlinedInput-root {
69
- fieldset {
70
- border: 1px solid #a482fe;
71
- }
72
- }
73
- }
74
-
75
- .Mui-error {
76
- &.MuiFormLabel-root {
77
- color: #f16e6e;
78
- }
79
-
80
- &.MuiOutlinedInput-root + .MuiFormHelperText-root {
81
- color: #f16e6e;
82
- }
83
-
84
- &.MuiOutlinedInput-root {
85
- fieldset {
86
- border: 1px solid #f16e6e;
87
- }
88
- }
89
- }
90
- `,fe=({onDelete:t,selected:c,onLoad:s,src:i,alt:l,...f})=>{const u=L({loading:!0});return e.jsxs("div",{style:{position:"relative"},children:[e.jsx("div",{className:"lazy-image-wrapper",style:{visibility:u.loading?"hidden":"visible",background:"#f4f4f4",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"},children:e.jsx("img",{alt:l,src:i,...f,onLoad:()=>{u.loading=!1;try{s==null||s()}catch(x){console.error("image onLoad error: ",x)}},loading:"eager"})}),u.loading&&e.jsx(M,{className:"lazy-image-skeleton",animation:"wave",variant:"rectangular",style:{position:"absolute",top:0}}),e.jsx(ge,{onClick:()=>t(i),sx:{position:"absolute",left:10,bottom:10},children:e.jsx(J,{sx:{fontSize:20}})}),l&&e.jsxs(he,{unstyled:!0,tip:l,sx:{position:"absolute",right:10,bottom:10,fontSize:14,width:"calc(100% - 20px - 10px - 36px)",display:"flex",alignItems:"center"},arrow:!0,tipPlacement:"top",PopperProps:{disablePortal:!0},children:[e.jsx(X,{sx:{fontSize:20,mr:.5}}),e.jsx(z,{sx:{fontSize:14,overflowX:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:l})]}),e.jsx(n,{sx:{position:"absolute",right:8,top:8},onClick:f==null?void 0:f.onClick,children:c?e.jsx(be,{sx:{fontSize:30}}):e.jsx(K,{sx:{fontSize:30,color:"#fff"}})})]})},he=I(se)`
91
- height: 36px;
92
- padding: 8px;
93
- background: rgba(0, 0, 0, 0.42);
94
- color: #f7f8f8;
95
- display: flex;
96
- justify-content: center;
97
- align-items: center;
98
- border-radius: 6px;
99
- color: #fff;
100
- transition: all 0.3s;
101
-
102
- &:hover {
103
- background: rgba(0, 0, 0, 0.69);
104
- }
105
- `,ge=I(Y)`
106
- height: 36px;
107
- width: 36px;
108
- padding: 0;
109
- background: rgba(0, 0, 0, 0.42);
110
- color: #f7f8f8;
111
- display: flex;
112
- justify-content: center;
113
- align-items: center;
114
- border-radius: 6px;
115
- transition: all 0.3s;
116
-
117
- &:hover {
118
- background: rgba(0, 0, 0, 0.69);
119
- }
120
- `,be=I(Q)`
121
- & path:first-of-type {
122
- fill: ${({theme:t})=>{var c,s;return((s=(c=t.palette)==null?void 0:c.primary)==null?void 0:s.main)||"#1976d2"}};
123
- opacity: 1;
124
- }
125
- & path:last-child {
126
- fill: white;
127
- }
128
- `,je=b.lazy(()=>_(()=>import("./lottie-react.esm-D2t-u0YU.js"),__vite__mapDeps([0,1])).then(t=>({default:t.Player})));function R({src:t}){return e.jsx(je,{src:t,loop:!0,autoplay:!0})}function ye({options:t,handleApi:c,onSelect:s,onFinish:i,onClose:l,isMobile:f}){const{loading:u,onLoading:x,restrictions:a,i18n:j}=B(),[d,y]=b.useState([]),[m,k]=b.useState(),P=Z(),S=a==null?void 0:a.maxNumberOfFiles,[h,A]=b.useState({}),p=L({}),O=Object.keys(p).filter(r=>p[r]),F={xs:6,sm:6};b.useEffect(()=>{m&&!h.error&&_(()=>import("./lottie-error-CMOXHtBH.js"),[]).then(r=>{A(o=>({...o,error:r.default}))}),t&&!d.length&&!h.loading&&_(()=>import("./lottie-loading-o-GBrhM9.js"),[]).then(r=>{A(o=>({...o,loading:r.default}))}),!t&&!h.welcome&&_(()=>import("./lottie-welcome-C9B95FIi.js"),[]).then(r=>{A(o=>({...o,welcome:r.default}))})},[m,t,d.length,h]),oe(async()=>{var r;if(t){k(void 0),x(!0);try{const o=await c({...t,responseFormat:"b64_json"});if(o.data){const w=(o.data||[]).map(C=>({src:`data:image/png;base64,${C.b64Json||C.b64_json}`,width:t.size?Number((t.size||"").split("x")[0]):1024,alt:t.prompt}));y(d?[...w,...d]:w)}else k(o)}catch(o){console.error("AIImage generate error: ",o),k(((r=o==null?void 0:o.response)==null?void 0:r.data)||o)}finally{x(!1),i()}}},[t==null?void 0:t.number,t==null?void 0:t.prompt,t==null?void 0:t.size]);const D=r=>{const o=Object.keys(p).filter(w=>p[w]);if(S?o.length<S:!0)p[r]?p[r]=!1:p[r]=!0;else{const w=o.pop();w!==r&&(p[w]=!1),p[r]=!p[r]}},$=r=>{if(d){const o=d.findIndex(v=>v.src===r);o>-1&&(p[r]=!1,d.splice(o,1),y([...d]))}},V=()=>{var o,v;const r={width:((o=document.querySelector(".photo-item img"))==null?void 0:o.offsetWidth)||0,height:((v=document.querySelector(".photo-item img"))==null?void 0:v.offsetHeight)||0};return e.jsx(e.Fragment,{children:Array.from({length:(t==null?void 0:t.number)||1}).map((w,C)=>b.createElement(g,{item:!0,...F,key:C},e.jsx(M,{className:"lazy-image-skeleton",animation:"wave",variant:"rectangular",style:{borderRadius:"12px",...r}})))})},G=()=>m?e.jsxs(n,{width:300,height:300,m:"auto",children:[h.error&&e.jsx(R,{src:h.error},"error"),e.jsx(n,{sx:{textAlign:"center",color:"#25292F",wordBreak:"break-all"},children:m==null?void 0:m.message})]}):d&&Array.isArray(d)&&d.length>0?e.jsxs(e.Fragment,{children:[e.jsx(n,{flexGrow:1,sx:{height:0,overflowX:"hidden",overflowY:"auto"},children:e.jsx(ve,{sx:f?{p:0,border:"none !important"}:{p:2},children:e.jsxs(g,{spacing:2,container:!0,className:"photo-wrapper",children:[u&&e.jsx(V,{}),d.map((r,o)=>b.createElement(g,{item:!0,...F,key:r.src,className:"photo-item"},e.jsx(fe,{...r,selected:p[r.src],style:{objectFit:"cover",cursor:"pointer",transition:"all 0.3s",border:p[r.src]?`2px solid ${P.palette.primary.main}`:"2px solid transparent",WebkitUserDrag:"none",width:"100%",height:"100%"},onClick:()=>{D(r.src)},onDelete:()=>{$(r.src)}})))]})})}),e.jsxs(n,{sx:{mt:2,display:"flex",justifyContent:l?"space-between":"flex-end",button:{borderRadius:"30px",height:40,textTransform:"none"}},children:[l&&typeof l=="function"&&e.jsx(T,{color:"primary",variant:"outlined",onClick:l,children:e.jsx(ee,{})}),e.jsx(T,{color:"primary",variant:"contained",disabled:!O.length||u,onClick:()=>{const r=ne(d,"src");s(O.map(o=>r[o]))},children:O.length?j("aiImageSelectedUse"):j("aiImageSelectedTip")})]})]}):t?e.jsx(n,{width:220,height:220,m:"auto",children:h.loading&&e.jsx(R,{src:h.loading},"loading")}):e.jsx(n,{width:300,height:300,m:"auto",children:h.welcome&&e.jsx(R,{src:h.welcome},"welcome")});return e.jsx(we,{children:G()})}const we=I(n)`
129
- min-height: 100%;
130
- display: flex;
131
- flex-direction: column;
132
-
133
- .lazy-image-wrapper {
134
- border-radius: 12px;
135
-
136
- img {
137
- border-radius: 12px;
138
- }
139
- }
140
-
141
- .tips {
142
- overflow: hidden;
143
- display: -webkit-box;
144
- -webkit-box-orient: vertical;
145
- -webkit-line-clamp: 3;
146
- }
147
- `,ve=I(n)`
148
- display: flex;
149
- flex-direction: column;
150
- background: #fbfbfb;
151
- border: 1px solid #f6f6f6;
152
- border-radius: 12px;
153
- min-height: 100%;
154
-
155
- &:has(.Mui-focused) {
156
- border: 1px solid #a482fe;
157
- }
158
-
159
- > .input {
160
- padding: 12px;
161
- font-weight: 500;
162
- font-size: 16px;
163
- line-height: 19px;
164
- color: #25292f;
165
- }
166
-
167
- > .footer {
168
- display: flex;
169
- align-items: center;
170
- justify-content: flex-end;
171
- padding: 0 12px 12px;
172
-
173
- > .counter {
174
- flex: 1;
175
- overflow: hidden;
176
- text-overflow: ellipsis;
177
- white-space: nowrap;
178
- font-weight: 400;
179
- font-size: 12px;
180
- line-height: 14px;
181
- color: #9397a1;
182
- }
183
-
184
- > .copy {
185
- height: 25px;
186
- width: 25px;
187
- min-width: 0;
188
- padding: 0;
189
- color: #9397a1;
190
- }
191
- }
192
- `;function Le({onSelect:t,api:c,restrictions:s,i18n:i,theme:l}){const[f,u]=b.useState(),[x,a]=b.useState(!1),j=()=>u(void 0),d=()=>a(!1),y=ie(document.body);let m=!!(y&&y.width<768);if(!le())return e.jsx(n,{width:1,height:1,display:"flex",justifyContent:"center",alignItems:"center",children:i("aiKitRequired")});const k=!m||m&&!x,P=!m||m&&x,S=m?d:!1;return e.jsx(de,{restrictions:s,i18n:i,theme:l,children:e.jsx(n,{sx:{display:"flex",width:"100%",height:"100%",bgcolor:"#fff"},children:e.jsxs(g,{container:!0,sx:{flexGrow:1,height:"100%"},children:[e.jsx(g,{item:!0,xs:12,sm:4,sx:{borderRight:{sm:"1px solid #eee"},display:k?"unset":"none"},children:e.jsx(n,{sx:{height:"100%",display:"flex",flexDirection:"column"},children:e.jsx(me,{onSubmit:(...h)=>{a(!0),u(...h)}})})}),e.jsx(g,{item:!0,xs:12,sm:8,sx:{height:"100%",overflow:"hidden",p:2,display:P?"unset":"none"},children:e.jsx(ye,{isMobile:m,options:f,handleApi:c,onSelect:t,onFinish:j,onClose:S})})]})})})}export{Le as default};
@@ -1,141 +0,0 @@
1
- import{u as q,a2 as $,bQ as _,I as be,bR as fe,a4 as ge,ab as je,bx as ye}from"./vendor-ux-did-connect-Dr2W2Pc9.js";import{t as we,m as de,j as ke}from"./vendor-hooks-DXGUREV9.js";import{r as C,b as G}from"./vendor-react-DEoibe3W.js";import{d as X}from"./InfoOutlined-CoMCPk7a.js";import{q as ve,O as Ee}from"./vendor-arcblock-TgIfa3ko.js";import{z as N,E as Ce,F as K,C as ce,t as Te}from"./index-B9ltKwuq.js";import{u as U}from"./dashboard-3gdmABlO.js";import{H as o,j as e,D as Se,aj as Re,t as Ie,aa as f,O as ie,T as S,ab as B,ak as Z,z as Me,y as H,bt as le,bS as Y,ad as W,L as J,A as Q,be as Pe,E as O,I as ee,C as ze,br as De,al as P,ch as $e,X as We,bd as V,bq as Oe,b5 as Ae,ci as qe,cj as Le,b6 as Be,an as He,c1 as Fe,s as pe,v as Ne,ck as Ue,cl as _e,cm as Ke,cn as Ye}from"./vendor-mui-core-BKQDHvL6.js";import{d as Ve}from"./ExpandLess-Ddif_UHH.js";import{b as ue,z as Je,A as Qe}from"./vendor-utils-CjMBJT5V.js";import{C as Ge}from"./confirm-C55dFhba.js";import{A as Xe}from"./actions-CHh4ckCh.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-vveKfojd.js";import"./PlayArrow-gSxq4eiM.js";import"./get-safe-url-BBjUrzRU.js";import"./format-error-BrmqJs5a.js";import"./session-C3Z84LF2.js";import"./use-blocklet-logo-CWUmcmJR.js";import"./dot-DqINfNl1.js";import"./useAsync-CLWvmBXN.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-fdqINXKQ.js";import"./MoreHoriz-D6Wvugul.js";const Ze=t=>{var g,y;const[d,c]=C.useState(null),[a,b]=C.useState(!t),[R,p]=C.useState(null),{blocklet:s}=ce(),l=(y=(g=s==null?void 0:s.site)==null?void 0:g.domainAliases[0])==null?void 0:y.value,v=C.useMemo(()=>{const x={};return d&&(d.sources.forEach(r=>{x[r.did]={source:r,events:[],count:0}}),d.events.forEach(r=>{x[r.source]&&(x[r.source].events.push(r),x[r.source].count+=1)})),x},[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(x){p(x instanceof Error?x:new Error(String(x)))}finally{b(!1)}};return C.useEffect(()=>{T()},[l]),{openEvent:d,setOpenEvent:c,eventsBySource:v,loading:a,error:R,loadData:T}};function te({eventsBySource:t,selectedEvents:d,setSelectedEvents:c,error:a}){const{t:b}=q(),[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]),v=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}))},x=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(le,{control:e.jsx(Y,{onChange:x,checked:l>0&&l===v}),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(J,{disablePadding:!0,sx:{border:"1px solid",borderColor:"divider",borderRadius:"4px"},children:Object.entries(t).map(([r,{source:w,events:j,count:E}],u)=>{const M=s[r]>0,i=s[r]===j.length&&j.length>0,h=R[r];return e.jsxs(G.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(le,{control:e.jsx(Y,{checked:i,indeterminate:M&&!i,onChange:n=>{n.stopPropagation(),y(j,i)}}),label:e.jsxs(f,{sx:{display:"flex",alignItems:"center",gap:1},children:[w.logo&&e.jsx(Pe,{src:w.logo,sx:{width:24,height:24}}),e.jsx(f,{children:w.title||r}),M&&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(ee,{size:"small",edge:"end",children:h?e.jsx(Ve,{}):e.jsx(ve,{})})]})]})}),j.length>0&&e.jsx(ze,{in:h,timeout:"auto",unmountOnExit:!0,children:e.jsx(J,{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}`,k=!!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(Y,{checked:k,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(De,{error:!0,sx:{mt:1},children:a})]})}te.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};te.defaultProps={error:null};function oe({id:t,url:d,description:c,enabledEvents:a,onSubmit:b,onClose:R}){var n;const{t:p}=q(),[s,l]=C.useState({}),{teamDid:v}=U(),{api:T}=N(),{loading:g,error:y,eventsBySource:x}=Ze(),{control:r,handleSubmit:w,formState:{errors:j},reset:E,setValue:u,trigger:M}=Ce({defaultValues:{url:"",description:""}});C.useEffect(()=>{const m=Object.values(s).some(k=>k);u("selectedEvents",m?"valid":""),M("selectedEvents")},[s,u,M]);const i=()=>{l({}),E(),R()},h=async m=>{const k=Object.keys(s).filter(I=>s[I]),z={url:m.url,description:m.description,enabledEvents:k.map(I=>{const[A,L]=I.split("-");return!A||!L?null:{type:A,source:L}}).filter(Boolean)};try{if(t){const I=await T.updateWebhookEndpoint({input:{teamDid:v,id:t,data:z}});$.success(`${p("webhookEndpoint.updateWebhook")} ${p("webhookEndpoint.success")}`),b(I)}else{const I=await T.createWebhookEndpoint({input:{teamDid:v,input:z}});$.success(`${p("webhookEndpoint.createWebhook")} ${p("webhookEndpoint.success")}`),b(I)}}catch(I){$.error(I==null?void 0:I.message)}i()};return C.useEffect(()=>{E({url:d,description:c}),l(a.reduce((m,k)=>(m[`${k.type}-${k.source}`]=!0,m),{}))},[E,l,d,c,a]),e.jsx(Se,{open:!0,onClose:i,maxWidth:"lg",fullWidth:!0,sx:{"& .MuiDialog-paper":{minHeight:600}},children:e.jsxs("form",{onSubmit:w(h),children:[e.jsx(Re,{children:p(t?"webhookEndpoint.editWebhookTitle":"webhookEndpoint.createWebhookTitle")}),e.jsx(Ie,{children:e.jsxs(f,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[e.jsx(K,{name:"url",control:r,rules:{required:p("webhookEndpoint.validation.urlRequired"),pattern:{value:/^(http|https):\/\/[^ "]+$/,message:p("webhookEndpoint.validation.urlInvalid")}},render:({field:m})=>{var k;return e.jsx(ie,{...m,label:p("webhookEndpoint.url.label"),fullWidth:!0,error:!!j.url,helperText:(k=j.url)==null?void 0:k.message})}}),e.jsx(K,{name:"description",control:r,rules:{required:p("webhookEndpoint.validation.descriptionRequired")},render:({field:m})=>{var k;return e.jsx(ie,{...m,label:p("webhookEndpoint.description.label"),fullWidth:!0,multiline:!0,minRows:2,maxRows:4,error:!!j.description,helperText:(k=j.description)==null?void 0:k.message})}}),e.jsx(K,{name:"selectedEvents",control:r,rules:{required:p("webhookEndpoint.validation.eventRequired")},render:({field:m})=>e.jsx("input",{type:"hidden",...m})}),!g&&x&&Object.keys(x).length>0&&e.jsx(te,{eventsBySource:x,selectedEvents:s,setSelectedEvents:l,error:(n=j.selectedEvents)==null?void 0:n.message}),!g&&(!x||Object.keys(x).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(B,{size:20})}),y&&e.jsx(Z,{severity:"error",children:p("webhookEndpoint.loadingError",{message:y==null?void 0:y.message})})]})}),e.jsxs(Me,{sx:{p:"8px 24px 24px"},children:[e.jsx(H,{onClick:i,children:p("common.cancel")}),e.jsx(H,{type:"submit",variant:"contained",color:"primary",children:p(t?"webhookEndpoint.updateWebhook":"webhookEndpoint.saveWebhook")})]})]})})}oe.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};oe.defaultProps={id:null,url:"",description:"",enabledEvents:[],onClose:()=>{}};function xe(t){switch(t){case"enabled":return"success";case"disabled":default:return"default"}}const et=(t="en")=>t==="tw"?"zh":t;function F(t,d="YYYY-MM-DD HH:mm:ss",c="en"){return t?Te(t).locale(et(c)).format(d):"-"}function tt(t){return typeof t=="number"?!1:ue(t)}function ot(t){return t>=200&&t<300}function D(t){const d=tt(t.value);return e.jsxs(e.Fragment,{children:[e.jsxs(P,{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($e,{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(We,{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 ne(t){return e.jsxs(P,{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]})}ne.propTypes={title:o.oneOfType([o.string,o.node]).isRequired,children:o.node,mb:o.number,mt:o.number};ne.defaultProps={children:null,mb:1.5,mt:1.5};const nt=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 se({eventId:t,webhookEndpointId:d,event:c}){const{api:a}=N(),{t:b}=q(),{teamDid:R}=U(),{blocklet:p}=ce(),{data:s,loadMore:l,loadingMore:v,loading:T}=we(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,x]=C.useState(null),r=nt(g);C.useEffect(()=>{!y&&(s!=null&&s.list.length)&&x(s.list[0])},[s==null?void 0:s.list.length,y]);const w=u=>{x(u)};if(T)return e.jsx(B,{});const j=s&&s.list.length<s.paging.total,E=u=>{var M,i,h,n,m;if(u.responseBody&&((M=u.responseBody)!=null&&M.sessionId)&&((i=u.responseBody)!=null&&i.projectId)&&((h=u.responseBody)!=null&&h.agentId)){const k=(m=(n=p==null?void 0:p.site)==null?void 0:n.domainAliases[0])==null?void 0:m.value,z=(p.children||[]).find(A=>{var L;return((L=A==null?void 0:A.meta)==null?void 0:L.name)==="ai-studio"}),I=Je(Qe(`https://${k}`,(z==null?void 0:z.mountPoint)||"","projects",u.responseBody.projectId,"logs/main"),{sessionId:u.responseBody.sessionId,agentId:u.responseBody.agentId});return e.jsx(ee,{sx:{fontSize:20},onClick:()=>window.open(I,"_blank"),children:e.jsx(f,{component:be,icon:fe})})}return null};return e.jsxs(V,{container:!0,spacing:{xs:0,md:1},sx:{height:1},children:[e.jsx(V,{item:!0,xs:12,md:4,height:1,children:ue(Object.keys(r))?e.jsx(S,{color:"text.secondary",children:b("webhookEndpoint.waitingForEvents")}):e.jsxs(e.Fragment,{children:[e.jsx(J,{sx:{maxHeight:"calc(100% - 40px)",py:0,overflowY:"auto"},children:Object.entries(r).map(([u,M])=>e.jsxs(G.Fragment,{children:[e.jsx(Oe,{children:u}),M.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(Ae,{sx:{minWidth:0,mr:1.5},children:ot(i.responseStatus)===!1?e.jsx(qe,{color:"error"}):e.jsx(Le,{color:"success"})}),e.jsx(Be,{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(H,{variant:"text",type:"button",color:"inherit",onClick:l,disabled:v,sx:{color:u=>u.palette.text.disabled},children:b(v?"webhookEndpoint.loadingMore":"webhookEndpoint.loadMore")})})]})}),e.jsxs(V,{item:!0,xs:12,md:8,height:1,children:[y&&e.jsxs(P,{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(_,{language:"json",children:JSON.stringify(y.responseBody,null,2)})]}),e.jsxs(f,{children:[e.jsx(P,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(S,{variant:"h6",children:b("webhookEndpoint.request")})}),e.jsx(_,{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(P,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(S,{variant:"h6",children:b("webhookEndpoint.eventData")})}),e.jsx(_,{language:"json",sx:{margin:0},children:JSON.stringify(c.data,null,2)})]})]})]})}se.propTypes={eventId:o.string,webhookEndpointId:o.string,event:o.shape({type:o.string,data:o.object,request:o.object,requestInfo:o.object})};se.defaultProps={eventId:"",webhookEndpointId:"",event:null};function he({id:t,onClose:d}){var v,T,g,y;const{t:c}=q(),{api:a}=N(),{teamDid:b}=U(),{loading:R,error:p,data:s}=de(()=>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(B,{})}):e.jsxs(st,{direction:"column",sx:{height:{xs:"auto",md:1}},children:[e.jsxs(f,{children:[e.jsxs(P,{direction:"row",justifyContent:"space-between",alignItems:"center",children:[e.jsx(P,{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(P,{direction:"row",alignItems:"center",children:e.jsx(ee,{edge:"end",color:"inherit",onClick:d,children:e.jsx(Fe,{})})})]}),e.jsx(f,{mt:2,children:e.jsxs(P,{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(W,{arrow:!0,title:e.jsx("ul",{style:{padding:0,margin:0},children:l.enabledEvents.map(x=>e.jsx("li",{style:{fontSize:"0.7875rem"},children:x==null?void 0:x.type},x))}),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(W,{arrow:!0,title:(v=l.createUser)==null?void 0:v.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(W,{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(P,{className:"section",flex:1,height:0,overflow:"hidden",children:[e.jsx(ne,{title:c("webhookEndpoint.attempts"),mb:0,mt:4}),e.jsx(P,{height:0,flex:1,overflow:"hidden",children:e.jsx(se,{webhookEndpointId:l.id})})]})]})}he.propTypes={id:o.string.isRequired,onClose:o.func.isRequired};const st=pe(P)``;function me({open:t,onClose:d,id:c}){return e.jsx(He,{anchor:"right",open:t,onClose:d,PaperProps:{sx:{width:"90vw",maxWidth:"1200px"}},children:e.jsx(f,{sx:{height:"100vh",p:3},children:e.jsx(he,{id:c,onClose:d})})})}me.propTypes={open:o.bool.isRequired,onClose:o.func.isRequired,id:o.string.isRequired};function ae(){return null}const re=G.memo(({options:t,columns:d,toolbar:c=!0,footer:a=!0,hasRowLink:b=!1,emptyNodeText:R="",...p})=>{const{locale:s}=q(),l=Ne(g=>g.breakpoints.down("md")),v={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=ae),a||(T.TableFooter=ae),e.jsx(rt,{locale:s,options:{...v,...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(ge,{children:R}),...p,components:T,hasRowLink:b,isMobile:l})});re.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};re.defaultProps={options:{},columns:[],toolbar:!0,footer:!0,hasRowLink:!1,emptyNodeText:null,durable:"",durableKeys:[],data:[],loading:!1,onChange:()=>{},title:null,components:{}};const rt=pe(je)`
2
- .custom-toobar-btns {
3
- gap: 8px;
4
- }
5
-
6
- .MuiPaper-root {
7
- border-radius: 8px;
8
- overflow: hidden;
9
- }
10
- table.MuiTable-root {
11
- outline: 1px solid ${({theme:t})=>t.palette.divider};
12
- border-radius: var(--radius-m, 8px);
13
- overflow: hidden;
14
- }
15
- [class*='MUIDataTable-responsiveBase'] {
16
- outline: 1px solid ${({theme:t})=>t.palette.divider};
17
- border-radius: var(--radius-m, 8px);
18
- }
19
-
20
- th.MuiTableCell-head {
21
- padding: 8px 16px 8px 16px;
22
- text-transform: inherit;
23
- border-bottom: none;
24
- &:first-of-type {
25
- border-top-left-radius: 8px;
26
- padding-left: 20px;
27
- }
28
- &:last-of-type {
29
- border-top-right-radius: 8px;
30
- }
31
- }
32
-
33
- tr.MuiTableRow-root:not(.MuiTableRow-footer):hover {
34
- background: ${({theme:t})=>t.palette.grey[100]};
35
- }
36
- tr.MuiTableRow-root:last-of-type td:first-of-type {
37
- border-bottom-left-radius: 8px;
38
- }
39
-
40
- tr.MuiTableRow-root:last-of-type td:last-of-type {
41
- border-bottom-right-radius: 8px;
42
- }
43
-
44
- tr.MuiTableRow-root:nth-of-type(even) {
45
- background: ${({theme:t})=>t.palette.grey[50]};
46
- }
47
- td.MuiTableCell-root {
48
- border-bottom: none;
49
- padding-top: 12px;
50
- padding-bottom: 12px;
51
- padding-left: 16px;
52
- padding-right: 16px;
53
- &:first-of-type {
54
- padding-left: 20px;
55
- }
56
- &.MuiTableCell-footer {
57
- border: none;
58
- }
59
- }
60
-
61
- .datatable-footer {
62
- .MuiTableRow-root.MuiTableRow-footer {
63
- border: none;
64
- }
65
- table.MuiTable-root {
66
- outline: none;
67
- overflow: hidden;
68
- }
69
- .MuiTablePagination-input {
70
- background: none;
71
- }
72
- div.MuiSelect-select {
73
- padding: 0 24px 0 0;
74
- }
75
- }
76
-
77
- th a,
78
- td a {
79
- text-decoration: none;
80
- display: block;
81
- color: inherit;
82
- &:first-of-type {
83
- padding-left: 0;
84
- }
85
- }
86
-
87
- > div {
88
- overflow: auto;
89
- }
90
- .custom-toobar-title-inner {
91
- display: flex;
92
- align-items: center;
93
- }
94
- @media (max-width: ${({theme:t})=>t.breakpoints.values.md}px) {
95
- th a,
96
- td a {
97
- text-decoration: none;
98
- display: block;
99
- color: inherit;
100
- padding-top: 0;
101
- padding-bottom: 0;
102
- padding-right: 0;
103
- }
104
- tr.MuiTableRow-root {
105
- border: none;
106
- padding: 20px;
107
- display: block;
108
- }
109
- td.MuiTableCell-root:first-of-type {
110
- padding-left: 0;
111
- margin-top: 0;
112
- }
113
- td.MuiTableCell-root {
114
- margin: 0;
115
- margin-top: 8px;
116
- align-items: center;
117
- padding: 0;
118
- flex-wrap: wrap;
119
- flex-direction: ${({mobileTDFlexDirection:t="column"})=>t||"row"};
120
- align-items: ${({mobileTDFlexDirection:t="column"})=>t==="column"?"flex-start":"center"};
121
- justify-content: ${({mobileTDFlexDirection:t="column"})=>t==="column"?"flex-start":"space-between"};
122
- }
123
- td.MuiTableCell-root > div {
124
- margin-bottom: 4px;
125
- }
126
- .MuiTable-root > .MuiTableBody-root > .MuiTableRow-root > td.MuiTableCell-root {
127
- display: flex;
128
- flex-direction: ${({mobileTDFlexDirection:t="column"})=>t||"row"};
129
- align-items: flex-start;
130
- justify-content: ${({mobileTDFlexDirection:t="column"})=>t==="row"?"space-between":"flex-start"};
131
- flex-wrap: ${({mobileTDFlexDirection:t="column"})=>t==="row"?"nowrap":"wrap"};
132
- word-break: break-all;
133
- &.datatables-noprint {
134
- justify-content: center;
135
- }
136
- }
137
- [class*='MUIDataTable-responsiveBase'] tr:not([class*='responsiveSimple']) td.MuiTableCell-body > div {
138
- width: inherit;
139
- }
140
- }
141
- `,it=re;function Pt(){const{teamDid:t}=U(),d=`webhook-endpoints-${t}`,c=ye(d),{t:a}=q(),{api:b}=N(),[R,p]=C.useState(""),[s,l]=C.useState({webhookDetail:{open:!1,id:null},createEdit:{open:!1,id:null,url:"",description:"",enabledEvents:[]},deleteConfirm:null}),[v,T]=ke(d,{defaultValue:{pageSize:c.rowsPerPage||20,page:c.page?c.page+1:1}}),{loading:g,error:y,data:x,refresh:r}=de(()=>b.getWebhookEndpoints({input:{teamDid:t,paging:{page:v.page,pageSize:v.pageSize}}}));C.useEffect(()=>{r()},[v,r]);const w=C.useCallback(async(i,h)=>{try{await b.updateWebhookEndpoint({input:{teamDid:t,id:i.id,data:{status:h?"disabled":"enabled"}}}),r(),$.success(`${a(h?"webhookEndpoint.disable":"webhookEndpoint.enable")}${a("webhookEndpoint.success")}`)}catch(n){$.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(h=>({...h,deleteConfirm:null})),$.success(`${a("common.delete")}${a("webhookEndpoint.success")}`)}catch(h){$.error(h==null?void 0:h.message)}},[b,t,r,a]),E=(i,h)=>{let n=i.page+1;const m=i.searchText||"";if(m!==R){p(m);return}if(h==="changePage"||h==="changeRowsPerPage"){h!=="changePage"&&(n=1);const k={page:n,pageSize:i.rowsPerPage};p(""),T(k)}};if(y)return e.jsx(Z,{severity:"error",children:y.message});if(g||!x)return e.jsx(f,{display:"flex",justifyContent:"center",alignItems:"center",width:1,height:500,children:e.jsx(B,{})});const u=((x==null?void 0:x.list)||[]).filter(i=>{if(!R)return!0;const h=R.toLowerCase();return i.description.toLowerCase().includes(h)||i.url.toLowerCase().includes(h)}),M=[{label:"URL",name:"url",options:{customBodyRenderLite:(i,h)=>{const n=u[h];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,h)=>{const n=u[h];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,h)=>{const n=u[h];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,h)=>{const n=u[h],m=(n==null?void 0:n.status)==="enabled";return e.jsx(Xe,{actions:[{icon:m?e.jsx(Ue,{}):e.jsx(_e,{}),text:a(m?"webhookEndpoint.disable":"webhookEndpoint.enable"),onClick:k=>{k.stopPropagation(),w(n,m)}},{icon:e.jsx(Ke,{}),text:a("common.edit"),onClick:k=>{k.stopPropagation(),l(z=>({...z,createEdit:{open:!0,id:n.id,url:n.url,description:n.description,enabledEvents:n.enabledEvents}}))}},{icon:e.jsx(Ye,{}),text:a("common.delete"),onClick:k=>{k.stopPropagation(),l(z=>({...z,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(I=>({...I,deleteConfirm:null}))}}))}}]})}}}];return e.jsxs(e.Fragment,{children:[e.jsx(it,{durable:d,durableKeys:["page","rowsPerPage"],data:u,columns:M,options:{count:x.count,page:v.page-1,rowsPerPage:v.pageSize,viewColumns:!1,onRowClick:(i,{dataIndex:h})=>{const n=x.list[h];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(P,{gap:1,children:[a("webhookEndpoint.noWebhooksAdded"),e.jsx(H,{variant:"contained",color:"primary",onClick:()=>l(i=>({...i,createEdit:{...i.createEdit,open:!0}})),children:a("webhookEndpoint.createWebhook")})]}),customButtons:[e.jsxs(H,{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(B,{size:16}):e.jsx(Ee,{style:{fontSize:16}}),a("common.create")]},"add")]}),s.webhookDetail.open&&e.jsx(me,{open:!0,onClose:()=>l(i=>({...i,webhookDetail:{open:!1,id:null}})),id:s.webhookDetail.id}),s.createEdit.open&&e.jsx(oe,{onSubmit:r,...s.createEdit,onClose:()=>l(i=>({...i,createEdit:{id:null,url:"",description:"",enabledEvents:[],open:!1}}))}),s.deleteConfirm&&e.jsx(Ge,{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};