@abtnode/blocklet-services 1.16.54-beta-20251017-133309-7d40faa6 → 1.16.54-beta-20251021-070951-25e3083c

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 (237) hide show
  1. package/api/cache.js +1 -1
  2. package/api/index.js +2 -0
  3. package/api/libs/connect/v1.js +2 -2
  4. package/api/libs/connect/v2.js +1 -1
  5. package/api/libs/email.js +1 -1
  6. package/api/libs/push-kit/index.js +2 -2
  7. package/api/middlewares/check-federated.js +4 -4
  8. package/api/middlewares/verify-sig.js +3 -2
  9. package/api/routes/blocklet.js +1 -1
  10. package/api/routes/federated.js +1 -1
  11. package/api/routes/mcp.js +1 -1
  12. package/api/routes/sign.js +388 -0
  13. package/api/routes/user.js +1 -1
  14. package/api/services/auth/connect/receive-transfer-app-owner.js +2 -2
  15. package/api/services/auth/session.js +2 -2
  16. package/api/services/notification/blocklet-events-notifier.js +1 -1
  17. package/api/services/notification/queue.js +2 -1
  18. package/api/socket/channel/component.js +1 -1
  19. package/api/socket/channel/did.js +1 -1
  20. package/api/socket/util.js +4 -2
  21. package/api/util/federated.js +1 -1
  22. package/api/util/index.js +1 -1
  23. package/dist/assets/{AdapterDayjs-T-a0V_gA.js → AdapterDayjs-_MgvkJfN.js} +1 -1
  24. package/dist/assets/{Google-BXi1gq6W.js → Google-BqikEiR8.js} +1 -1
  25. package/dist/assets/{access-control-m0S6yUo8.js → access-control-BoqKXv8e.js} +1 -1
  26. package/dist/assets/{actions-C0hEY5iN.js → actions-DqoNrBDK.js} +1 -1
  27. package/dist/assets/add-component-core-sYAwjN9z.js +768 -0
  28. package/dist/assets/{add-resource-CTnW2X8N.js → add-resource-hzPcoJ0T.js} +1 -1
  29. package/dist/assets/{addon-CPEWVDQ1.js → addon-CS6YZSHC.js} +2 -2
  30. package/dist/assets/{advanced-BQT157yk.js → advanced-J_6wIjW2.js} +2 -2
  31. package/dist/assets/{aigne-CfRlP6kv.js → aigne-CxLs420v.js} +1 -1
  32. package/dist/assets/api-Btn0Tp3W.js +1 -0
  33. package/dist/assets/{appearance-BddR68-e.js → appearance-Bwlo2rIk.js} +1 -1
  34. package/dist/assets/{arrow-down.svg-UHWRwrOh.js → arrow-down.svg-D6V-7qfa.js} +1 -1
  35. package/dist/assets/audit-logs-drM5It_9.js +35 -0
  36. package/dist/assets/{authorize-D9fC-nXh.js → authorize-C2nAxV7L.js} +1 -1
  37. package/dist/assets/{base-chart-CSJD1faI.js → base-chart-C-Raz4Q-.js} +1 -1
  38. package/dist/assets/{base32-iOXf3Dyk.js → base32-ka8Vb9QP.js} +1 -1
  39. package/dist/assets/bind-account-BKkm4lat.js +1 -0
  40. package/dist/assets/{branding-PrRXFhYD.js → branding-BMzG8nKx.js} +5 -5
  41. package/dist/assets/branding-LL49PkTZ.js +1 -0
  42. package/dist/assets/{branding-B_hljukd.js → branding-ZGJRfDDo.js} +1 -1
  43. package/dist/assets/{bundle-avatar-B6pd4JA-.js → bundle-avatar-DLTX9h1v.js} +1 -1
  44. package/dist/assets/button-9InonP1B.js +1 -0
  45. package/dist/assets/click-to-copy-C1mF6WNf.js +1 -0
  46. package/dist/assets/{cloneDeep-D3tVGEyF.js → cloneDeep-C6qewg0C.js} +1 -1
  47. package/dist/assets/{collapse-Cc8IqFzl.js → collapse-BMy0GGFk.js} +1 -1
  48. package/dist/assets/{complete-BpTFnpTf.js → complete-D-B5H4ek.js} +1 -1
  49. package/dist/assets/{component-abZy96kt.js → component-BRcD0ov6.js} +4 -4
  50. package/dist/assets/{config-CRxkGlLw.js → config-BBtGnVxO.js} +1 -1
  51. package/dist/assets/{config-CBb_1lBq.js → config-Cbg3z3uP.js} +5 -5
  52. package/dist/assets/{config-B-efbAjK.js → config-D_zbuwUO.js} +1 -1
  53. package/dist/assets/{config-navigation-V-jkhCe0.js → config-navigation-C1GAik0L.js} +2 -2
  54. package/dist/assets/{config-space-uoEgpVj0.js → config-space-DAd9qYRh.js} +1 -1
  55. package/dist/assets/confirm-G3RZHlkC.js +7 -0
  56. package/dist/assets/{connect-CR6YXL6l.js → connect-BKAyVkDD.js} +1 -1
  57. package/dist/assets/{connect-Bg2fkKdJ.js → connect-BsaKZiRP.js} +1 -1
  58. package/dist/assets/connect-to-CEyhDVUe.js +1 -0
  59. package/dist/assets/{content-layout-DJL10aJT.js → content-layout-oyz1EqNZ.js} +1 -1
  60. package/dist/assets/{create-passport-svg-G2i9OoEB.js → create-passport-svg-_Jak4aT3.js} +1 -1
  61. package/dist/assets/createClass-SqayuDE6.js +1 -0
  62. package/dist/assets/{dashboard-DvbW_coF.js → dashboard-DmRLgkA_.js} +2 -2
  63. package/dist/assets/{delete-confirm-tJr-kQGY.js → delete-confirm-DfQxKTw0.js} +1 -1
  64. package/dist/assets/{did-address-yNLicvuz.js → did-address-CZak4Nzl.js} +1 -1
  65. package/dist/assets/domain-BAM622YE.js +9 -0
  66. package/dist/assets/{domain-action-card-oKAg2vcg.js → domain-action-card-CQGZ0jGR.js} +2 -2
  67. package/dist/assets/domains-CO0Aw1Yc.js +1 -0
  68. package/dist/assets/{email-Bw5lhga1.js → email-Dl8yxP6V.js} +1 -1
  69. package/dist/assets/{empty-spinner-Dqkt-AHg.js → empty-spinner-DYOzicuy.js} +1 -1
  70. package/dist/assets/engine-9k0o50qZ.js +1 -0
  71. package/dist/assets/{exchange-passport-D5N7TuyP.js → exchange-passport-D8yfPLJz.js} +1 -1
  72. package/dist/assets/{form-D9ZwMxUQ.js → form-CNqHi73v.js} +3 -3
  73. package/dist/assets/{form-text-input-BdGN_cNn.js → form-text-input-BAs2p7bF.js} +1 -1
  74. package/dist/assets/{form-wrapper-SZH1FnTd.js → form-wrapper-C8oo_Fdy.js} +1 -1
  75. package/dist/assets/{fuel-DRu4UcZ3.js → fuel-CplPFp5J.js} +1 -1
  76. package/dist/assets/{gen-access-key-Cg1WeFbg.js → gen-access-key-BOCSj0Mk.js} +1 -1
  77. package/dist/assets/{gen-simple-access-key-DPQLOBVf.js → gen-simple-access-key-BtXjt6B3.js} +1 -1
  78. package/dist/assets/get-safe-url-BFcRpP-P.js +1 -0
  79. package/dist/assets/{home-drsp3cTN.js → home-C4yo5X5x.js} +1 -1
  80. package/dist/assets/{iframe-D7RMzvnk.js → iframe-BnDsbRZG.js} +1 -1
  81. package/dist/assets/index-B-TqDd4N.js +6 -0
  82. package/dist/assets/{index-B31Z5yXU.js → index-B-Z_6Rom.js} +1 -1
  83. package/dist/assets/{index-B486VukG.js → index-B4cuO9Xn.js} +1 -1
  84. package/dist/assets/index-BF2QIyXe.js +1 -0
  85. package/dist/assets/{index-CMOR5eza.js → index-BXeml37I.js} +1 -1
  86. package/dist/assets/index-Bg7omuZF.js +120 -0
  87. package/dist/assets/index-BkN8Xhir.js +4 -0
  88. package/dist/assets/{index-4_vQ0fa1.js → index-BnLQoeO-.js} +8 -8
  89. package/dist/assets/{index--FkaQ0Dk.js → index-Bq0J1vuR.js} +4 -4
  90. package/dist/assets/{index-Z2OlxmBy.js → index-C1Dar18k.js} +1 -1
  91. package/dist/assets/{index-BwxEDC7M.js → index-C2BTIEUf.js} +4 -4
  92. package/dist/assets/index-C4jOkJlz.js +7 -0
  93. package/dist/assets/{index-BTb5QwNU.js → index-C80zMKsC.js} +2 -2
  94. package/dist/assets/{index-DC4JoVqO.js → index-CBUhK5iP.js} +7 -7
  95. package/dist/assets/index-CJ-XSW_L.js +281 -0
  96. package/dist/assets/{index-B_9ypeKS.js → index-CVsqBtJa.js} +8 -8
  97. package/dist/assets/{index-D5jPhzpV.js → index-CZin5K15.js} +1 -1
  98. package/dist/assets/{index-DJhcYi8s.js → index-CjkeMMBV.js} +2 -2
  99. package/dist/assets/{index-BMkkWtK-.js → index-ClNZcPUD.js} +1 -1
  100. package/dist/assets/{index-DacQww-t.js → index-CusWQN3w.js} +2 -2
  101. package/dist/assets/{index-DdeHXxqD.js → index-D1efASvL.js} +4 -4
  102. package/dist/assets/{index-CAMegfIe.js → index-D5TNmV3K.js} +1 -1
  103. package/dist/assets/index-DBAtORvP.js +1 -0
  104. package/dist/assets/index-DGdrBC5v.js +55 -0
  105. package/dist/assets/{index-DJgF8q_o.js → index-DOKjY-HO.js} +1 -1
  106. package/dist/assets/{index-DVsdJqbi.js → index-DPyXKBMU.js} +1 -1
  107. package/dist/assets/{index-Dj7hvho1.js → index-DdsyasUE.js} +2 -2
  108. package/dist/assets/{index-DKuLdlGi.js → index-De-Vgsb6.js} +1 -1
  109. package/dist/assets/{index-DD8Xcc3x.js → index-DsXcQxrF.js} +1 -1
  110. package/dist/assets/index-FASRIZyi.js +1039 -0
  111. package/dist/assets/{index-CjUY4wYp.js → index-KLDWx9Xh.js} +1 -1
  112. package/dist/assets/{index-CXs5RZ6g.js → index-NomqB6Iy.js} +1 -1
  113. package/dist/assets/{index-B80ObPIt.js → index-SEBP2NIP.js} +1 -1
  114. package/dist/assets/index-XxymBn5U.js +29 -0
  115. package/dist/assets/{invitation-dxOWwXhI.js → invitation-BUnl3HPw.js} +2 -2
  116. package/dist/assets/{invitations-fxhgBZ7v.js → invitations-C4hW9Ss3.js} +1 -1
  117. package/dist/assets/{invite-BUfTFpm3.js → invite-C3ahxxD9.js} +1 -1
  118. package/dist/assets/{isURL-BWdci4BV.js → isURL-2pkMgw7e.js} +2 -2
  119. package/dist/assets/{issue-passport-CGjo4nFE.js → issue-passport-Ciq2eM7I.js} +1 -1
  120. package/dist/assets/{item-CpRxSfFl.js → item-O0rUCXMz.js} +1 -1
  121. package/dist/assets/{landing-page-BeMOLJet.js → landing-page-CG20_HOe.js} +1 -1
  122. package/dist/assets/{launch-result-message-DZJ76kCs.js → launch-result-message-DWeUg9rM.js} +1 -1
  123. package/dist/assets/{layout-DSuoHJe3.js → layout-1o45g_uH.js} +1 -1
  124. package/dist/assets/{list-gCQikTBu.js → list-C71-rjVf.js} +1 -1
  125. package/dist/assets/list-DINgkvuD.js +103 -0
  126. package/dist/assets/{list-header-BNFs7V0b.js → list-header-BE2kzda_.js} +1 -1
  127. package/dist/assets/localization-DYkMU0eo.js +1 -0
  128. package/dist/assets/{log-BRV1BCFu.js → log-DqmR8QgI.js} +1 -1
  129. package/dist/assets/logger-oH4RP6-F.js +1 -0
  130. package/dist/assets/login-BI9XDtGo.js +1 -0
  131. package/dist/assets/{login-oauth-callback-C2DR5bOf.js → login-oauth-callback-DtnKE3JA.js} +1 -1
  132. package/dist/assets/{logo-uploader-BNfVMS9b.js → logo-uploader-B4ZyAHbx.js} +1 -1
  133. package/dist/assets/{lost-passport-BdOj7Qyw.js → lost-passport-Bjk0xMLc.js} +1 -1
  134. package/dist/assets/{observability-BjKI3tFt.js → observability-Zow0Sv-X.js} +1 -1
  135. package/dist/assets/{omit-CxhCIYKY.js → omit-hhiOJGRf.js} +1 -1
  136. package/dist/assets/{open-window-Dm9n80Az.js → open-window-Dtxc-Syt.js} +1 -1
  137. package/dist/assets/{over-due-invoice-payment-Cg-G2W1o.js → over-due-invoice-payment-Bk50hmsa.js} +1 -1
  138. package/dist/assets/{overview-BFV7mugn.js → overview-CknecGQX.js} +2 -2
  139. package/dist/assets/{page-header-xpG0yfsa.js → page-header-DCvzRay5.js} +1 -1
  140. package/dist/assets/passport-C1l7yRXa.js +1 -0
  141. package/dist/assets/{passport-item-ZjtfZLBd.js → passport-item-Dysdq_0a.js} +1 -1
  142. package/dist/assets/{permission-BZsLoL-d.js → permission-YVbPVhS_.js} +1 -1
  143. package/dist/assets/{playground-DKMlueFr.js → playground-CAOOFQT1.js} +1 -1
  144. package/dist/assets/preferences-BnD1O3qZ.js +1 -0
  145. package/dist/assets/profile-embed-C-sTb3pJ.js +1 -0
  146. package/dist/assets/publish-resource-DyVr3uUG.js +1 -0
  147. package/dist/assets/{react-beautiful-dnd.esm-DG8qQeEC.js → react-beautiful-dnd.esm-sCK871VJ.js} +1 -1
  148. package/dist/assets/{react-stripe.esm-BV6kfV2w.js → react-stripe.esm-Dc9snvfb.js} +1 -1
  149. package/dist/assets/{required-C9DLcn9T.js → required-BGaDOGrj.js} +1 -1
  150. package/dist/assets/runtime-CRB33yxr.js +1 -0
  151. package/dist/assets/{sanitize-m8Fu6XGD.js → sanitize-BEqBHa8a.js} +1 -1
  152. package/dist/assets/sdk-Cl2zdl3A.js +1 -0
  153. package/dist/assets/{section-MSasF4Cx.js → section-C75bzkkL.js} +1 -1
  154. package/dist/assets/{security-DTZHnwsj.js → security-cMS5Z8Ta.js} +3 -3
  155. package/dist/assets/{session-ByI8mrad.js → session-Chl38-LD.js} +1 -1
  156. package/dist/assets/{setup-BUodqoBL.js → setup-C01-2uXI.js} +1 -1
  157. package/dist/assets/{shorten-label-dRmYvYJ7.js → shorten-label-RqvHqcC3.js} +1 -1
  158. package/dist/assets/{simple-select-C-ApYkD4.js → simple-select-DN_9r-L2.js} +1 -1
  159. package/dist/assets/{spaces-Bqe6pnFj.js → spaces-BH2l_OkZ.js} +1 -1
  160. package/dist/assets/{start-DCOjCV4F.js → start-BFh5jV0q.js} +1 -1
  161. package/dist/assets/{starting-progress-_tZGZM6B.js → starting-progress-bX2MhHI_.js} +1 -1
  162. package/dist/assets/status-Cchdz2Py.js +1 -0
  163. package/dist/assets/{step-actions-D_gKO0Cw.js → step-actions-CcUwY5bt.js} +1 -1
  164. package/dist/assets/{studio-DCdXmXUq.js → studio-C0FYSJNq.js} +1 -1
  165. package/dist/assets/{switch-control-Ddqhf44I.js → switch-control-Bn_HYEC5.js} +1 -1
  166. package/dist/assets/{table-tips-BUZ1mtAq.js → table-tips-Crqym4Bn.js} +1 -1
  167. package/dist/assets/team-Bje0MaMX.js +146 -0
  168. package/dist/assets/traffic-CeSX-kN3.js +1 -0
  169. package/dist/assets/{transfer-B4X6jlUA.js → transfer-Ja2mKjqd.js} +2 -2
  170. package/dist/assets/{unsubscribe-xvziXmXe.js → unsubscribe-Dmbg53P8.js} +1 -1
  171. package/dist/assets/{use-app-logo-Cp60-jm5.js → use-app-logo-DhmCQsWv.js} +1 -1
  172. package/dist/assets/{use-mobile-Bjbo_Gou.js → use-mobile-DCNBsOlH.js} +1 -1
  173. package/dist/assets/{use-mobile-CjZIGfWP.js → use-mobile-maRlSUwU.js} +1 -1
  174. package/dist/assets/{use-server-logo-uMEEt675.js → use-server-logo-n_aaKVoZ.js} +1 -1
  175. package/dist/assets/{use-window-close-Coe8kRfa.js → use-window-close-CYqH6r-n.js} +1 -1
  176. package/dist/assets/{useAsync-tu8lmT7w.js → useAsync-BcVLpt2E.js} +1 -1
  177. package/dist/assets/{useAsync-B9mMAdx5.js → useAsync-cZ_FPf9k.js} +1 -1
  178. package/dist/assets/{useAsyncRetry-n96jNDlD.js → useAsyncRetry-DwwEjrjs.js} +1 -1
  179. package/dist/assets/{useLocalStorage-CPNhajTc.js → useLocalStorage-BIH12-5o.js} +1 -1
  180. package/dist/assets/user-center-_0Nuo2NC.js +126 -0
  181. package/dist/assets/{user-follower-Brdja1Pl.js → user-follower-rI_4OXB_.js} +1 -1
  182. package/dist/assets/{util-cUwto1hL.js → util-CVi4JaWM.js} +1 -1
  183. package/dist/assets/{util-d0fh6S9R.js → util-LPNcvj77.js} +1 -1
  184. package/dist/assets/{vendor-arcblock-BzYItNIN.js → vendor-arcblock-DVRwGBYP.js} +114 -115
  185. package/dist/assets/{vendor-hooks-tpeT8a0P.js → vendor-hooks-CjESGRlR.js} +1 -1
  186. package/dist/assets/{vendor-mui-core-BPcN1m8_.js → vendor-mui-core-CnXrAOs3.js} +1 -1
  187. package/dist/assets/{vendor-mui-x-DEgOZXst.js → vendor-mui-x-bJ5idfMH.js} +1 -1
  188. package/dist/assets/vendor-utils-cJEl_UEd.js +213 -0
  189. package/dist/assets/{vendor-ux-D_B1Y7iC.js → vendor-ux-DtnxszG_.js} +10 -10
  190. package/dist/assets/{wait-connect-B4jNvmkx.js → wait-connect-DDuMthnp.js} +1 -1
  191. package/dist/assets/{wizard-BZNmVb4z.js → wizard-Boblk5Le.js} +1 -1
  192. package/dist/assets/{wizard-components-C5WSLWm-.js → wizard-components-DxHb4Zui.js} +1 -1
  193. package/dist/assets/wrap-locale-DTDVuPVv.js +1 -0
  194. package/dist/assets/{zh-BsfsxdYb.js → zh-CeqvJ1eC.js} +1 -1
  195. package/dist/index.html +1 -1
  196. package/dist/service-worker.js +1 -1
  197. package/package.json +38 -37
  198. package/dist/assets/add-component-core-BksM6C--.js +0 -768
  199. package/dist/assets/api-C7Kyuutl.js +0 -1
  200. package/dist/assets/audit-logs-BzqpNyz0.js +0 -35
  201. package/dist/assets/bind-account-DhXOE_rG.js +0 -1
  202. package/dist/assets/branding-BQslHJ3k.js +0 -1
  203. package/dist/assets/button-2y9b8ibp.js +0 -1
  204. package/dist/assets/click-to-copy-PW3ieO34.js +0 -1
  205. package/dist/assets/confirm-2zLPRflS.js +0 -7
  206. package/dist/assets/connect-to-DVzVPrNg.js +0 -1
  207. package/dist/assets/createClass-Bf8maCzZ.js +0 -1
  208. package/dist/assets/domain-orOrS-66.js +0 -9
  209. package/dist/assets/domains-CIKaHlMa.js +0 -1
  210. package/dist/assets/engine-DrB5N6Vq.js +0 -1
  211. package/dist/assets/get-safe-url-BEmXir96.js +0 -1
  212. package/dist/assets/index--OvsXAyb.js +0 -1
  213. package/dist/assets/index-BJkTWRHF.js +0 -281
  214. package/dist/assets/index-BPz1W1F5.js +0 -7
  215. package/dist/assets/index-BnPTSmJZ.js +0 -1041
  216. package/dist/assets/index-Bv1DYw0_.js +0 -55
  217. package/dist/assets/index-CR7OYm8K.js +0 -120
  218. package/dist/assets/index-CcoIHAI8.js +0 -30
  219. package/dist/assets/index-Cs8-XzFL.js +0 -6
  220. package/dist/assets/index-D0c5zNE-.js +0 -1
  221. package/dist/assets/index-Dz7IF3dR.js +0 -4
  222. package/dist/assets/list-DA_a9DhC.js +0 -103
  223. package/dist/assets/localization-NenbMmXN.js +0 -1
  224. package/dist/assets/logger-CHXN98LU.js +0 -1
  225. package/dist/assets/login-DP97VuHR.js +0 -1
  226. package/dist/assets/passport-CQWKOko9.js +0 -1
  227. package/dist/assets/preferences-C5BaFHlg.js +0 -1
  228. package/dist/assets/profile-embed-HIW9YGAc.js +0 -1
  229. package/dist/assets/publish-resource-CG--uFPX.js +0 -1
  230. package/dist/assets/runtime-tvucPK2o.js +0 -1
  231. package/dist/assets/sdk-BGPH_Nn6.js +0 -1
  232. package/dist/assets/status-DAIZaCUT.js +0 -1
  233. package/dist/assets/team-CeANUXFV.js +0 -146
  234. package/dist/assets/traffic-CVF4T2v4.js +0 -1
  235. package/dist/assets/user-center-CdyILvwP.js +0 -126
  236. package/dist/assets/vendor-utils-COYaMdo5.js +0 -213
  237. package/dist/assets/wrap-locale-CsR2MOap.js +0 -1
@@ -1,55 +0,0 @@
1
- import{V as ee,H as O,a3 as X,ad as Ee,ae as Ue,af as We,ag as Ve,s as K,X as je,q as ke,B as Me,p as z,ah as _e,x as Ne,z as $e,A as Ie}from"./vendor-ux-D_B1Y7iC.js";import{b as u,a as H,g as ie,c as He}from"./vendor-hooks-tpeT8a0P.js";import{r as D}from"./vendor-react-Dvs43sk9.js";import{j as e,ak as a,b6 as R,am as ce,y as B,z as F,Q as V,T as Y,I as le,a3 as oe,W as E,b1 as W,bb as qe,cb as Le,cE as Je,at as Fe,D as ye,ah as Be,cF as Oe,a6 as be,cG as Ze,a$ as Ke}from"./vendor-mui-core-BPcN1m8_.js";import{Z as N,ab as M,X as G,bf as se,c as ve,b9 as Ge,av as Ye,Y as Qe}from"./index-BnPTSmJZ.js";import{A as Z,Q as Xe,b as de,Z as et,n as Q,$ as tt,C as nt,a as st}from"./vendor-utils-COYaMdo5.js";import{u as te,C as k,a as De}from"./index.esm-JPZAjt0x.js";import{S as ae}from"./switch-control-Ddqhf44I.js";import{S as y}from"./section-MSasF4Cx.js";import{d as ot}from"./keyboard-arrow-down-rounded-8U0_i9QO.js";import{u as it}from"./index-DD8Xcc3x.js";import{v as at}from"./index-B31Z5yXU.js";import{r as rt}from"./base32-iOXf3Dyk.js";import{u as lt}from"./use-mobile-Bjbo_Gou.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-BzYItNIN.js";import"./required-C9DLcn9T.js";const we={width:24,height:24,body:'<path fill="currentColor" d="M5 4v16V4v5v-5Zm3 10h2.675q.275-.575.638-1.075t.812-.925H8q-.425 0-.713.288T7 13q0 .425.288.713T8 14Zm0 4h2.075Q10 17.5 10 17t.075-1H8q-.425 0-.713.288T7 17q0 .425.288.713T8 18Zm-3 4q-.825 0-1.413-.588T3 20V4q0-.825.588-1.413T5 2h7.175q.4 0 .763.15t.637.425l4.85 4.85q.275.275.425.638t.15.762V10.3q-.475-.15-.975-.225T17 10V9h-4q-.425 0-.713-.288T12 8V4H5v16h5.675q.275.575.638 1.075t.812.925H5Zm12-10q2.075 0 3.538 1.463T22 17q0 2.075-1.463 3.538T17 22q-2.075 0-3.538-1.463T12 17q0-2.075 1.463-3.538T17 12Zm0 8q.275 0 .463-.188t.187-.462q0-.275-.187-.463T17 18.7q-.275 0-.463.188t-.187.462q0 .275.188.463T17 20Zm0-6q-.475 0-.875.238t-.65.637q-.1.15-.025.313t.25.237q.15.075.3 0t.275-.2q.125-.175.313-.275t.412-.1q.325 0 .563.213t.237.537q0 .275-.15.463t-.35.387q-.15.15-.313.3t-.287.35q-.075.15-.113.313t-.037.337q0 .225.125.413t.325.187q.2 0 .325-.15t.125-.35q0-.275.15-.488t.35-.412q.3-.275.525-.613t.225-.737q0-.675-.5-1.138T17 14Z"/>'},ue={enabled:!1,domain:"",clientId:"",clientSecret:""};function ct(){const{api:b}=N(),{blocklet:c}=M(),{t,locale:n}=ee(),o=c?.meta?.did,r=Object.assign({...ue},c?.settings?.oauth?.auth0||{}),{handleSubmit:x,control:i,formState:p,watch:d,reset:f}=te({defaultValues:Z(r,Object.keys(ue))}),l=d("enabled"),j=u(async s=>{try{const{blocklet:I}=await b.configOAuth({input:{did:o,oauth:JSON.stringify({auth0:s})}}),L=Object.assign({...ue},I?.settings?.oauth?.auth0||{});f(L),O.success(t("oauth.saveSuccess"))}catch(I){O.error(I.message||t("oauth.saveFailed"))}}),v=u(s=>s?.trim()?!0:t("oauth.auth0.domainDescription")),S=u(s=>s?.trim()?!0:t("oauth.auth0.clientIdDescription")),g=u(s=>s?.trim()?!0:t("oauth.auth0.clientSecretDescription")),w=u(()=>!0),h=H(()=>n==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-auth0":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-auth0",[n]);return e.jsx(a,{children:e.jsxs("form",{onSubmit:x(j),disabled:!0,children:[e.jsx(y,{title:e.jsxs(a,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx("span",{children:t("oauth.auth0.enable")}),e.jsx(ce,{title:t("oauth.viewDocument"),children:e.jsx(a,{component:"a",sx:{display:"inline-block",color:"inherit",fontSize:0,lineHeight:1},href:h,target:"_blank",rel:"noreferrer",children:e.jsx(X,{icon:we,fontSize:20})})})]}),mb:2.5,children:e.jsx(k,{name:"enabled",control:i,render:({field:s})=>e.jsx(R,{control:e.jsx(ae,{sx:{ml:1},checked:s.value,...s})})})}),e.jsx(y,{title:t("oauth.auth0.domain"),children:e.jsx(k,{name:"domain",control:i,rules:{validate:l?v:w},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.auth0.domain"),error:!!p.errors[s.name],helperText:p.errors[s.name]?.message||" ",disabled:!l})})})}),e.jsx(y,{title:t("oauth.auth0.clientId"),children:e.jsx(k,{name:"clientId",control:i,rules:{validate:l?S:w},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.auth0.clientId"),error:!!p.errors[s.name],helperText:p.errors[s.name]?.message||" ",disabled:!l})})})}),e.jsx(y,{title:t("oauth.auth0.clientSecret"),children:e.jsx(k,{name:"clientSecret",control:i,rules:{validate:l?g:w},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",type:"password",label:t("oauth.auth0.clientSecret"),error:!!p.errors[s.name],helperText:p.errors[s.name]?.message||" ",disabled:!l})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:x(j),disabled:!p.isDirty,children:t("oauth.save")})]})})}const he={enabled:!1,clientId:"",clientSecret:""};function dt(){const{api:b}=N(),{blocklet:c}=M(),{t,locale:n}=ee(),o=c?.meta?.did,r=Object.assign({...he},c?.settings?.oauth?.github||{}),{handleSubmit:x,control:i,formState:p,watch:d,reset:f}=te({defaultValues:Z(r,Object.keys(he))}),l=d("enabled"),j=u(async h=>{try{const{blocklet:s}=await b.configOAuth({input:{did:o,oauth:JSON.stringify({github:h})}}),I=Object.assign({...he},s?.settings?.oauth?.github||{});f(I),O.success(t("oauth.saveSuccess"))}catch(s){O.error(s.message||t("oauth.saveFailed"))}}),v=u(h=>h?.trim()?!0:t("oauth.github.clientIdDescription")),S=u(h=>h?.trim()?!0:t("oauth.github.clientSecretDescription")),g=u(()=>!0),w=H(()=>n==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-github":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-github",[n]);return e.jsx(a,{children:e.jsxs("form",{onSubmit:x(j),disabled:!0,children:[e.jsx(y,{title:e.jsxs(a,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx("span",{children:t("oauth.github.enable")}),e.jsx(ce,{title:t("oauth.viewDocument"),children:e.jsx(a,{component:"a",sx:{display:"inline-block",color:"inherit",fontSize:0,lineHeight:1},href:w,target:"_blank",rel:"noreferrer",children:e.jsx(X,{icon:we,fontSize:20})})})]}),mb:2.5,sx:{"& .section-content":{alignItems:"center"}},children:e.jsx(k,{name:"enabled",control:i,sx:{alignItems:"center"},render:({field:h})=>e.jsx(R,{control:e.jsx(ae,{sx:{ml:1},size:"small",checked:h.value,...h})})})}),e.jsx(y,{title:t("oauth.github.clientId"),children:e.jsx(k,{name:"clientId",control:i,rules:{validate:l?v:g},render:({field:h})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...h,size:"small",label:t("oauth.github.clientId"),error:!!p.errors[h.name],helperText:p.errors[h.name]?.message||" ",disabled:!l})})})}),e.jsx(y,{title:t("oauth.github.clientSecret"),children:e.jsx(k,{name:"clientSecret",control:i,rules:{validate:l?S:g},render:({field:h})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...h,size:"small",type:"password",label:t("oauth.github.clientSecret"),error:!!p.errors[h.name],helperText:p.errors[h.name]?.message||" ",disabled:!l})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:x(j),disabled:!p.isDirty,children:t("oauth.save")})]})})}const me={enabled:!1,clientId:"",clientSecret:""};function ut(){const{api:b}=N(),{blocklet:c}=M(),{t,locale:n}=ee(),o=c?.meta?.did,r=Object.assign({...me},c?.settings?.oauth?.google||{}),{handleSubmit:x,control:i,formState:p,watch:d,reset:f}=te({defaultValues:Z(r,Object.keys(me))}),l=d("enabled"),j=u(async h=>{try{const{blocklet:s}=await b.configOAuth({input:{did:o,oauth:JSON.stringify({google:h})}}),I=Object.assign({...me},s?.settings?.oauth?.google||{});f(I),O.success(t("oauth.saveSuccess"))}catch(s){O.error(s.message||t("oauth.saveFailed"))}}),v=u(h=>h?.trim()?!0:t("oauth.google.clientIdDescription")),S=u(h=>h?.trim()?!0:t("oauth.google.clientSecretDescription")),g=u(()=>!0),w=H(()=>n==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-google":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-google",[n]);return e.jsx(a,{children:e.jsxs("form",{onSubmit:x(j),disabled:!0,children:[e.jsx(y,{title:e.jsxs(a,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx("span",{children:t("oauth.google.enable")}),e.jsx(ce,{title:t("oauth.viewDocument"),children:e.jsx(a,{component:"a",sx:{display:"inline-block",color:"inherit",fontSize:0,lineHeight:1},href:w,target:"_blank",rel:"noreferrer",children:e.jsx(X,{icon:we,fontSize:20})})})]}),mb:2.5,children:e.jsx(k,{name:"enabled",control:i,render:({field:h})=>e.jsx(R,{control:e.jsx(ae,{sx:{ml:1},checked:h.value,...h})})})}),e.jsx(y,{title:t("oauth.google.clientId"),children:e.jsx(k,{name:"clientId",control:i,rules:{validate:l?v:g},render:({field:h})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...h,size:"small",label:t("oauth.google.clientId"),error:!!p.errors[h.name],helperText:p.errors[h.name]?.message||" ",disabled:!l})})})}),e.jsx(y,{title:t("oauth.google.clientSecret"),children:e.jsx(k,{name:"clientSecret",control:i,rules:{validate:l?S:g},render:({field:h})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...h,size:"small",type:"password",label:t("oauth.google.clientSecret"),error:!!p.errors[h.name],helperText:p.errors[h.name]?.message||" ",disabled:!l})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:x(j),disabled:!p.isDirty,children:t("oauth.save")})]})})}const pe={enabled:!1,teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function ht(){const{api:b}=N(),{blocklet:c}=M(),{t}=ee(),n=c?.meta?.did,o=Object.assign({...pe},c?.settings?.oauth?.apple||{}),{handleSubmit:r,control:x,formState:i,watch:p,reset:d}=te({defaultValues:Z(o,Object.keys(pe))}),f=p("enabled"),l=u(async s=>{try{const{blocklet:I}=await b.configOAuth({input:{did:n,oauth:JSON.stringify({apple:s})}}),L=Object.assign({...pe},I?.settings?.oauth?.apple||{});d(L),O.success(t("oauth.saveSuccess"))}catch(I){O.error(I.message||t("oauth.saveFailed"))}}),j=u(s=>s?.trim()?!0:t("oauth.apple.teamIdDescription")),v=u(s=>s?.trim()?!0:t("oauth.apple.serviceIdDescription")),S=u(s=>s?.trim()?!0:t("oauth.apple.keyIdDescription")),g=u(s=>s?.trim()?!0:t("oauth.apple.authKeyDescription")),w=u(s=>s?.trim()?!0:t("oauth.apple.bundleIdDescription")),h=u(()=>!0);return e.jsx(a,{children:e.jsxs("form",{onSubmit:r(l),disabled:!0,children:[e.jsx(y,{title:t("oauth.apple.enable"),mb:2.5,children:e.jsx(k,{name:"enabled",control:x,render:({field:s})=>e.jsx(R,{control:e.jsx(ae,{sx:{ml:1},checked:s.value,...s})})})}),e.jsx(y,{title:t("oauth.apple.teamId"),children:e.jsx(k,{name:"teamId",control:x,rules:{validate:f?j:h},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.apple.teamId"),error:!!i.errors[s.name],helperText:i.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.apple.bundleId"),children:e.jsx(k,{name:"bundleId",control:x,rules:{validate:f?w:h},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.apple.bundleId"),error:!!i.errors[s.name],helperText:i.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.apple.serviceId"),children:e.jsx(k,{name:"serviceId",control:x,rules:{validate:f?v:h},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.apple.serviceId"),error:!!i.errors[s.name],helperText:i.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.apple.keyId"),children:e.jsx(k,{name:"keyId",control:x,rules:{validate:f?S:h},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.apple.keyId"),error:!!i.errors[s.name],helperText:i.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.apple.authKey"),children:e.jsx(k,{name:"authKey",control:x,rules:{validate:f?g:h},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",type:"password",label:t("oauth.apple.authKey"),multiline:!0,rows:4,error:!!i.errors[s.name],helperText:i.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:r(l),disabled:!i.isDirty,children:t("oauth.save")})]})})}const xe={enabled:!1,clientId:"",clientSecret:""};function mt(){const{api:b}=N(),{blocklet:c}=M(),{t}=ee(),n=c?.meta?.did,o=Object.assign({...xe},c?.settings?.oauth?.twitter||{}),{handleSubmit:r,control:x,formState:i,watch:p,reset:d}=te({defaultValues:Z(o,Object.keys(xe))}),f=p("enabled"),l=u(async g=>{try{const{blocklet:w}=await b.configOAuth({input:{did:n,oauth:JSON.stringify({twitter:g})}}),h=Object.assign({...xe},w?.settings?.oauth?.twitter||{});d(h),O.success(t("oauth.saveSuccess"))}catch(w){O.error(w.message||t("oauth.saveFailed"))}}),j=u(g=>g?.trim()?!0:t("oauth.twitter.clientIdDescription")),v=u(g=>g?.trim()?!0:t("oauth.twitter.clientSecretDescription")),S=u(()=>!0);return e.jsx(a,{children:e.jsxs("form",{onSubmit:r(l),disabled:!0,children:[e.jsx(y,{title:e.jsx(a,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsx("span",{children:t("oauth.twitter.enable")})}),mb:2.5,sx:{"& .section-content":{alignItems:"center"}},children:e.jsx(k,{name:"enabled",control:x,sx:{alignItems:"center"},render:({field:g})=>e.jsx(R,{control:e.jsx(ae,{sx:{ml:1},size:"small",checked:g.value,...g})})})}),e.jsx(y,{title:t("oauth.twitter.clientId"),children:e.jsx(k,{name:"clientId",control:x,rules:{validate:f?j:S},render:({field:g})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...g,size:"small",label:t("oauth.twitter.clientId"),error:!!i.errors[g.name],helperText:i.errors[g.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.twitter.clientSecret"),children:e.jsx(k,{name:"clientSecret",control:x,rules:{validate:f?v:S},render:({field:g})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...g,size:"small",type:"password",label:t("oauth.twitter.clientSecret"),error:!!i.errors[g.name],helperText:i.errors[g.name]?.message||" ",disabled:!f})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:r(l),disabled:!i.isDirty,children:t("oauth.save")})]})})}const pt={width:24,height:24,body:'<path fill="currentColor" d="M9 20q-.825 0-1.413-.588T7 18q0-.825.588-1.413T9 16q.825 0 1.413.588T11 18q0 .825-.588 1.413T9 20Zm6 0q-.825 0-1.413-.588T13 18q0-.825.588-1.413T15 16q.825 0 1.413.588T17 18q0 .825-.588 1.413T15 20Zm-6-6q-.825 0-1.413-.588T7 12q0-.825.588-1.413T9 10q.825 0 1.413.588T11 12q0 .825-.588 1.413T9 14Zm6 0q-.825 0-1.413-.588T13 12q0-.825.588-1.413T15 10q.825 0 1.413.588T17 12q0 .825-.588 1.413T15 14ZM9 8q-.825 0-1.413-.588T7 6q0-.825.588-1.413T9 4q.825 0 1.413.588T11 6q0 .825-.588 1.413T9 8Zm6 0q-.825 0-1.413-.588T13 6q0-.825.588-1.413T15 4q.825 0 1.413.588T17 6q0 .825-.588 1.413T15 8Z"/>'};function Re({id:b,title:c,children:t,index:n,onMove:o,defaultExpand:r=!1,onEnd:x,icon:i=null}){const[p,d]=D.useState(r),f=D.useRef(null),l=D.useRef(null),[{handlerId:j},v]=Ee({accept:"dragItem",collect(s){return{handlerId:s.getHandlerId()}},hover(s,I){if(!f.current)return;const L=s.index,m=n;if(L===m)return;const A=f.current?.getBoundingClientRect(),_=l.current?.getBoundingClientRect(),re=(_.bottom-_.top)/2,$=I.getClientOffset().y-A.top;L<m&&$<re||L>m&&$>re||(o(L,m),s.index=m)}}),[{isDragging:S},g]=Ue({item:{index:n,type:"dragItem"},collect:s=>({isDragging:s.isDragging()}),end:x});g(l),v(f);const w=S?.5:1,h=u(s=>{s.preventDefault(),s.stopPropagation(),d(!p)});return e.jsxs(a,{ref:f,children:[e.jsxs(a,{sx:{cursor:"pointer","&:hover":{backgroundColor:"grey.100"}},ref:l,"data-handler-id":j,children:[e.jsxs(a,{sx:{py:2,px:1,opacity:w,display:"flex",alignItems:"center",gap:.5},draggable:!1,onClick:h,children:[e.jsx(a,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:"text.hint","&:hover":{color:"text.secondary"}},children:e.jsx(X,{fontSize:20,icon:pt})}),e.jsx(a,{sx:{display:"flex",alignItems:"center",flexShrink:0,mr:.5,transform:"translateY(-1px)"},children:i}),e.jsx(Y,{sx:{flex:1},children:c}),e.jsx(le,{size:"small",sx:{pointerEvents:"auto",transform:p?"":"rotate(180deg)",transition:"transform 0.3s ease"},children:e.jsx(X,{icon:ot,style:{transform:"scale(1.5)"}})})]}),e.jsx(oe,{})]}),e.jsx(a,{sx:{pl:4,py:2.5,display:p?"block":"none"},children:t})]})}Re.propTypes={title:E.string.isRequired,id:E.string.isRequired,children:E.node.isRequired,index:E.number.isRequired,onMove:E.func.isRequired,onEnd:E.func.isRequired,defaultExpand:E.bool,icon:E.any};const xt=[{name:"github",title:G.PROVIDER_NAME.github,icon:e.jsx(se,{provider:"github",sx:{width:20,height:20}}),component:e.jsx(dt,{})},{name:"google",title:G.PROVIDER_NAME.google,icon:e.jsx(se,{provider:"google",sx:{width:20,height:20}}),component:e.jsx(ut,{})},{name:"apple",title:G.PROVIDER_NAME.apple,icon:e.jsx(se,{provider:"apple",sx:{width:20,height:20}}),component:e.jsx(ht,{})},{name:"twitter",title:G.PROVIDER_NAME.twitter,icon:e.jsx(se,{provider:"twitter",sx:{width:20,height:20}}),component:e.jsx(mt,{})},{name:"auth0",title:G.PROVIDER_NAME.auth0,icon:e.jsx(se,{provider:"auth0",sx:{width:20,height:20}}),component:e.jsx(ct,{})}],ft=["github","google","apple","twitter","auth0"];function gt(){const{api:b}=N(),{blocklet:c}=M(),t=c?.meta?.did,n=c?.settings?.oauth||{},o=Object.keys(n).sort((l,j)=>n[l]?.order!==void 0&&n[j]?.order!==void 0?n[l].order-n[j].order:n[l]?.order!==void 0?-1:1);for(const l of ft)o.includes(l)||o.push(l);const r=ie(o.reduce((l,j,v)=>Object.assign(l,{[j]:v}),{})),x=H(()=>{const l=[...xt];return l.sort((j,v)=>r[j.name]-r[v.name]),l.map(j=>({...j,enabled:n[j.name]?.enabled??!1}))},[r.auth0,r.github,r.google]),i={};typeof window<"u"&&(i.context=window);const p=u(async l=>{const j={};Object.keys(l).forEach(v=>{j[v]={order:l[v]}}),await b.configOAuth({input:{did:t,oauth:JSON.stringify(j)}})}),d=u((l,j)=>{const v=x[l],S=x[j];r[v.name]=j,r[S.name]=l}),f=u(async()=>{await p(r)});return e.jsx(a,{sx:{".section-left":{width:"180px"}},children:e.jsx(We,{backend:Ve,...i,children:x.map((l,j)=>e.jsx(Re,{index:j,id:l.name,title:l.title,icon:l.icon,onMove:d,onEnd:f,defaultExpand:l.enabled,children:l.component},l.name))})})}const J={ttl:ve.SESSION_TTL,cacheTtl:ve.SESSION_CACHE_TTL,email:{enabled:!1,requireVerified:!1,requireUnique:!1,trustOauthProviders:!1,trustedIssuers:[],enableDomainBlackList:!1,domainBlackList:[],enableDomainWhiteList:!1,domainWhiteList:[]},phone:{enabled:!1,requireVerified:!1,requireUnique:!1,regionBlackList:[],trustedIssuers:[]},enableBlacklist:!1};function U(b){return e.jsx(it,{...b,sx:{transform:"scale(0.75)"}})}function fe(b,c=!1){const t=c?b.ttl*86400:b.ttl/86400;return{...b,ttl:t}}function jt(){const{api:b}=N(),{blocklet:c}=M(),t=c?.meta?.did,n=Xe({},J,c?.settings?.session||{});de(n.ttl)&&(n.ttl=J.ttl),de(n.cacheTtl)&&(n.cacheTtl=J.cacheTtl),n.phone||(n.phone=J.phone),n.email||(n.email=J.email),de(n.enableBlacklist)&&(n.enableBlacklist=J.enableBlacklist);const{handleSubmit:o,control:r,formState:x,reset:i,watch:p}=te({defaultValues:Z(fe(n),["ttl","cacheTtl","email","phone","enableBlacklist"])}),{t:d}=ee(),f=p("email.enabled"),l=p("phone.enabled"),j=p("email.enableDomainBlackList"),v=p("email.enableDomainWhiteList"),{fields:S,append:g,remove:w}=De({control:r,name:"email.domainBlackList"}),{fields:h,append:s,remove:I}=De({control:r,name:"email.domainWhiteList"}),L=u(async m=>{try{const{blocklet:A}=await b.updateAppSessionConfig({input:{did:t,config:et(fe(m,!0),["phone"])}}),_=Object.assign({},J,Z(A?.settings?.session||{},["ttl","cacheTtl","email","phone","enableBlacklist"]));i(fe(_)),O.success(d("common.configSuccess"))}catch(A){O.error(A.message)}});return e.jsx(bt,{onSubmit:o(L),children:e.jsxs(W,{direction:"column",sx:{gap:6},children:[e.jsxs(a,{children:[e.jsxs(a,{children:[e.jsx(Y,{variant:"h6",sx:{fontWeight:600},children:d("blocklet.config.session.profile")}),e.jsx(a,{component:oe,sx:{my:3}})]}),e.jsxs(W,{sx:{gap:2},children:[e.jsx(y,{title:d("blocklet.config.session.fullNameEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(a,{sx:{alignSelf:"flex-start"},children:e.jsx(U,{disabled:!0,checked:!0})})}),e.jsx(y,{title:d("blocklet.config.session.avatarEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(a,{sx:{alignSelf:"flex-start"},children:e.jsx(U,{disabled:!0,checked:!0})})}),e.jsx(y,{title:d("blocklet.config.session.emailEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(a,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.enabled",control:r,render:({field:m})=>e.jsx(U,{...m,checked:m.value})})})}),f&&e.jsxs(W,{direction:"column",sx:{ml:2,gap:.5},children:[e.jsx(y,{title:d("blocklet.config.session.emailRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(a,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.requireVerified",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),e.jsx(y,{title:d("blocklet.config.session.emailRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(a,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.requireUnique",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),e.jsx(y,{title:d("blocklet.config.session.emailTrustOauthProviders"),sectionLeftSx:{width:"600px"},children:e.jsx(a,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.trustOauthProviders",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),e.jsx(y,{title:d("blocklet.config.session.enableDomainBlackList"),sectionLeftSx:{width:"600px"},children:e.jsx(a,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.enableDomainBlackList",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),j&&e.jsxs(a,{children:[S.map((m,A)=>e.jsxs(W,{direction:"row",sx:{alignItems:"center",my:1,maxWidth:"720px"},children:[e.jsx(k,{name:`email.domainBlackList.${A}`,control:r,render:_=>e.jsx(F,{..._.field,size:"small",fullWidth:!0})}),e.jsx(le,{onClick:()=>w(A),children:e.jsx(qe,{})})]},m.id)),e.jsx(V,{startIcon:e.jsx(Le,{}),onClick:()=>g(""),children:d("blocklet.config.session.addDomain")})]}),e.jsx(y,{title:d("blocklet.config.session.enableDomainWhiteList"),sectionLeftSx:{width:"600px"},children:e.jsx(a,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.enableDomainWhiteList",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),v&&e.jsxs(a,{children:[h.map((m,A)=>e.jsxs(W,{direction:"row",sx:{alignItems:"center",my:1,maxWidth:"720px"},children:[e.jsx(k,{name:`email.domainWhiteList.${A}`,control:r,render:_=>e.jsx(F,{..._.field,size:"small",fullWidth:!0})}),e.jsx(le,{onClick:()=>I(A),children:e.jsx(qe,{})})]},m.id)),e.jsx(V,{startIcon:e.jsx(Le,{}),onClick:()=>s(""),children:d("blocklet.config.session.addDomain")})]})]}),e.jsxs(a,{sx:{display:"none"},children:[e.jsx(y,{title:d("blocklet.config.session.phoneEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(a,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"phone.enabled",control:r,disabled:!0,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),l&&e.jsxs(W,{direction:"column",sx:{ml:2,mt:1},children:[e.jsx(y,{title:d("blocklet.config.session.phoneRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(a,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"phone.requireVerified",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),e.jsx(y,{title:d("blocklet.config.session.phoneRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(a,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"phone.requireUnique",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})})]})]})]})]}),e.jsxs(a,{children:[e.jsx(Y,{variant:"h6",sx:{fontWeight:600},children:d("blocklet.config.session.period")}),e.jsx(a,{component:oe,sx:{my:3}}),e.jsx(W,{direction:"column",spacing:2,children:e.jsx(k,{name:"ttl",control:r,rules:{min:1,max:30},render:({field:m})=>e.jsx(B,{fullWidth:!0,sx:{mb:2},children:e.jsx(y,{title:d("blocklet.config.session.ttl",{day:m.value}),sectionLeftSx:{width:"600px"},children:e.jsx(a,{sx:{width:"100%",maxWidth:500,px:2},children:e.jsx(Je,{...m,defaultValue:7,step:1,marks:[{value:1,label:d("blocklet.config.session.day",{day:1})},{value:7,label:d("blocklet.config.session.days",{day:7})},{value:14,label:d("blocklet.config.session.days",{day:14})},{value:21,label:d("blocklet.config.session.days",{day:21})},{value:30,label:d("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto"})})})})})})]}),e.jsxs(a,{children:[e.jsx(Y,{variant:"h6",sx:{fontWeight:600},children:d("blocklet.config.session.experimentalSettings")}),e.jsx(a,{component:oe,sx:{my:3}}),e.jsx(W,{direction:"column",spacing:2,children:e.jsx(y,{title:d("blocklet.config.session.enableBlacklist"),sectionLeftSx:{width:"600px"},children:e.jsx(a,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"enableBlacklist",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})})})]}),e.jsx(a,{children:e.jsx(V,{type:"submit",variant:"contained",disabled:!x.isDirty,children:d("oauth.save")})})]})})}const bt=Fe.form`
2
- max-width: 1536px;
3
-
4
- .advanced-config {
5
- border: 0;
6
- padding: 0;
7
- }
8
-
9
- .config-form {
10
- flex-grow: 1;
11
- overflow-y: auto;
12
- will-change: transform;
13
-
14
- &:first-child {
15
- margin: 0;
16
- }
17
-
18
- ${b=>b.theme.breakpoints.down("md")} {
19
- width: 100%;
20
- flex-shrink: 0;
21
- padding: 0 24px;
22
- transform: translate(0, 0);
23
- }
24
- }
25
-
26
- .config-item {
27
- display: flex;
28
- align-items: center;
29
- justify-content: space-between;
30
- }
31
-
32
- .config-desc {
33
- font-weight: normal;
34
- font-size: 12px;
35
- color: #666;
36
- }
37
-
38
- .form-item {
39
- margin-top: 0;
40
- }
41
- `,vt={width:24,height:24,body:'<path fill="currentColor" d="M6 12.05q0 1.125.425 2.188T7.75 16.2l.25.25V15q0-.425.288-.713T9 14q.425 0 .713.288T10 15v4q0 .425-.288.713T9 20H5q-.425 0-.713-.288T4 19q0-.425.288-.713T5 18h1.75l-.4-.35q-1.3-1.15-1.825-2.625T4 12.05Q4 9.7 5.2 7.787T8.425 4.85q.35-.2.738-.025t.512.575q.125.375-.013.75t-.487.575q-1.45.8-2.313 2.213T6 12.05Zm12-.1q0-1.125-.425-2.187T16.25 7.8L16 7.55V9q0 .425-.288.713T15 10q-.425 0-.713-.288T14 9V5q0-.425.288-.713T15 4h4q.425 0 .713.288T20 5q0 .425-.288.713T19 6h-1.75l.4.35q1.225 1.225 1.788 2.663T20 11.95q0 2.35-1.2 4.263t-3.225 2.937q-.35.2-.737.025t-.513-.575q-.125-.375.013-.75t.487-.575q1.45-.8 2.313-2.212T18 11.95Z"/>'};var ge,Ce;function kt(){if(Ce)return ge;Ce=1;const{DEFAULT_IP_DOMAIN_SUFFIX:b,SLOT_FOR_IP_DNS_SITE:c,DEFAULT_DID_DOMAIN:t}=Ge(),{encode:n}=rt();return ge={getIpDnsDomainForBlocklet:x=>`${n(x.meta.did)}-${c}.${b}`,getDidDomainForBlocklet:({did:x,didDomain:i=t})=>`${n(x)}.${i}`},ge}var yt=kt();function Ae({ref:b=null}){const{t:c}=D.useContext(K),{blocklet:t}=M(),{api:n}=N(),o=ie({loadingReject:!1,loadingApprove:!1,mode:"view",show:!1,data:{},callback:Q}),x=ye()?.transitions?.duration?.leavingScreen||300,i=u(()=>{o.mode="view",o.data={},o.callback=Q}),p=u(()=>{o.show=!1,setTimeout(()=>{i()},x)}),d=u(g=>{o.mode="view",o.show=!0,o.data=g}),f=u((g,w=Q)=>{o.mode="approve",o.show=!0,o.data=g,o.callback=w});D.useImperativeHandle(b,()=>({open:d,close:p,approve:f}),[d,p,f]);const l=H(()=>{if(!o.show)return[];o.data.migratedFrom=[o.data.appId,o.data.appPid];const g=["appName","appLogo","appId","appPid","migratedFrom","appDescription","appUrl","version","appliedAt","status","serverId","serverVersion"];return o.data.isMaster!==!1&&tt(g,"appliedAt","status"),g.map(w=>{const h=c(`federated.info.${w}`);let s=o.data[w];if(w==="appName"&&o.data.isMaster&&(s=e.jsxs(a,{children:[e.jsx(Be,{component:Oe}),s]})),["appId","appPid","serverId"].includes(w)&&(s=e.jsx(je,{children:s})),["appUrl"].includes(w)&&(s=e.jsx(a,{component:"a",href:s,target:"_blank",children:s})),["appLogo"].includes(w)){const I=nt(`https://${yt.getDidDomainForBlocklet({did:o.data.appPid})}`,ve.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo");try{const L=new URL(I);L.searchParams.set("imageFilter","resize"),L.searchParams.set("w","80"),L.searchParams.set("h","80"),s=e.jsx("img",{src:L.href,width:"60",height:"60",alt:o.data.appName})}catch{s=e.jsx("img",{src:I,width:"60",height:"60",alt:o.data.appName})}}return w==="status"&&(s=s&&c(`federated.status.${s}`)),w==="migratedFrom"&&(s=(o.data.migratedFrom||[]).filter(m=>![o.data.appId,o.data.appPid].includes(m)).map(m=>e.jsx(je,{children:m}))),st(s)&&(s="-"),{name:h,value:s}})},[o.data]),j=o.mode==="approve",v=u(async()=>{try{o.loadingReject=!0,await n.auditFederatedLogin({input:{memberPid:o.data.appPid,did:t.appPid,status:"rejected"}}),p(),o?.callback(!1)}finally{o.loadingReject=!1}}),S=u(async()=>{try{o.loadingApprove=!0,await n.auditFederatedLogin({input:{memberPid:o.data.appPid,did:t.appPid,status:"approved"}}),p(),o?.callback(!0)}finally{o.loadingApprove=!1}});return e.jsx(ke,{open:o.show,title:c(j?"federated.approveToJoinLogin":"federated.siteDetail"),onClose:p,actions:j?e.jsxs(e.Fragment,{children:[e.jsxs(V,{color:"error",variant:"contained",onClick:v,disabled:o.loadingReject,children:[o.loadingReject?e.jsx(be,{size:16,color:"grey"}):null,c("common.reject")]}),e.jsxs(V,{variant:"contained",onClick:S,disabled:o.loadingApprove,children:[o.loadingApprove?e.jsx(be,{size:16,color:"grey"}):null,c("common.approve")]})]}):e.jsx(V,{variant:"outlined",onClick:p,children:c("common.close")}),children:l.map(g=>e.jsx(at,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:180,name:g.name,children:g.value},g.name))})}Ae.propTypes={ref:E.any};function Se({ref:b=null}){const t=ye()?.transitions?.duration?.leavingScreen||300,{t:n}=D.useContext(K),o=ie({show:!1,data:{link:""}}),r=u(()=>{o.data.link=""}),x=u(()=>{o.show=!1,setTimeout(()=>{r()},t)}),i=u(({link:d})=>{o.show=!0,o.data.link=d});D.useImperativeHandle(b,()=>({open:i,close:x}),[i,x]);const p=u(()=>{He(o.data.link),x()});return e.jsxs(ke,{open:o.show,title:n("federated.joinFederatedLogin"),onClose:x,PaperProps:{style:{minHeight:"unset"}},actions:e.jsx(z,{color:"primary",autoFocus:!0,variant:"contained",onClick:p,children:n("common.copyAndClose")}),children:[e.jsx(a,{sx:{mb:1},children:n("federated.inviteJoinFederatedLoginDescription")}),e.jsx(a,{sx:{"& .copy-button":{display:"none !important"}},children:e.jsx(Me,{language:"shell",style:{marginBottom:0},children:o.data.link})})]})}Se.propTypes={ref:E.any};function Pe({mode:b="member"}){const c=D.useRef(null),t=D.useRef(null),{t:n,locale:o}=D.useContext(K),{blocklet:r,actions:{refreshBlocklet:x}}=M(),{confirmApi:i,confirmHolder:p}=Ye(),{api:d}=N(),f=r.settings.federated?.sites||[],l=r.settings.federated?.config||{},j=l.isMaster!==!1,v=f.find(T=>T.appPid===r.appPid),S=ie({loadingSync:!1}),g=u(T=>{t.current?.open(T)}),w=u(T=>{t.current?.approve(T,x)}),h=u(T=>{i.open({title:n("federated.removeFederatedLogin"),content:n("federated.removeFederatedLoginDescription"),confirmButtonText:n("common.confirm"),cancelButtonText:n("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(C){await d.quitFederatedLogin({input:{did:r.appPid,targetDid:T.appPid}}),C()}})}),s=u(T=>{i.open({title:n("federated.disableFederatedLogin"),content:n("federated.disableFederatedLoginDescription"),confirmButtonText:n("common.confirm"),cancelButtonText:n("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(C){await d.auditFederatedLogin({input:{memberPid:T.appPid,did:r.appPid,status:"revoked"}}),C()}})}),I=u(T=>{i.open({title:n("federated.enableFederatedLogin"),content:n("federated.enableFederatedLoginDescription"),confirmButtonText:n("common.confirm"),cancelButtonText:n("common.cancel"),async onConfirm(C){await d.auditFederatedLogin({input:{memberPid:T.appPid,did:r.appPid,status:"approved"}}),C()}})}),L=H(()=>{const T=[{label:n("common.name"),name:"appName",options:{customBodyRenderLite:C=>{const q=f[C],ne=q.isMaster!==!1;return e.jsx(a,{sx:{display:"inline-block"},children:e.jsxs(a,{component:"a",href:q.appUrl,target:"_blank",onClick:P=>{P.stopPropagation()},sx:{display:"flex",alignItems:"center"},children:[ne&&e.jsx(Be,{component:Oe,style:{marginRight:"4px"}}),q.appName]})})}}},{label:n("common.did"),name:"appId",options:{customBodyRenderLite:C=>{const q=f[C];return e.jsx(je,{children:q.appId})}}},{label:n("common.status"),name:"status",options:{customBodyRenderLite:C=>{const q=f[C],ne=q.isMaster!==!1;return e.jsx(a,{children:ne?"-":n(`federated.status.${q.status}`)})}}}];return j&&T.push({label:n("common.actions"),name:"actions",options:{customBodyRenderLite:C=>{const q=f[C],ne=q.isMaster!==!1;return e.jsx(a,{sx:{display:"flex",gap:1},children:ne?e.jsxs(e.Fragment,{children:[q.status==="rejected"&&e.jsx(z,{variant:"contained",color:"error",size:"small",onClick:P=>{P.stopPropagation()},children:n("federated.status.rejected")}),q.status==="revoked"&&e.jsx(z,{variant:"contained",color:"secondary",size:"small",onClick:P=>{P.stopPropagation()},children:n("federated.status.revoked")})]}):e.jsxs(e.Fragment,{children:[e.jsx(z,{variant:"contained",color:"error",size:"small",onClick:P=>{P.stopPropagation(),h(q)},children:n("federated.quitMember")},"quiteSite"),q.status==="pending"&&e.jsx(z,{variant:"contained",color:"primary",size:"small",onClick:P=>{P.stopPropagation(),w(q)},children:n("federated.status.pending")},"auditSite"),q.status==="approved"&&e.jsx(z,{variant:"contained",color:"error",size:"small",onClick:P=>{P.stopPropagation(),s(q)},style:{whiteSpace:"nowrap"},children:n("federated.revoke")},"revokeSite"),q.status==="revoked"&&e.jsx(z,{variant:"contained",color:"warning",size:"small",onClick:P=>{P.stopPropagation(),I(q)},style:{whiteSpace:"nowrap"},children:n("federated.approve")},"approveSite")]})})}}}),T},[l.appId,f,j,n]),m=H(()=>({sort:!0,download:!1,filter:!1,print:!1,expandableRowsOnClick:!0,onRowClick(T,{dataIndex:C}){const q=f[C];g(q)}}),[]),A=u(()=>{const T=r.environments.find(C=>C.key===G.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_URL);T?.value?c.current?.open({link:T.value}):O.error(n("federated.failedToGetFederatedLoginLink"))},[r.site?.domainAliases?.[0]?.href]),_=u(()=>{i.open({title:n("federated.quitFederatedLogin"),content:n("federated.quitFederatedLoginDescription"),confirmButtonText:n("common.confirm"),cancelButtonText:n("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(T){await d.quitFederatedLogin({input:{did:r.appPid}}),T()}})}),re=u(()=>{i.open({title:n("federated.disbandFederatedLogin"),content:n("federated.disbandFederatedLoginDescription"),confirmButtonText:n("common.confirm"),cancelButtonText:n("common.cancel"),confirmButtonProps:{color:"error"},async onConfirm(T){await d.disbandFederatedLogin({input:{did:r.appPid}}),T()}})}),Te=u(async()=>{try{S.loadingSync=!0,await Promise.all([await d.syncFederatedConfig({input:{did:r.appPid}}),_e(500)]),O.success(n("common.succeeded"))}finally{S.loadingSync=!1}}),$=[];return v.status!=="pending"&&$.push(e.jsx(ce,{title:n("federated.syncConfig"),children:e.jsx(le,{size:"small",onClick:Te,disabled:S.loadingSync,sx:[{"@keyframes spin":{from:{transform:"rotate(0deg)"},to:{transform:"rotate(360deg)"}}},S.loadingSync?{animation:"spin 1s linear infinite"}:{}],children:e.jsx(X,{icon:vt,style:{fontSize:24}})},"syncConfig")})),b==="master"?($.push(e.jsx(z,{size:"small",variant:"contained",onClick:A,sx:{ml:1},children:n("federated.inviteJoinFederatedLogin")},"inviteJoinFederatedLogin")),$.push(e.jsx(z,{color:"error",size:"small",variant:"contained",onClick:re,sx:{ml:1},children:n("federated.disbandFederatedLogin")},"disbandFederatedLogin"))):$.push(e.jsx(z,{size:"small",variant:"contained",color:"error",onClick:_,sx:{ml:1},children:n("federated.quitFederatedLogin")},"quitFederatedLogin")),e.jsxs(e.Fragment,{children:[e.jsx(Ne,{className:"main-table",locale:o,data:f,columns:L,customButtons:$,title:e.jsx(a,{className:"table-toolbar-left",children:n("oauth.federated")}),options:m}),p,e.jsx(Se,{ref:c}),e.jsx(Ae,{ref:t})]})}Pe.propTypes={mode:E.oneOf(["member","master"])};function ze({ref:b=null}){const{t:c}=D.useContext(K),{api:t}=N(),{blocklet:n}=M(),o=n?.appPid,x=ye()?.transitions?.duration?.leavingScreen||300,i=ie({loading:!1,show:!1,appUrl:"",appUrlError:"",callback:Q}),p=u(()=>{i.appUrl="",i.appUrlError="",i.callback=Q}),d=u(()=>{i.show=!1,setTimeout(()=>{p()},x)}),f=u((v=Q)=>{i.show=!0,i.callback=v});D.useImperativeHandle(b,()=>({open:f,close:d}),[f,d]);const l=u(v=>{if(!v)throw new Error(c("federated.federatedJoinAppUrlRequired"));if(!Qe(v))throw new Error(c("federated.federatedJoinAppUrlInvalid"))}),j=u(async()=>{try{l(i.appUrl),i.loading=!0;const v=await t.joinFederatedLogin({input:{did:o,appUrl:i.appUrl}});i.show=!1,d(),i?.callback(v)}catch(v){i.appUrlError=v.message}finally{i.loading=!1}});return e.jsxs(ke,{open:i.show,title:c("federated.joinFederatedLogin"),onClose:d,PaperProps:{style:{minHeight:"unset"}},actions:e.jsxs(z,{color:"primary",autoFocus:!0,variant:"contained",onClick:j,disabled:i.loading,children:[i.loading?e.jsx(be,{size:16,sx:{mr:1},color:"grey"}):null,c("common.confirm")]}),children:[e.jsx(a,{sx:{mb:1},children:c("federated.joinFederatedLoginDescription")}),e.jsx(F,{fullWidth:!0,variant:"outlined",margin:"dense",placeholder:c("federated.federatedJoinAppUrl"),label:c("federated.federatedJoinAppUrl"),value:i.appUrl,error:!!i.appUrlError,helperText:i.appUrlError||"eg: https://www.arcblock.io",onChange:v=>{i.appUrl=v.target.value}})]})}ze.propTypes={ref:E.any};function wt(){const{t:b}=D.useContext(K);return e.jsxs(W,{direction:"row",spacing:2,sx:{alignItems:"flex-start",p:2},children:[e.jsx(Ze,{fontSize:"large",color:"primary"}),e.jsxs(a,{children:[e.jsx(Y,{variant:"h6",gutterBottom:!0,children:b("federated.title")}),e.jsx(Y,{variant:"body2",sx:{color:"text.secondary"},children:b("federated.description")}),e.jsx(Ke,{href:"https://www.arcblock.io/blog/zh/did-connect-federated-login-support",underline:"hover",variant:"body2",color:"primary",target:"_blank",sx:{display:"inline-flex",alignItems:"center",mt:1},children:b("federated.link")})]})]})}function St(){const b=D.useRef(null),c=D.useRef(null),{t}=D.useContext(K),{blocklet:n,actions:{refreshBlocklet:o}}=M(),r=u(()=>{const i=n.site?.domainAliases?.[0]?.href;if(i)try{const p=new URL(i);b.current?.open({link:p.origin})}catch{O.error(t("federated.failedToGetFederatedLoginLink"))}},[n.site?.domainAliases?.[0]?.href]),x=u(()=>{c.current?.open(()=>{o()})});if(n.settings.federated?.sites.length>0){const i=n.settings.federated?.config.isMaster!==!1;return e.jsx(Pe,{mode:i?"master":"member"})}return e.jsxs(e.Fragment,{children:[e.jsx(a,{sx:{display:"flex",flexDirection:"column",gap:2,justifyContent:"center",alignItems:"center",minHeight:"200px"},children:e.jsxs(a,{sx:{maxWidth:400,borderRadius:2,border:"1px solid",borderColor:"divider"},children:[e.jsx(wt,{}),e.jsx(oe,{sx:{width:1}}),e.jsxs(W,{sx:{width:1,p:2,gap:1.5},children:[e.jsx(z,{variant:"contained",onClick:r,sx:{width:1},children:t("federated.inviteJoinFederatedLogin")}),e.jsx(z,{variant:"outlined",onClick:x,sx:{width:1},children:t("federated.joinFederatedLogin")})]})]})}),e.jsx(Se,{ref:b}),e.jsx(ze,{ref:c})]})}function Tt({orientation:b="horizontal"}){const{t:c}=D.useContext(K),t=lt({key:"lg"}),n=[{label:e.jsx(a,{sx:{textAlign:"center",width:"100%"},children:c("oauth.commonSettings")}),value:"settings"},{label:e.jsx(a,{sx:{textAlign:"center",width:"100%"},children:c("oauth.federated")}),value:"federated"},{label:e.jsx(a,{sx:{textAlign:"center",width:"100%"},children:c("oauth.oauth")}),value:"oauth"},{label:e.jsx(a,{sx:{textAlign:"center",width:"100%"},children:c("oauth.moreLogin")}),value:"more"}],[o,r]=D.useState(n[0].value),x=H(()=>({oauth:e.jsx(gt,{}),federated:e.jsx(St,{}),more:e.jsx($e,{children:c("oauth.comingSoon")}),settings:e.jsx(jt,{})}),[c]);return b==="vertical"?e.jsx(It,{children:e.jsxs(W,{direction:{md:"column",lg:"row"},sx:{gap:2},children:[e.jsx(a,{sx:{minWidth:"240px",flexShrink:0},children:e.jsx(Ie,{tabs:n,current:o,orientation:t?"horizontal":"vertical",onChange:r,sx:{borderRight:t?0:1,height:"100%",borderColor:"divider"}})}),e.jsx(a,{sx:{flexGrow:1,minWidth:0},children:e.jsx(a,{sx:{maxWidth:"1200px"},children:x[o]})})]})}):e.jsxs(a,{children:[e.jsx(Ie,{tabs:n,current:o,onChange:r}),e.jsx(a,{sx:{marginTop:"10px"},children:x[o]})]})}Tt.propTypes={orientation:E.oneOf(["horizontal","vertical"])};const It=Fe.div`
42
- .MuiTab-root {
43
- text-align: left;
44
- align-items: flex-start;
45
- font-weight: normal;
46
-
47
- div {
48
- text-align: left;
49
- }
50
- }
51
-
52
- .Mui-selected {
53
- font-weight: bold;
54
- }
55
- `;export{Tt as default};
@@ -1,120 +0,0 @@
1
- import{g as Bt,r as v}from"./vendor-react-Dvs43sk9.js";import{j as e,ak as S,z as X,b6 as me,bg as qe,y as V,am as ut,d7 as Wt,bn as qt,at as ie,b1 as mt,W as p,T as ee,U as Je,d8 as pt,b5 as Ke,a5 as Me,Q as Pe,d9 as Ge,aN as Ue,a6 as ft,D as ht,da as Kt,ad as xt,db as Mt,dc as Ut,c2 as st,n as Ht,J as $t,x as Vt,bc as Jt,M as it,cw as Gt,I as Yt,dd as Qt}from"./vendor-mui-core-BPcN1m8_.js";import{A as gt,J as Xt,C as Zt,e as oe,F as en,a3 as je}from"./vendor-utils-COYaMdo5.js";import{V as te,H as K,p as le,s as tn,A as bt,a2 as nn,aI as sn,m as jt,$ as vt,x as yt,aJ as ke,q as St,J as an,a9 as rn}from"./vendor-ux-D_B1Y7iC.js";import{aG as on,Z as Ye,ab as Ct,av as wt,J as _e,c as B,a0 as Z,o as ln,aO as at}from"./index-BnPTSmJZ.js";import{g as ye,b as $,a as se}from"./vendor-hooks-tpeT8a0P.js";import{u as Rt,C as Y}from"./index.esm-JPZAjt0x.js";import{i as He}from"./isURL-BWdci4BV.js";import{S as Q}from"./section-MSasF4Cx.js";import{A as cn,a as dn,b as un}from"./collapse-Cc8IqFzl.js";import{S as Se}from"./shorten-label-dRmYvYJ7.js";import{v as Tt}from"./index-B31Z5yXU.js";import{R as Nt,A as mn,S as pn,a as fn,B as hn}from"./list-DA_a9DhC.js";import{j as xn,c as gn,N as bn}from"./team-CeANUXFV.js";import{W as jn}from"./did-address-yNLicvuz.js";import{p as It}from"./util-d0fh6S9R.js";import{D as vn,g as yn}from"./traffic-CVF4T2v4.js";import{B as Et}from"./bundle-avatar-B6pd4JA-.js";import{u as Sn}from"./use-mobile-Bjbo_Gou.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-BzYItNIN.js";import"./required-C9DLcn9T.js";import"./server-logo-notext.svg-CKQB0tIp.js";import"./index-B80ObPIt.js";import"./session-ByI8mrad.js";import"./use-app-logo-Cp60-jm5.js";import"./base32-iOXf3Dyk.js";import"./useAsyncRetry-n96jNDlD.js";import"./useAsync-B9mMAdx5.js";import"./iframe-D7RMzvnk.js";import"./index-D0c5zNE-.js";import"./index-DBs9Ljax.js";import"./base-chart-CSJD1faI.js";import"./index-CXs5RZ6g.js";import"./vendor-mui-x-DEgOZXst.js";import"./AdapterDayjs-T-a0V_gA.js";var Re={exports:{}},Te={exports:{}},Ne={exports:{}},rt;function Cn(){return rt||(rt=1,function(t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=n;function n(r){return r==null}t.exports=s.default,t.exports.default=s.default}(Ne,Ne.exports)),Ne.exports}var ot;function wn(){return ot||(ot=1,function(t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=f;var n=o(on()),r=o(Cn());function o(u){return u&&u.__esModule?u:{default:u}}var l=/^(?:[-+]?(?:0|[1-9][0-9]*))$/,j=/^[-+]?[0-9]+$/;function f(u,a){(0,n.default)(u),a=a||{};var y=a.allow_leading_zeroes===!1?l:j,R=!a.hasOwnProperty("min")||(0,r.default)(a.min)||u>=a.min,w=!a.hasOwnProperty("max")||(0,r.default)(a.max)||u<=a.max,b=!a.hasOwnProperty("lt")||(0,r.default)(a.lt)||u<a.lt,E=!a.hasOwnProperty("gt")||(0,r.default)(a.gt)||u>a.gt;return y.test(u)&&R&&w&&b&&E}t.exports=s.default,t.exports.default=s.default}(Te,Te.exports)),Te.exports}var lt;function Rn(){return lt||(lt=1,function(t,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=o;var n=r(wn());function r(l){return l&&l.__esModule?l:{default:l}}function o(l){return(0,n.default)(l,{allow_leading_zeroes:!1,min:0,max:65535})}t.exports=s.default,t.exports.default=s.default}(Re,Re.exports)),Re.exports}var Tn=Rn();const Nn=Bt(Tn),ze={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:"",companyName:"",companyLink:"",companyAddress:"",supportEmail:""};function In(){const{api:t}=Ye(),{blocklet:s}=Ct(),{t:n}=te(),{confirmApi:r,confirmHolder:o}=wt(),l=s?.meta?.did,j=Object.assign({...ze},s?.settings?.notification?.email||{}),{handleSubmit:f,control:u,formState:a,watch:y,reset:R}=Rt({defaultValues:gt(j,Object.keys(ze))}),w=ye({testReceiver:"",testReceiverError:""}),b=y("enabled"),E=$(async(i,C,D=!0)=>{try{const{blocklet:O}=await t.configNotification({input:{did:l,notification:JSON.stringify({email:i})}}),ae=Object.assign({...ze},O?.settings?.notification?.email||{});R(ae),D&&K.success(n("oauth.saveSuccess"))}catch(O){if(D)K.error(O.message||n("oauth.saveFailed"));else throw O}}),J=$(async(i,C,D)=>{try{a.isDirty&&await E(i,C,!1),await t.sendEmail({input:{did:l,receiver:D,email:JSON.stringify({body:"Your SMTP configuration is correct!",title:"Test email",type:"notification",attachments:[{type:"link",data:{url:"https://community.arcblock.io",title:"Community",image:"https://community.arcblock.io/.well-known/service/blocklet/logo-rect-dark",utm:{campaign:"test-campaign"}}}],utm:{content:"test-email-button"}})}}),K.success(n("notification.email.testSuccess"))}catch(O){K.error(O.message||n("notification.email.testfailed"))}}),M=$((i,C)=>{w.testReceiver=localStorage.getItem("test-receiver")||"",w.testReceiverError="",r.open({title:n("notification.email.testSendEmail"),content:()=>e.jsx(S,{sx:{width:"300px"},children:e.jsx(X,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:n("notification.email.inputTestReceiver"),value:w.testReceiver,onChange:D=>{w.testReceiver=D.target.value},error:!!w.testReceiverError,helperText:w.testReceiverError||" "})}),confirmButtonText:n("common.confirm"),cancelButtonText:n("common.cancel"),async onConfirm(D){const O=w.testReceiver?.trim();if(!O){w.testReceiverError=n("notification.email.receiverRequired");return}if(!_e(O)){w.testReceiverError=n("notification.email.receiverInvalid");return}w.testReceiverError="",await J(i,C,O),D()}})}),P=$(i=>{const C=i?.trim();return C?_e(C)?!0:n("notification.email.fromInvalid"):n("notification.email.fromRequired")}),F=$(i=>{const C=i?.trim();return C?He(C,{require_host:!1,protocols:[]})?!0:n("notification.email.hostInvalid"):n("notification.email.hostRequired")}),N=$(i=>i?Nn(i)?!0:n("notification.email.portInvalid"):n("notification.email.portRequired")),W=$(i=>i?.trim()?!0:n("notification.email.userRequired")),q=$(i=>i?.trim()?!0:n("notification.email.passwordRequired")),h=$(i=>i?.trim()&&!He(i,{protocols:["http","https"],require_protocol:!0})?n("notification.email.linkInvalid"):!0),T=$(i=>i?.trim()&&!_e(i)?n("notification.email.emailInvalid"):!0),k=$(()=>!0);return e.jsxs(S,{children:[e.jsxs(En,{component:"form",onSubmit:f(E),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(Q,{title:n("notification.email.enable"),my:2.5,children:e.jsx(Y,{name:"enabled",control:u,render:({field:i})=>e.jsx(me,{control:e.jsx(qe,{checked:i.value,...i})})})}),e.jsx(Q,{title:n("notification.email.from"),children:e.jsx(Y,{name:"from",control:u,rules:{validate:b?P:k},render:({field:i})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...i,size:"small",required:!0,label:n("notification.email.from"),error:!!a.errors[i.name],helperText:a.errors[i.name]?.message||" ",disabled:!b})})})}),e.jsx(Q,{title:n("notification.email.host"),children:e.jsx(Y,{name:"host",control:u,rules:{validate:b?F:k},render:({field:i})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...i,size:"small",required:!0,error:!!a.errors[i.name],label:n("notification.email.host"),helperText:a.errors[i.name]?.message||" ",disabled:!b})})})}),e.jsx(Q,{title:n("notification.email.port"),children:e.jsx(Y,{name:"port",control:u,rules:{validate:b?N:k},render:({field:i})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...i,size:"small",required:!0,type:"number",error:!!a.errors[i.name],label:n("notification.email.port"),helperText:a.errors[i.name]?.message||" ",disabled:!b})})})}),e.jsx(Q,{title:n("notification.email.user"),children:e.jsx(Y,{name:"user",control:u,rules:{validate:b?W:k},render:({field:i})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...i,size:"small",required:!0,error:!!a.errors[i.name],label:n("notification.email.user"),helperText:a.errors[i.name]?.message||" ",disabled:!b})})})}),e.jsx(Q,{title:n("notification.email.password"),children:e.jsx(Y,{name:"password",control:u,rules:{validate:b?q:k},render:({field:i})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...i,size:"small",required:!0,type:"password",error:!!a.errors[i.name],label:n("notification.email.password"),helperText:a.errors[i.name]?.message||" ",disabled:!b})})})}),e.jsx(Q,{title:n("notification.email.secure"),children:e.jsx(Y,{name:"secure",control:u,rules:{validate:k},render:({field:i})=>e.jsx(V,{fullWidth:!0,children:e.jsx(me,{control:e.jsx(qe,{checked:i.value,...i,disabled:!b})})})})}),e.jsxs(cn,{children:[e.jsxs(dn,{expandIcon:e.jsx(qt,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:[n("notification.email.signature"),e.jsx(ut,{title:n("notification.email.signatureTooltip"),children:e.jsx(Wt,{fontSize:"small",sx:{ml:1,cursor:"help"}})})]}),e.jsxs(un,{children:[e.jsx(Q,{title:n("notification.email.companyName"),children:e.jsx(Y,{name:"companyName",control:u,rules:{validate:k},render:({field:i})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...i,size:"small",error:!!a.errors[i.name],label:n("notification.email.companyName"),helperText:a.errors[i.name]?.message||" ",disabled:!b})})})}),e.jsx(Q,{title:n("notification.email.companyLink"),children:e.jsx(Y,{name:"companyLink",control:u,rules:{validate:b?h:k},render:({field:i})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...i,size:"small",error:!!a.errors[i.name],label:n("notification.email.companyLink"),helperText:a.errors[i.name]?.message||" ",disabled:!b})})})}),e.jsx(Q,{title:n("notification.email.companyAddress"),children:e.jsx(Y,{name:"companyAddress",control:u,rules:{validate:k},render:({field:i})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...i,size:"small",error:!!a.errors[i.name],label:n("notification.email.companyAddress"),helperText:a.errors[i.name]?.message||" ",disabled:!b})})})}),e.jsx(Q,{title:n("notification.email.supportEmail"),children:e.jsx(Y,{name:"supportEmail",control:u,rules:{validate:b?T:k},render:({field:i})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...i,size:"small",type:"email",error:!!a.errors[i.name],label:n("notification.email.supportEmail"),helperText:a.errors[i.name]?.message||" ",disabled:!b})})})})]})]}),e.jsxs(S,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(le,{variant:"outlined",color:"warning",onClick:f(M),disabled:!b,children:n("oauth.runTest")}),e.jsx(le,{type:"submit",variant:"contained",disabled:!a.isDirty,children:n("oauth.save")})]})]}),o]})}const En=ie(mt)``,Be={enabled:!1,endpoint:"",did:void 0,pushPath:void 0};function kn(){const{api:t}=Ye(),{blocklet:s}=Ct(),{t:n}=te(),{confirmApi:r,confirmHolder:o}=wt(),l=s?.meta?.did,j=Object.assign({...Be},s?.settings?.notification?.pushKit||{}),{handleSubmit:f,control:u,formState:a,watch:y,reset:R}=Rt({defaultValues:gt(j,Object.keys(Be))}),w=ye({testReceiver:"",testReceiverError:""}),b=y("enabled"),E=$(async(N,W,q=!0)=>{try{const{blocklet:h}=await t.configNotification({input:{did:l,notification:JSON.stringify({pushKit:N})}}),T=Object.assign({...Be},h?.settings?.notification?.pushKit||{});R(T),q&&K.success(n("oauth.saveSuccess"))}catch(h){if(q)K.error(h.message||n("oauth.saveFailed"));else throw h}}),J=$(async(N,W)=>{try{a.isDirty&&await E(N,W,!1);const q=(s?.configs||[]).find(k=>k.key==="BLOCKLET_APP_URL")?.value,h=Xt(Zt(q,B.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo"),{v:s?.meta?.version,t:new Date(s?.updatedAt||0).getTime()}),T={type:"passthrough",passthroughType:"messageStatus",data:{message:{title:"Test push-kit notification",body:"This is message from push-kit config test",sender:{did:s?.appDid,fullName:s?.meta?.title,avatar:h}}}};await t.sendPush({input:{did:l,receiver:w.testReceiver,notification:JSON.stringify(T)}}),K.success(n("notification.pushKit.testSuccess"))}catch(q){K.error(q.message||n("notification.pushKit.testfailed"))}}),M=$((N,W)=>{w.testReceiverError="",r.open({title:n("notification.pushKit.testSend"),content:()=>e.jsx(S,{sx:{width:"450px",maxWidth:"100%"},children:e.jsx(X,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:n("notification.pushKit.inputTestReceiver"),value:w.testReceiver,onChange:q=>{w.testReceiver=q.target.value},error:!!w.testReceiverError,helperText:w.testReceiverError||" "})}),confirmButtonText:n("common.confirm"),cancelButtonText:n("common.cancel"),async onConfirm(q){if(!w.testReceiver?.trim()){w.testReceiverError=n("notification.pushKit.receiverRequired");return}w.testReceiverError="",await J(N,W),q()}})}),P=$(N=>{const W=N?.trim();return W?He(W)?!0:n("notification.pushKit.endpointInvalid"):n("notification.pushKit.endpointRequired")}),F=$(()=>!0);return e.jsxs(S,{children:[e.jsxs(An,{component:"form",onSubmit:f(E),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(Q,{title:n("notification.pushKit.enable"),my:2.5,children:e.jsx(Y,{name:"enabled",control:u,render:({field:N})=>e.jsx(me,{control:e.jsx(qe,{checked:N.value,...N})})})}),e.jsx(Q,{title:n("notification.pushKit.endpoint"),children:e.jsx(Y,{name:"endpoint",control:u,rules:{validate:b?P:F},render:({field:N})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...N,size:"small",required:!0,label:n("notification.pushKit.endpoint"),error:!!a.errors[N.name],helperText:a.errors[N.name]?.message||" ",disabled:!b})})})}),e.jsxs(Q,{title:n("notification.pushKit.customOptions"),children:[e.jsx(Y,{name:"did",control:u,render:({field:N})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...N,size:"small",label:n("notification.pushKit.did"),error:!!a.errors[N.name],helperText:a.errors[N.name]?.message||" ",disabled:!b})})}),e.jsx(Y,{name:"pushPath",control:u,render:({field:N})=>e.jsx(V,{fullWidth:!0,children:e.jsx(X,{...N,size:"small",label:n("notification.pushKit.pushPath"),error:!!a.errors[N.name],helperText:a.errors[N.name]?.message||" ",disabled:!b})})})]}),e.jsxs(S,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(le,{variant:"outlined",color:"warning",onClick:f(M),disabled:!b,children:n("oauth.runTest")}),e.jsx(le,{type:"submit",variant:"contained",disabled:!a.isDirty,children:n("oauth.save")})]})]}),o]})}const An=ie(mt)``,ct=[{label:e.jsx(S,{sx:{textAlign:"center",width:"100%"},children:"Email"}),value:"email"},{label:e.jsx(S,{sx:{textAlign:"center",width:"100%"},children:"Push Kit"}),value:"pushKit"}];function On(){const[t,s]=v.useState(ct[0].value),{locale:n}=v.useContext(tn),r=se(()=>({email:e.jsx(In,{}),pushKit:e.jsx(kn,{})}),[n]),o=v.useMemo(()=>({padding:"10px 0"}),[]);return e.jsxs(S,{children:[e.jsx(bt,{tabs:ct,current:t,onChange:s}),e.jsx(S,{style:o,children:r[t]})]})}const kt=v.createContext({}),{Provider:Dn,Consumer:Ws}=kt;function Ln({children:t,blocklet:s=""}){const{api:n,inService:r,ws:{useSubscription:o}}=Ye(),[l,j]=v.useState([]),[f,u]=v.useState({total:0,pageSize:20,pageCount:0,page:1}),a=se(()=>s.meta?.did,[s]),[y,R]=v.useState([]),[w,b]=v.useState({}),E=se(()=>l.length?new Set(l.map(h=>h.id)):new Set,[l]),J=async({page:h=1,pageSize:T=20,...k}={})=>{if(!a)return[];try{const i={paging:{page:h,pageSize:T},...k,teamDid:a,dateRange:k.dateRange?[Z(k.dateRange[0]).toISOString(),Z(k.dateRange[1]).toISOString()]:void 0},{dids:C,...D}=i;let O="";C&&C.includes("system")&&(O="system");const ae=C?C.filter(pe=>pe!=="system"):[],de={...D,source:O,componentDids:ae},re=await n.getNotificationSendLog({input:de});return b(de),j(re.list),u(re.paging),re.list}catch(i){return K.error(i.message),[]}},M=async()=>{const h=await n.getNotificationComponents({input:{teamDid:a}});R(h.componentDids)},P=v.useCallback(h=>{const T=s.children.find(k=>k.meta?.did===h);if(T)return T.ancestors=[s],T},[s]),F=async({notificationId:h,receivers:T,channels:k,...i})=>{await n.resendNotification({input:{teamDid:a,notificationId:h,receivers:T,channels:k.map(C=>C==="wallet"?B.NOTIFICATION_SEND_CHANNEL.WALLET:C==="pushKit"?B.NOTIFICATION_SEND_CHANNEL.PUSH:C),...i}})},N=v.useCallback(async h=>(await n.getUser({input:{teamDid:a,user:{did:h},options:{enableConnectedAccount:!0}}})).user,[n,a]),W=v.useCallback(async({page:h=1,pageSize:T=20,...k}={})=>{try{const i={paging:{page:h,pageSize:T},...k,userName:k.searchText||"",teamDid:a,dateRange:k.dateRange?[Z(k.dateRange[0]).toISOString(),Z(k.dateRange[1]).toISOString()]:void 0};return await n.getReceivers({input:i})}catch(i){throw K.error(i.message),i}},[n,a]);v.useEffect(()=>{a&&M()},[a]),o(B.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,h=>{E.has(h.notificationId)&&J(w)},[E,w]),o(B.EVENTS.NOTIFICATION_BLOCKLET_CREATE,h=>{E.has(h.id)||J(w)},[E,w]);const q={fetch:J,data:l,paging:f,blocklet:s,getComponent:P,resendNotification:F,getUser:N,componentDids:y,getReceivers:W,inService:r,teamDid:a};return e.jsx(Dn,{value:{notificationRecords:q},children:t})}function Qe(){const{notificationRecords:t}=v.useContext(kt);return t}Ce.propTypes={severity:p.oneOf(Object.values(["info","success","error","warning"])).isRequired};const Pn={info:"primary",success:"success",error:"error",warning:"warning"};function Ce({severity:t="info"}){return e.jsx(nn,{type:Pn[t],children:t})}const Fn=(t,s,n="")=>{if(!n||!s)return"";switch(n){case B.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return t("notification.sendStatus.reason.disabled",{channel:s});case B.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return t("notification.sendStatus.reason.unavailable",{channel:s});case B.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return t("notification.sendStatus.reason.notSent",{channel:s});case B.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return t("notification.sendStatus.reason.offline");default:return n}};function At(t,s,n={}){const{status:r,updatedAt:o,reason:l="",channel:j="wallet"}=n,f=o?t("notification.sendStatus.sentTime",{date:ln(o,s)}):"",u=Fn(t,j,l);return r===B.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:t("notification.sendStatus.failed"),sentTime:f,reason:u}:r===B.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:t("notification.sendStatus.success"),sentTime:f}:{status:"pending",title:t("notification.sendStatus.pending"),reason:u,sentTime:f}}const $e={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Ve=["wallet","pushKit","email"],dt=["info","success","error","warning"],Ot=t=>{const{settings:s}=t;return s?.notification?.email?.enabled},Dt=t=>{const{settings:s}=t;return s?.notification?.pushKit?.enabled},_n=(t,s)=>{const n=oe(s,"extra.notifications.email",!0);return{available:Ot(t),enabled:n}},zn=(t,s)=>{const n=oe(s,"extra.notifications.push",!0);return{available:Dt(t),enabled:n}},Bn=t=>({enabled:oe(t,"extra.notifications.wallet",!0)}),Wn=t=>({enabled:oe(t,"extra.webhooks",[]).length>0}),Ie=(t=3)=>new Promise(s=>{setTimeout(()=>{s()},t*1e3)}),qn=(t,s)=>s==="wallet"||s==="webhook"?[{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:s==="pushKit"||s==="email"?[{channel:s,type:"available",pass:t("notification.sendStatus.reason.available",{channel:s}),fail:t("notification.sendStatus.reason.unavailable",{channel:s})},{channel:s,type:"enabled",pass:t("notification.sendStatus.reason.enabled",{channel:s}),fail:t("notification.sendStatus.reason.disabled",{channel:s})}]:[],Ee=(t=[])=>{const s=Z().startOf("day");return t.filter(n=>Z(n.sendAt).isSame(s,"day")).length},Kn=(t,s="")=>{if(s&&Ve.includes(s)){const l=`${s}SendRecord`,j=oe(t,l,[]);return Ee(j)}const n=oe(t,"webhook",{}),r=Object.keys(n??{})??[];if(s&&r.includes(s)){const l=n[s]??[];return Ee(l)}const o={};return Ve.forEach(l=>{const j=`${l}SendRecord`,f=oe(t,j,[]),u=Ee(f);o[l]=u}),r.length>0&&r.forEach(l=>{const j=n[l]??[],f=Ee(j);o[l]=f}),o},Ae=(t,s,n)=>{if(!Array.isArray(t))throw new Error("Invalid filterList or index");return t[n].splice(s,1),t},Oe=(t,s)=>{if(!Array.isArray(s))throw new Error("filters must be an array");return s.length?!s.includes(t):!1},Mn=t=>{switch(t){case B.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case B.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case B.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case B.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},Lt=()=>({components:{MUIDataTableFilter:{styleOverrides:{header:{marginBottom:0,p:{margin:0}},root:{"& .MuiGrid-container":{marginTop:0,"& .MuiGrid-item":{paddingTop:0}}}}},MuiPopover:{styleOverrides:{root:{"&.MuiPopover-root":{"& .MuiPaper-root:has(.filter-container)":{width:"420px"}}}}}}});function ce({config:t,enableTooltip:s=!0,showTitle:n=!1,children:r=null}){const{status:o,title:l="",sentTime:j="",reason:f=""}=t,u=[l,f].filter(Boolean).join(", ");return e.jsx(ut,{title:s?e.jsxs(e.Fragment,{children:[e.jsx(ee,{color:"inherit",sx:{fontSize:12},children:u}),e.jsx("span",{children:j})]}):null,arrow:!0,placement:"top",children:e.jsxs(S,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(S,{sx:{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx(S,{style:{opacity:.15},sx:{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:$e[o]}}),e.jsx(S,{sx:{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:$e[o]}})]}),e.jsx(ee,{color:"inherit",sx:{fontSize:12},children:n?l:r})]})})}ce.propTypes={config:p.object.isRequired,enableTooltip:p.bool,showTitle:p.bool,children:p.node};De.propTypes={list:p.array.isRequired,label:p.string.isRequired,onDelete:p.func};function De({list:t,label:s,onDelete:n=()=>{}}){const{t:r,locale:o}=te();return e.jsxs(S,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsxs(ee,{children:[s,": "]}),t.map(l=>{const j=At(r,o,{status:l});return e.jsx(Je,{size:"small",label:e.jsx(S,{sx:{display:"flex",alignItems:"center",gap:"4px"},children:e.jsx(ce,{config:j,enableTooltip:!1,children:j.title})}),onDelete:f=>n(f,l)},l)})]})}Xe.propTypes={filterList:p.array.isRequired,onChange:p.func.isRequired,index:p.number.isRequired,column:p.object.isRequired,filterValues:p.array.isRequired,label:p.string.isRequired,renderLabel:p.func.isRequired};function Xe({filterList:t,onChange:s,index:n,column:r,filterValues:o,label:l,renderLabel:j}){return e.jsxs(V,{className:"filter-container",children:[e.jsx(pt,{component:"legend",children:l}),e.jsx(Ke,{row:!0,children:o.map(f=>e.jsx(me,{control:e.jsx(Me,{checked:t[n].indexOf(f.value??f)>-1,onChange:u=>{const a=[...t];u.target.checked?a[n]=[...a[n],f.value??f]:a[n]=a[n].filter(y=>y!==(f.value??f)),s(a[n],n,r)},name:f.value??f}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:j(f)})},f.value??f))})]})}function We(t){return e.jsx(Xe,{...t,renderLabel:s=>e.jsx(ce,{enableTooltip:!1,config:{status:s.status},children:s.label})})}xe.propTypes={status:p.number.isRequired,updatedAt:p.string.isRequired,reason:p.string,channel:p.string,onResend:p.func};function xe({status:t,updatedAt:s,reason:n="",channel:r="wallet",onResend:o}){const{t:l,locale:j}=te(),f=At(l,j,{status:t,updatedAt:s,reason:n,channel:r});return e.jsxs(S,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(ce,{config:f,showTitle:!0}),f.status!=="success"&&e.jsx(Pe,{className:"resend-btn",size:"small",startIcon:e.jsx(Ge,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:o,children:l("notification.resend")})]})}Ze.propTypes={value:p.array.isRequired,onChange:p.func};function Ze({value:t,onChange:s}){const{locale:n}=te(),r=Z().toDate(),[o,l]=v.useState(null),j=v.useCallback(a=>{l(o?null:a.currentTarget)},[o]),f=!!o,u=v.useCallback(a=>{if(!a.startDate||!a.endDate){K.error("Please select a date range");return}if(Z(a.startDate).isAfter(a.endDate)||!Z(a.startDate).isValid()||!Z(a.endDate).isValid()){K.error("Invalid date range");return}s([a.startDate,a.endDate]),l(null)},[s]);return e.jsxs("div",{children:[e.jsx(ee,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},sx:{mb:0},children:e.jsxs(Pe,{onClick:j,variant:"outlined",size:"small",color:"inherit",children:[at(t[0],n)," - ",at(t[1],n)]})}),e.jsx(Ue,{open:f,anchorEl:o,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(vn,{open:!0,maxDate:r,initialDateRange:{startDate:t[0],endDate:t[1]},toggle:j,definedRanges:yn(r),onChange:u})})]})}et.propTypes={itemComponent:p.elementType.isRequired};function et({itemComponent:t,...s}){const{t:n}=te();return!s?.filterList?.filter(o=>o.length).length?null:e.jsxs(S,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsx("div",{className:"toolbar-filter-title",children:n("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(sn.TableFilterList,{...s,ItemComponent:t})})]})}function tt({label:t,onDelete:s,canDelete:n=()=>!0,...r}){const o=s&&typeof s=="function"?s:void 0;let l=!0;return n&&typeof n=="function"&&(l=n({label:t,...r})),e.jsx(Je,{label:t,variant:"outlined",...o&&l?{onDelete:o}:{}})}tt.propTypes={label:p.string.isRequired,onDelete:p.func,canDelete:p.func};const Un=[{label:"Wallet",value:"app",checked:!0},{label:"Email",value:"email",checked:!0},{label:"Push Kit",value:"push",checked:!0},{label:"Webhook",value:"webhook",checked:!0}];Pt.propTypes={loading:p.bool,onCancel:p.func,onConfirm:p.func};function Pt({loading:t=!1,onCancel:s=()=>{},onConfirm:n=()=>{}}){const{t:r}=te(),[o,l]=v.useState(Un),[j,f]=v.useState(!0),u=(y,R)=>{R.checked=y.target.checked;const w=o.map(b=>({...b,checked:b.value===R.value?R.checked:b.checked}));l(w)},a=y=>{y.stopPropagation(),n({channels:o.filter(R=>R.checked).map(R=>R.value),isResendFailedOnly:j})};return e.jsxs(S,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(ee,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(S,{className:"choose-channel",children:e.jsxs(V,{component:"fieldset",variant:"standard",children:[e.jsx(pt,{component:"legend",children:r("notification.selectChannels")}),e.jsx(Ke,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:o.map(y=>e.jsx(me,{control:e.jsx(Me,{checked:y.checked,onChange:R=>u(R,y),name:y.value}),label:y.label},y.value))})]})}),e.jsx(S,{className:"resend-config-footer",children:e.jsx(Ke,{children:e.jsx(me,{control:e.jsx(Me,{checked:j,onChange:y=>f(y.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(S,{className:"resend-config-footer-tip",sx:{display:"flex",justifyContent:"flex-end",gap:1},children:[e.jsx(Pe,{onClick:y=>{y.stopPropagation(),s()},color:"inherit",children:r("common.cancel")}),e.jsxs(Pe,{onClick:a,color:"primary",disabled:t,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[t&&e.jsx(ft,{size:16}),r("common.confirm")]})]})]})}Ft.propTypes={notificationId:p.string.isRequired,handleResend:p.func,resending:p.bool};function Ft({notificationId:t,handleResend:s,resending:n=!1}){const{t:r,locale:o}=te(),l=ht(),j=v.useMemo(()=>jt(l,Lt()),[l]),{getReceivers:f,inService:u,teamDid:a,getUser:y,blocklet:R}=Qe(),[w,b]=v.useState(!1),[E,J]=v.useState([]),M=ye({anchorEl:null,position:null}),P=ye({anchorEl:null,position:null}),[F,N]=v.useState(null),[W,q]=v.useState({total:0,pageSize:10,pageCount:0,page:1}),[h,T]=v.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[Z().subtract(1,"month").startOf("day").toDate(),Z().endOf("day").toDate()]}),[k,i]=v.useState([]),C=[{label:r("notification.sendStatus.pending"),value:0,status:"pending"},{label:r("notification.sendStatus.success"),value:1,status:"success"},{label:r("notification.sendStatus.failed"),value:2,status:"failed"}],D=async()=>{if(!w&&t)try{b(!0);const c=await f({notificationId:t,...h}),d=c.list.map(m=>({...m,receiverUser:{...m.receiverUser,avatar:It(m.receiverUser.avatar,a,u)}}));J(d),q(c.paging),b(!1)}catch(c){K.error(c.message),b(!1)}};v.useEffect(()=>{D()},[h]);const O=c=>{c.stopPropagation();const d=c.currentTarget;P.anchorEl=d;const m=d.getBoundingClientRect();P.position={top:m.top+window.scrollY,left:m.left+window.scrollX}},ae=c=>c.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(le,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(Ge,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:O,children:r("notification.resend")})}):null,de={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:W.page-1,rowsPerPage:W.pageSize,count:W.total,searchText:h.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:k,onRowSelectionChange:(c,d)=>{i(d.map(m=>m.dataIndex))},customToolbarSelect:ae},re=({page:c,rowsPerPage:d,searchText:m,filterList:A})=>{const[,U=[],ne=[],G=[]]=A;h.pageSize!==d?T(H=>({...H,pageSize:d,page:1})):h.page!==c+1?T(H=>({...H,page:c+1})):h.searchText!==m?T(H=>({...H,searchText:m,page:1})):je(U,h.walletSendStatus)?je(ne,h.pushKitSendStatus)?je(G,h.emailSendStatus)||T(H=>({...H,emailSendStatus:G,page:1})):T(H=>({...H,pushKitSendStatus:ne,page:1})):T(H=>({...H,walletSendStatus:U,page:1}))},pe=v.useCallback(async(c,d)=>{if(!d)return!1;const m=await y(d);return m?c==="wallet"?Bn(m):c==="email"?_n(R,m):c==="pushKit"?zn(R,m):c==="webhook"?Wn(m):!0:!1},[y,R]),Fe=v.useCallback(c=>qn(r,c),[r]),ue=()=>{M.anchorEl=null,M.position=null,N(null)},fe=()=>{P.anchorEl=null,P.position=null},we=async(c,d,m=!0,A="")=>{if(!(!d.length||!c.length))try{s(c,d,m,A),P.anchorEl||(await Ie(.5),ue())}catch(U){console.error("handleResend error",{error:U})}},g=async({channels:c,isResendFailedOnly:d})=>{const m=k.map(A=>E[A].receiver);await we(c,m,d),await Ie(.5),fe(),i([])},x=async(c,d=[],m=!0)=>{try{await we(["webhook"],[c.receiver],m,d)}catch(A){K.error(A.response?A.response.statusText:A.message)}},I=async(c,d,m,A=[],U=!0)=>{if(c.stopPropagation(),Kn(d,m)>=4){K.warning(r("notification.resendLimit"));return}if(!Ve.includes(m)){await x(d,A,U);return}if(c){const G=c.currentTarget,H=G.getBoundingClientRect();M.anchorEl=G,M.position={top:H.top+window.scrollY,left:H.left+window.scrollX}}N({channel:m});try{const G=await pe(m,d.receiver);await Ie(1),N({channel:m,result:G}),(typeof G=="boolean"&&G||en(G)&&Object.values(G).every(H=>!!H))&&(await s([m],[d.receiver],U),P.anchorEl||(await Ie(.5),ue()))}catch(G){K.error(G.message)}},_=c=>{T(d=>({...d,dateRange:c,page:1}))},z=(c,d,m,A)=>{c.stopPropagation();const U=m.filter(ne=>ne!==d);T(ne=>({...ne,[A]:U,page:1}))},L=se(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:c=>{const{receiverUser:d,receiver:m}=E[c];return d?e.jsxs(S,{"data-cy":`member-name-${d.fullName}`,sx:{display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start"},children:[e.jsx(vt,{src:`${d.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:m,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(Se,{children:d.fullName})]},m):e.jsx(jn,{size:14,responsive:!1,compact:!0,copyable:!1,did:m})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:h.walletSendStatus??[],customFilterListOptions:{render:c=>e.jsx(De,{list:c,label:"Wallet",onDelete:(d,m)=>{d.stopPropagation(),z(d,m,L[1].options.filterList,"walletSendStatus")}}),update:Ae},filterOptions:{names:C,fullWidth:!0,logic:Oe,display:(c,d,m,A)=>e.jsx(We,{label:"Wallet",filterList:c,onChange:d,index:m,column:A,filterValues:C})},customBodyRenderLite:c=>{const{walletSendStatus:d,walletSendAt:m,walletSendFailedReason:A}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:A,channel:"wallet",onResend:U=>I(U,E[c],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{pushKitSendStatus:d,pushKitSendAt:m,pushKitSendFailedReason:A}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:A,channel:"pushkit",onResend:U=>I(U,E[c],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:h.pushKitSendStatus??[],customFilterListOptions:{render:c=>e.jsx(De,{list:c,label:"Push Kit",onDelete:(d,m)=>{d.stopPropagation(),z(d,m,L[2].options.filterList,"pushKitSendStatus")}}),update:Ae},filterOptions:{names:C,fullWidth:!0,logic:Oe,display:(c,d,m,A)=>e.jsx(We,{label:"Push Kit",filterList:c,onChange:d,index:m,column:A,filterValues:C})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{emailSendStatus:d,emailSendAt:m,emailSendFailedReason:A}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:A,channel:"email",onResend:U=>I(U,E[c],"email",[],!1)})},filter:!0,filterType:"custom",filterList:h.emailSendStatus??[],customFilterListOptions:{render:c=>e.jsx(De,{list:c,label:"Email",onDelete:(d,m)=>{d.stopPropagation(),z(d,m,L[3].options.filterList,"emailSendStatus")}}),update:Ae},filterOptions:{names:C,fullWidth:!0,logic:Oe,display:(c,d,m,A)=>e.jsx(We,{label:"Email",filterList:c,onChange:d,index:m,column:A,filterValues:C})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{webhook:d}=E[c];if(!d)return null;const m=Object.entries(d)[0];if(!m)return null;const[A,U]=m,ne=U[0];return e.jsx(S,{sx:{display:"flex",flexDirection:"column",gap:1},children:e.jsxs(S,{className:"webhook-item",sx:{fontSize:12},children:[e.jsx(Se,{maxLength:30,children:A},A),e.jsx(xe,{status:ne.status,updatedAt:ne.sendAt,reason:ne.failedReason,channel:"webhook",onResend:G=>I(G,E[c],"webhook",[A],!1)})]},A)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:c=>{const{createdAt:d}=E[c];return e.jsx(Nt,{value:d,locale:o,shouldUpdate:!0})}}}],[E,o,h,r]),he=[e.jsx(Ze,{value:h.dateRange,onChange:_},"date-picker"),e.jsx(le,{variant:"contained",size:"small",color:"primary",loading:w,startIcon:e.jsx(Kt,{}),onClick:()=>D(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(S,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx($n,{children:e.jsxs(xt,{theme:j,children:[e.jsx(yt,{className:"receivers-table",locale:o,loading:w,columns:L,data:E,onChange:re,options:de,customButtons:he,components:{TableFilterList:c=>e.jsx(et,{...c,itemComponent:d=>e.jsx(tt,{...d,canDelete:()=>!1})})}}),M.anchorEl&&e.jsx(Ue,{open:!!M.anchorEl,anchorReference:"anchorPosition",anchorPosition:M.position,onClose:ue,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(Vn,{children:[e.jsxs(ee,{variant:"body1",component:"div",className:"check-title",children:[F?.channel," Checking"]}),e.jsx(S,{sx:{display:"flex",flexDirection:"column",gap:"4px"},children:Fe(F?.channel).map(c=>{const{type:d,pass:m,fail:A}=c;return!F?.result||F?.result?.[d]?e.jsxs(ee,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:F?.result?.[d]?ke.success.main:"inherit"},children:[F?.result?e.jsx(Mt,{}):e.jsx(ft,{size:12,sx:{color:ke.primary.main}}),e.jsx("span",{children:m})]},d):e.jsxs(ee,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:ke.error.main},children:[e.jsx(Ut,{}),e.jsx("span",{children:A})]},d)})})]})}),P.anchorEl&&e.jsx(Ue,{open:!!P.anchorEl,anchorReference:"anchorPosition",anchorPosition:P.position,onClose:fe,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(Pt,{loading:n,onCancel:fe,onConfirm:g})})]})})})}const Hn=v.memo(Ft),$n=ie.div`
2
- td.MuiTableCell-footer {
3
- border: none !important;
4
- }
5
- .sent-status-cell {
6
- .resend-btn {
7
- display: none;
8
- }
9
- &:hover {
10
- .resend-btn {
11
- display: flex;
12
- }
13
- }
14
- }
15
- `,Vn=ie.div`
16
- padding: 8px 16px;
17
- .check-title {
18
- font-weight: 500;
19
- margin-bottom: 8px;
20
- &::first-letter {
21
- text-transform: uppercase;
22
- }
23
- }
24
- .check-item {
25
- svg {
26
- font-size: 16px;
27
- }
28
- font-size: 12px;
29
- }
30
- `,ve=t=>t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t;function Jn(t){const{wallet:s,push:n,email:r,webhook:o}=t;return[{name:"Wallet",value:e.jsx(ge,{item:s})},{name:"Push",value:e.jsx(ge,{item:n})},{name:"Email",value:e.jsx(ge,{item:r})},...o.total>0?[{name:"Webhook",value:e.jsx(ge,{item:o,isWebhook:!0})}]:[]]}function Gn(t,s,n){const{wallet:r,push:o,email:l,webhook:j}=t;return[{name:"Wallet",value:e.jsx(be,{loading:n,channel:B.NOTIFICATION_SEND_CHANNEL.WALLET,item:r,onResend:s})},{name:"Push",value:e.jsx(be,{loading:n,channel:B.NOTIFICATION_SEND_CHANNEL.PUSH,item:o,onResend:s})},{name:"Email",value:e.jsx(be,{loading:n,channel:B.NOTIFICATION_SEND_CHANNEL.EMAIL,item:l,onResend:s})},...j.total>0?[{name:"Webhook",value:e.jsx(be,{loading:n,channel:B.NOTIFICATION_SEND_CHANNEL.WEBHOOK,item:j,isWebhook:!0,onResend:s})}]:[]]}nt.propTypes={statistics:p.object.isRequired,onResend:p.func,mode:p.oneOf(["simple","detail"]),resending:p.bool};ge.propTypes={item:p.object.isRequired,isWebhook:p.bool};function ge({item:t,isWebhook:s=!1}){const{t:n}=te(),r=s?t.success.length:t.success,o=t.total,l=r===o?"success":"failed";return e.jsx(S,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:2},children:e.jsx(S,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsxs(ce,{config:{status:l},enableTooltip:!1,children:[ve(r)," / ",ve(o)," ",n("notification.sendStatus.success")]})})})}be.propTypes={item:p.object.isRequired,isWebhook:p.bool,channel:p.string,onResend:p.func,loading:p.bool};function be({channel:t=B.NOTIFICATION_SEND_CHANNEL.WALLET,item:s,isWebhook:n=!1,onResend:r=()=>{},loading:o=!1}){const{t:l}=te(),{success:j,failed:f,pending:u}=s,a=Mn(t),y=n?j.length:j,R=n?f.length:f,w=n?u.length:u,b=async P=>{P.stopPropagation();const F=n?[...new Set([...j,...f].map(N=>N))]:[];await r([t],[],!0,F)},E=y+R,J=E>0?y/E*100:0,M=E>0?R/E*100:0;return e.jsxs(Yn,{successRatio:J,failedRatio:M,children:[e.jsxs(ee,{variant:"h6",children:[a," (",s.total,")"]}),e.jsxs(ee,{variant:"body1",sx:{mb:2},children:[e.jsx("span",{style:{color:$e.success,fontWeight:600,fontSize:24},children:ve(y)}),e.jsx("small",{style:{paddingLeft:4},children:l("notification.sendStatus.success")})]}),e.jsxs(S,{className:"unsent-area",children:[e.jsxs(S,{children:[e.jsxs(ce,{config:{status:"failed"},enableTooltip:!1,children:[ve(R)," ",l("notification.sendStatus.failed")]}),e.jsxs(ce,{config:{status:"pending"},enableTooltip:!1,children:[ve(w)," ",l("notification.sendStatus.pending")]})]}),R>0&&e.jsx(S,{className:"resend-btn",children:e.jsx(le,{size:"small",color:"primary",loading:o,variant:"contained",startIcon:e.jsx(Ge,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:b,children:l("notification.resend")})})]})]})}function nt({statistics:t,mode:s="simple",onResend:n=()=>{},resending:r=!1}){const o=se(()=>s==="simple"?Jn(t):Gn(t,n,r),[t,s]);return s==="simple"?e.jsx("div",{children:o.map(l=>e.jsx(Tt,{style:{alignItems:"flex-start",marginBottom:s==="simple"?0:16},valueComponent:"div",nameWidth:100,name:l.name,children:l.value},l.name))}):e.jsx(st,{container:!0,spacing:2,children:o.map(l=>e.jsx(st,{size:{md:4,sm:6,xs:12},children:l.value},l.name))})}const Yn=ie(S)`
31
- display: flex;
32
- flex-direction: column;
33
- align-items: flex-start;
34
- padding: 16px;
35
- border-radius: 8px;
36
- background: ${({successRatio:t,failedRatio:s,theme:n})=>t===0&&s===0?n.palette.grey[300]:`linear-gradient(to right, ${Ht(n.palette.success.light,.4)} ${t}%, ${n.palette.grey[100]} ${t}%)`};
37
- transition: 'background 0.5s ease';
38
- cursor: pointer;
39
- .unsent-area {
40
- width: 100%;
41
- position: relative;
42
- .resend-btn {
43
- position: absolute;
44
- right: 0;
45
- bottom: 0;
46
- }
47
- }
48
- `;_t.propTypes={notification:p.object.isRequired,onCancel:p.func,blocklet:p.object.isRequired,tab:p.string};function _t({notification:t,onCancel:s=()=>{},blocklet:n,tab:r="info"}){const{t:o,locale:l}=te(),{getComponent:j,resendNotification:f}=Qe(),[u,a]=v.useState(!1),y=se(()=>j(t.componentDid)||n,[n,t.componentDid]),R=ye({tab:r||"info"}),w=v.useCallback(async(h,T,k=!0,i=[])=>{if(!h.length||!t.id)return;const C=T.length>0?T:t?.receivers?.map(O=>O.receiver);if(!C.length)return;let D=[...h];if(D.includes(B.NOTIFICATION_SEND_CHANNEL.PUSH)&&!Dt(n)&&(K.warning(o("notification.sendStatus.reason.unavailable",{channel:"Push Kit"})),D=D.filter(O=>O!==B.NOTIFICATION_SEND_CHANNEL.PUSH)),D.includes(B.NOTIFICATION_SEND_CHANNEL.EMAIL)&&!Ot(n)&&(K.warning(o("notification.sendStatus.reason.unavailable",{channel:"Email"})),D=D.filter(O=>O!==B.NOTIFICATION_SEND_CHANNEL.EMAIL)),!!D.length)try{a(!0),await f({notificationId:t.id,receivers:C,channels:D,resendFailedOnly:k,...D.includes("webhook")&&i.length?{webhookUrls:i}:{}}),K.success("Message has been sent!")}catch(O){console.error("handleResend error",{error:O}),K.error(O.response?O.response.statusText:O.message)}finally{a(!1)}},[n,t.id,t?.receivers,f,o]),b=se(()=>xn(t),[t]),E=se(()=>gn(t),[t]),J=se(()=>b?t?.actorInfo:[],[t]),M=se(()=>n?.did||n?.meta?.did||"",[n]);function P(){return[{name:o("notification.from"),value:b&&E?e.jsx(mn,{actors:J,teamDid:M,size:32,showName:!0}):e.jsx(pn,{size:32,blocklet:y,showName:!0,hideDot:!0})},{name:o("notification.notificationTitle"),value:e.jsx(Se,{maxLength:50,children:t.title})},{name:o("notification.body"),value:b?e.jsx(fn,{notification:t,blocklet:n}):e.jsx(bn,{notification:t,rows:0})},{name:o("notification.severity"),value:e.jsx(Ce,{severity:t.severity})},{name:o("notification.createdAt"),value:e.jsx(an,{value:t.createdAt,locale:l,shouldUpdate:!0,type:"all"})}].map(T=>e.jsx(Tt,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:120,name:T.name,children:T.value},T.name))}const F={info:{label:o("common.basicInfo"),value:"info",component:P},receivers:{label:o("notification.receiver"),value:"receivers"},statistics:{label:o("notification.statistics"),value:"statistics"}},N=Object.values(F).map(({label:h,value:T})=>({label:h,value:T})),W=F[R.tab]||F.info,q=h=>{R.tab=h};return e.jsx(St,{title:o("notification.notificationDetails"),fullWidth:!0,maxWidth:"lg",onClose:()=>{R.tab="info",s()},open:!0,actionsPosition:"left",sx:{".ux-dialog_header":{paddingBottom:0},".MuiDialogContent-root":{paddingTop:0}},children:e.jsxs(Xn,{children:[e.jsx(S,{className:"tabs",sx:{mx:3},children:e.jsx(bt,{tabs:N,current:R.tab,onChange:q,scrollButtons:"auto"})}),e.jsxs("div",{className:"body",children:[R.tab==="receivers"&&e.jsx(Hn,{notificationId:t.id,resending:u,handleResend:w}),R.tab==="statistics"&&e.jsx(nt,{statistics:t.statistics,mode:"detail",resending:u,onResend:w}),R.tab==="info"&&e.jsx(W.component,{})]})]})})}const Qn=v.memo(_t),Xn=ie.div`
49
- & > .notification-row {
50
- padding: 0;
51
- }
52
-
53
- .tabs {
54
- margin: 0;
55
- }
56
- .body {
57
- margin-top: 16px;
58
- }
59
-
60
- .channel-item {
61
- display: flex;
62
- padding: 4px;
63
- justify-content: flex-start;
64
- align-items: center;
65
- gap: 8px;
66
- > p {
67
- font-size: 15px;
68
- }
69
- .resend-btn {
70
- svg {
71
- font-size: 16px;
72
- }
73
- display: flex;
74
- align-items: center;
75
- font-size: 12px;
76
- cursor: pointer;
77
- &.disabled {
78
- cursor: not-allowed;
79
- color: ${ke.text.disabled};
80
- }
81
- }
82
- }
83
- `;Le.propTypes={blocklet:p.object,label:p.string};const Zn=ie.div`
84
- display: flex;
85
- justify-items: flex-start;
86
- align-items: center;
87
- gap: 8px;
88
- .name {
89
- display: block;
90
- max-width: 260px;
91
- white-space: nowrap;
92
- overflow: hidden;
93
- text-overflow: ellipsis;
94
- }
95
- `;function Le({blocklet:t=null,label:s=""}){return e.jsx(Zn,{children:t?e.jsxs(e.Fragment,{children:[e.jsx(Et,{size:24,blocklet:t,ancestors:t.ancestors}),e.jsx("span",{className:"name",children:t.title||t.meta?.title})]}):e.jsx("span",{className:"name",children:s})})}zt.propTypes={list:p.array.isRequired,label:p.string.isRequired,onDelete:p.func};function zt({list:t,label:s,onDelete:n=()=>{}}){return e.jsxs(S,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsxs(ee,{children:[s,": "]}),t.map(r=>e.jsx(Je,{size:"small",label:e.jsx(S,{sx:{display:"flex",alignItems:"center",gap:"4px"},children:e.jsx(Ce,{severity:r})}),onDelete:o=>n(o,r)},r))]})}function es(t){return e.jsx(Xe,{...t,renderLabel:s=>e.jsx(Ce,{severity:s})})}function ts({customTableButtons:t}){const{t:s,locale:n}=te(),r=ht(),o=$t(r.breakpoints.down("sm")),l=v.useMemo(()=>jt(r,Lt()),[r]),[j,f]=v.useState(!1),{data:u,paging:a,blocklet:y,fetch:R,getComponent:w,componentDids:b,inService:E,teamDid:J}=Qe(),M=v.useRef(null),[P,F]=v.useState(null),[N,W]=v.useState("info"),q=Sn(),[h,T]=v.useState(!1),k=`notification-records-${y.meta?.did}`,i=rn(k),[C,D]=v.useState({pageSize:i.rowsPerPage||10,page:i.page?i.page+1:1,dids:i.dids||[],dateRange:i.dateRange||[Z().subtract(1,"month").startOf("day").toDate(),Z().endOf("day").toDate()]}),O=se(()=>{if(!y.children||!y.children.length)return[];const g=[];return y.children.forEach(x=>{const I=x.did||x.meta?.did;b.includes(I)&&(x.ancestors=[y],g.push(x))}),g},[b,y]),ae=async g=>{try{f(!0),await R(g),f(!1)}finally{f(!1)}};v.useEffect(()=>{ae(C)},[C]),v.useEffect(()=>{const g=u.find(x=>x.id===P?.id);P&&g&&F({...g})},[u]);const de=(g,x,I,_)=>{g.stopPropagation();const z=I.filter(L=>L!==x);D(L=>({...L,[_]:z,page:1}))},re=({page:g,rowsPerPage:x,filterList:I})=>{const[_=[],,,,z=[]]=I;C.pageSize!==x?D(L=>({...L,pageSize:x,page:1})):C.page!==g+1?D(L=>({...L,page:g+1})):je(C.dids,_)?je(C.severities,z)||D(L=>({...L,severities:z,page:1})):D(L=>({...L,dids:_,page:1}))},pe=v.useCallback(()=>{F(null),W("info")},[]),Fe=v.useCallback(()=>{R(C)},[R,C]),ue=[{label:s("notification.from"),name:"sender",width:400,options:{filter:!0,filterType:"custom",customFilterListOptions:{render:g=>g.map((x,I)=>{if(x==="system")return e.jsx("span",{children:s("notification.system")},`system-${I}`);const _=O.find(z=>(z.did||z.meta?.did)===x);return e.jsx(Le,{blocklet:_,label:_?.title||_?.meta?.title},x)}),update:(g,x,I)=>(g[I].splice(x,1),g)},filterOptions:{names:O,logic:(g,x)=>x.length?!x.includes(g):!1,display:(g,x,I,_)=>e.jsxs(V,{style:{width:"380px"},children:[e.jsx(Vt,{id:"demo-simple-select-label",style:{background:"#ffffff"},children:"Sender"}),e.jsxs(Jt,{multiple:!0,value:g[I],renderValue:z=>e.jsx(S,{style:{overflow:"hidden",textOverflow:"ellipsis"},sx:{display:"flex",gap:1,alignItems:"center"},children:z.map(L=>{if(L==="system")return e.jsx("span",{children:s("notification.system")},L);const he=O.find(c=>(c.did||c.meta?.did)===L);return e.jsx(Le,{blocklet:he,label:he?.title||he?.meta?.title},L)})}),onChange:z=>{g[I]=z.target.value,x(g[I],I,_)},children:[e.jsx(it,{value:"system",children:s("notification.system")}),O.map(z=>{const L=z.did||z.meta?.did;return e.jsx(it,{value:L,children:e.jsx(Le,{blocklet:z,label:z.title||z.meta?.title})},L)})]})]})},customBodyRenderLite:g=>{const x=u[g],I=w(x.componentDid);return e.jsxs(S,{sx:{display:"flex",alignItems:"center",gap:1},children:[I?e.jsx(Et,{size:32,blocklet:I,ancestors:I.ancestors??[]}):e.jsx(hn,{blocklet:y,size:32}),e.jsx(Se,{maxLength:50,children:I?.meta?.title||y?.meta?.title})]})}}},{label:s("notification.receiver"),name:"receivers",width:300,options:{filter:!1,customBodyRenderLite:g=>{const x=u[g],{receivers:I}=x;return e.jsx(Gt,{total:I.length,renderSurplus:_=>_<100?e.jsxs("span",{children:["+",_]}):e.jsx("span",{children:"99+"}),max:3,sx:{justifyContent:"flex-end",height:"32px",".MuiAvatar-root":{width:"32px",height:"32px",fontSize:"12px",border:0,zIndex:2}},onClick:_=>{_.stopPropagation(),F(x),W("receivers")},children:I.map(_=>{const{receiverUser:z}=_,L=It(z.avatar,J,E);return e.jsx(vt,{alt:z.fullName,src:`${L}?imageFilter=resize&w=48&h=48`,size:32,did:_.receiver,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}},_.receiver)})})}}},{label:s("notification.statistics"),name:"statistics",width:400,options:{filter:!1,customBodyRenderLite:g=>{const x=u[g];return e.jsx(S,{onClick:I=>{I.stopPropagation(),F(x),W("statistics")},children:e.jsx(nt,{statistics:x.statistics})})}}},{label:s("notification.notificationPreview"),name:"data",options:{filter:!1,customBodyRenderLite:g=>{const x=u[g];return e.jsx(Se,{maxLength:50,children:x.title})}}},{label:s("notification.severity"),name:"severity",width:200,options:{setCellProps:()=>({className:"severity-cell"}),customBodyRenderLite:g=>{const x=u[g];return e.jsx(Ce,{severity:x.severity})},filter:!0,filterType:"custom",filterList:C.severities??[],customFilterListOptions:{render:g=>e.jsx(zt,{list:g,label:s("notification.severity"),onDelete:(x,I)=>{x.stopPropagation(),de(x,I,ue[4].options.filterList,"severities")}}),update:Ae},filterOptions:{names:dt,fullWidth:!0,logic:Oe,display:(g,x,I,_)=>e.jsx(es,{label:s("notification.severity"),filterList:g,onChange:x,index:I,column:_,filterValues:dt})}}},{label:s("common.createdAt"),name:"createdAt",width:300,options:{filter:!1,customBodyRenderLite:g=>{const{createdAt:x}=u[g];return e.jsx(Nt,{value:x,locale:n,shouldUpdate:!0})}}}],fe=g=>{D(x=>({...x,dateRange:g,page:1}))},we=[e.jsxs(S,{sx:{display:"flex",alignItems:"center",gap:1.5},children:[e.jsx(Yt,{onClick:()=>T(!0),sx:{p:q?0:void 0},children:e.jsx(Qt,{})},"settings"),q?e.jsx(ee,{children:s("common.setting")}):null]}),...t||[]];return e.jsxs(S,{ref:M,sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:[e.jsx(ns,{isBreakpointsDownSm:o,children:e.jsx(xt,{theme:l,children:e.jsx(yt,{className:"main-table",verticalKeyWidth:100,loading:j,locale:n,columns:ue,data:u,durable:k,onChange:re,options:{sort:!1,download:!1,print:!1,search:!1,expandableRowsOnClick:!0,page:a.page-1,rowsPerPage:a.pageSize,count:a.total,...i,onRowClick:(g,{dataIndex:x})=>{F(u[x])}},title:e.jsx(Ze,{value:C.dateRange,onChange:fe}),customButtons:we,components:{TableFilterList:g=>e.jsx(et,{...g,itemComponent:x=>e.jsx(tt,{...x,canDelete:I=>I?.columnNames?.[I?.index||0]?.name==="sender"})})}})})}),P&&e.jsx(Qn,{refresh:Fe,onCancel:pe,notification:P,blocklet:y,tab:N}),e.jsx(St,{title:`${s("common.notification")} ${s("common.setting")}`,fullWidth:!0,maxWidth:"md",open:h,onClose:()=>T(!1),PaperProps:{style:{minHeight:"500px"}},children:e.jsx(S,{sx:{mt:"-16px",overflowY:"hidden"},children:e.jsx(On,{})})})]})}const ns=ie.div`
96
- td.MuiTableCell-footer {
97
- border: none !important;
98
- }
99
- .sent-status-cell {
100
- .resend-btn {
101
- display: none;
102
- }
103
- &:hover {
104
- .resend-btn {
105
- display: flex;
106
- }
107
- }
108
- }
109
-
110
- .custom-toobar-btns {
111
- gap: 4px;
112
- }
113
- .custom-toobar-title-inner {
114
- display: flex;
115
- justify-content: ${({isBreakpointsDownSm:t})=>t?"space-between":"flex-end"};
116
- padding-right: ${({isBreakpointsDownSm:t})=>t?"0":"8px"};
117
- flex-wrap: wrap;
118
- gap: 8px;
119
- }
120
- `;ss.propTypes={blocklet:p.object.isRequired,customTableButtons:p.array};function ss({blocklet:t={},customTableButtons:s=[]}){return e.jsx(Ln,{blocklet:t,children:e.jsx(ts,{customTableButtons:s})})}export{ss as default};