@blocklet/ui-react 2.13.70 → 3.0.1

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 (381) hide show
  1. package/lib/@types/index.js +5 -18
  2. package/lib/BlockletStudio/index.js +75 -89
  3. package/lib/ComponentInstaller/index.js +153 -190
  4. package/lib/ComponentInstaller/installer-item.js +56 -55
  5. package/lib/ComponentInstaller/locales.js +19 -18
  6. package/lib/ComponentInstaller/use-component-installed.js +49 -80
  7. package/lib/ComponentManager/components/add-component.js +68 -89
  8. package/lib/ComponentManager/components/check-component.js +4 -2
  9. package/lib/ComponentManager/components/publish-component.js +48 -57
  10. package/lib/ComponentManager/components/resource-dialog.js +41 -55
  11. package/lib/ComponentManager/index.js +8 -3
  12. package/lib/ComponentManager/libs/locales.js +8 -5
  13. package/lib/Dashboard/index.js +88 -124
  14. package/lib/Footer/brand.js +25 -28
  15. package/lib/Footer/copyright.js +15 -16
  16. package/lib/Footer/index.js +55 -65
  17. package/lib/Footer/internal-footer.js +93 -95
  18. package/lib/Footer/layout/plain.js +26 -24
  19. package/lib/Footer/layout/row.js +16 -20
  20. package/lib/Footer/layout/standard.js +73 -59
  21. package/lib/Footer/links.js +100 -120
  22. package/lib/Footer/social-media.js +28 -33
  23. package/lib/Header/index.js +108 -130
  24. package/lib/Icon/index.js +43 -59
  25. package/lib/Notifications/Snackbar.js +114 -151
  26. package/lib/Notifications/hooks/use-title.js +85 -126
  27. package/lib/Notifications/hooks/use-width.js +10 -9
  28. package/lib/Notifications/utils.js +74 -114
  29. package/lib/UserCenter/components/config-inviter.js +21 -31
  30. package/lib/UserCenter/components/config-profile.js +41 -47
  31. package/lib/UserCenter/components/danger-zone.js +88 -93
  32. package/lib/UserCenter/components/editable-field.js +149 -167
  33. package/lib/UserCenter/components/nft.js +91 -81
  34. package/lib/UserCenter/components/notification.js +206 -195
  35. package/lib/UserCenter/components/passport.js +37 -53
  36. package/lib/UserCenter/components/privacy.js +53 -64
  37. package/lib/UserCenter/components/settings.js +117 -128
  38. package/lib/UserCenter/components/status-dialog/date-picker.js +35 -36
  39. package/lib/UserCenter/components/status-dialog/index.js +132 -144
  40. package/lib/UserCenter/components/status-selector/duration-menu.js +53 -48
  41. package/lib/UserCenter/components/status-selector/index.js +37 -36
  42. package/lib/UserCenter/components/status-selector/menu-item.js +13 -9
  43. package/lib/UserCenter/components/storage/action.js +27 -25
  44. package/lib/UserCenter/components/storage/connected.js +59 -30
  45. package/lib/UserCenter/components/storage/delete.js +32 -39
  46. package/lib/UserCenter/components/storage/disconnect.js +43 -25
  47. package/lib/UserCenter/components/storage/icons/empty-spaces-nft.svg.js +7 -0
  48. package/lib/UserCenter/components/storage/index.js +24 -18
  49. package/lib/UserCenter/components/storage/preview-nft.js +35 -36
  50. package/lib/UserCenter/components/third-party-login/index.js +73 -143
  51. package/lib/UserCenter/components/third-party-login/third-party-item.js +132 -153
  52. package/lib/UserCenter/components/user-center.js +345 -461
  53. package/lib/UserCenter/components/user-info/address.js +120 -100
  54. package/lib/UserCenter/components/user-info/index.js +10 -4
  55. package/lib/UserCenter/components/user-info/link-preview-input.js +148 -159
  56. package/lib/UserCenter/components/user-info/metadata.js +290 -385
  57. package/lib/UserCenter/components/user-info/switch-role.js +24 -18
  58. package/lib/UserCenter/components/user-info/timezone-select.js +37 -45
  59. package/lib/UserCenter/components/user-info/user-basic-info.js +213 -207
  60. package/lib/UserCenter/components/user-info/user-info-item.js +39 -26
  61. package/lib/UserCenter/components/user-info/user-info.js +52 -67
  62. package/lib/UserCenter/components/user-info/user-status.js +111 -154
  63. package/lib/UserCenter/components/user-info/utils.js +96 -93
  64. package/lib/UserCenter/components/webhook-item.js +95 -143
  65. package/lib/UserCenter/index.js +4 -1
  66. package/lib/UserCenter/libs/locales.js +132 -129
  67. package/lib/UserCenter/libs/utils.js +17 -22
  68. package/lib/UserSessions/components/user-session-info.js +30 -26
  69. package/lib/UserSessions/components/user-sessions.js +222 -268
  70. package/lib/UserSessions/index.js +4 -1
  71. package/lib/UserSessions/libs/locales.js +31 -28
  72. package/lib/UserSessions/libs/utils.js +30 -56
  73. package/lib/blocklets.js +75 -156
  74. package/lib/common/domain-warning.js +64 -104
  75. package/lib/common/header-addons.js +59 -80
  76. package/lib/common/link-blocker.js +10 -16
  77. package/lib/common/notification-addon.js +56 -89
  78. package/lib/common/overridable-theme-provider.js +12 -12
  79. package/lib/common/wallet-hidden-topbar.js +11 -13
  80. package/lib/common/ws.js +23 -34
  81. package/lib/contexts/config-user-space.js +34 -43
  82. package/lib/hooks/use-mobile.js +7 -4
  83. package/lib/index.js +25 -10
  84. package/lib/libs/client.js +5 -2
  85. package/lib/libs/constant.js +4 -1
  86. package/lib/libs/spaces.js +11 -11
  87. package/lib/libs/with-hide-when-embed.js +13 -15
  88. package/lib/packages/blocklet-ui-react/build.config.d.ts +2 -0
  89. package/lib/packages/blocklet-ui-react/jest.config.d.ts +8 -0
  90. package/lib/packages/blocklet-ui-react/lib/@types/index.d.ts +3 -0
  91. package/lib/packages/blocklet-ui-react/lib/BlockletStudio/index.d.ts +26 -0
  92. package/lib/packages/blocklet-ui-react/lib/ComponentInstaller/index.d.ts +18 -0
  93. package/lib/packages/blocklet-ui-react/lib/ComponentInstaller/installer-item.d.ts +18 -0
  94. package/lib/packages/blocklet-ui-react/lib/ComponentInstaller/locales.d.ts +28 -0
  95. package/lib/packages/blocklet-ui-react/lib/ComponentInstaller/use-component-installed.d.ts +12 -0
  96. package/lib/packages/blocklet-ui-react/lib/ComponentManager/components/add-component.d.ts +13 -0
  97. package/lib/packages/blocklet-ui-react/lib/ComponentManager/components/check-component.d.ts +2 -0
  98. package/lib/packages/blocklet-ui-react/lib/ComponentManager/components/publish-component.d.ts +7 -0
  99. package/lib/packages/blocklet-ui-react/lib/ComponentManager/components/resource-dialog.d.ts +11 -0
  100. package/lib/packages/blocklet-ui-react/lib/ComponentManager/index.d.ts +4 -0
  101. package/lib/packages/blocklet-ui-react/lib/ComponentManager/libs/locales.d.ts +19 -0
  102. package/lib/packages/blocklet-ui-react/lib/Dashboard/index.d.ts +27 -0
  103. package/lib/packages/blocklet-ui-react/lib/Footer/brand.d.ts +15 -0
  104. package/lib/packages/blocklet-ui-react/lib/Footer/copyright.d.ts +13 -0
  105. package/lib/packages/blocklet-ui-react/lib/Footer/index.d.ts +2 -0
  106. package/lib/packages/blocklet-ui-react/lib/Footer/internal-footer.d.ts +29 -0
  107. package/lib/packages/blocklet-ui-react/lib/Footer/layout/plain.d.ts +19 -0
  108. package/lib/packages/blocklet-ui-react/lib/Footer/layout/row.d.ts +13 -0
  109. package/lib/packages/blocklet-ui-react/lib/Footer/layout/standard.d.ts +21 -0
  110. package/lib/packages/blocklet-ui-react/lib/Footer/links.d.ts +20 -0
  111. package/lib/packages/blocklet-ui-react/lib/Footer/social-media.d.ts +14 -0
  112. package/lib/packages/blocklet-ui-react/lib/Header/index.d.ts +2 -0
  113. package/lib/packages/blocklet-ui-react/lib/Icon/index.d.ts +7 -0
  114. package/lib/packages/blocklet-ui-react/lib/Notifications/Snackbar.d.ts +8 -0
  115. package/lib/packages/blocklet-ui-react/lib/Notifications/hooks/use-title.d.ts +9 -0
  116. package/lib/packages/blocklet-ui-react/lib/Notifications/hooks/use-width.d.ts +2 -0
  117. package/lib/packages/blocklet-ui-react/lib/Notifications/utils.d.ts +10 -0
  118. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/config-inviter.d.ts +4 -0
  119. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/config-profile.d.ts +5 -0
  120. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/danger-zone.d.ts +2 -0
  121. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/editable-field.d.ts +50 -0
  122. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/nft.d.ts +4 -0
  123. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/notification.d.ts +5 -0
  124. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/passport.d.ts +5 -0
  125. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/privacy.d.ts +5 -0
  126. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/settings.d.ts +8 -0
  127. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/status-dialog/date-picker.d.ts +9 -0
  128. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/status-dialog/index.d.ts +9 -0
  129. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/status-selector/duration-menu.d.ts +7 -0
  130. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/status-selector/index.d.ts +8 -0
  131. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/status-selector/menu-item.d.ts +9 -0
  132. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/storage/action.d.ts +7 -0
  133. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/storage/connected.d.ts +4 -0
  134. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/storage/delete.d.ts +5 -0
  135. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/storage/disconnect.d.ts +2 -0
  136. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/storage/icons/empty-spaces-nft.svg.d.ts +3 -0
  137. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/storage/index.d.ts +2 -0
  138. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/storage/preview-nft.d.ts +5 -0
  139. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/third-party-login/index.d.ts +4 -0
  140. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/third-party-login/third-party-item.d.ts +4 -0
  141. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/user-center.d.ts +15 -0
  142. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/user-info/address.d.ts +7 -0
  143. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/user-info/index.d.ts +5 -0
  144. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/user-info/link-preview-input.d.ts +6 -0
  145. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/user-info/metadata.d.ts +7 -0
  146. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/user-info/switch-role.d.ts +6 -0
  147. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/user-info/timezone-select.d.ts +7 -0
  148. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/user-info/user-basic-info.d.ts +12 -0
  149. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/user-info/user-info-item.d.ts +6 -0
  150. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/user-info/user-info.d.ts +6 -0
  151. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/user-info/user-status.d.ts +9 -0
  152. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/user-info/utils.d.ts +33 -0
  153. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/webhook-item.d.ts +10 -0
  154. package/lib/packages/blocklet-ui-react/lib/UserCenter/index.d.ts +2 -0
  155. package/lib/packages/blocklet-ui-react/lib/UserCenter/libs/locales.d.ts +513 -0
  156. package/lib/packages/blocklet-ui-react/lib/UserCenter/libs/utils.d.ts +3 -0
  157. package/lib/packages/blocklet-ui-react/lib/UserSessions/components/user-session-info.d.ts +5 -0
  158. package/lib/packages/blocklet-ui-react/lib/UserSessions/components/user-sessions.d.ts +8 -0
  159. package/lib/packages/blocklet-ui-react/lib/UserSessions/index.d.ts +2 -0
  160. package/lib/packages/blocklet-ui-react/lib/UserSessions/libs/locales.d.ts +88 -0
  161. package/lib/packages/blocklet-ui-react/lib/UserSessions/libs/utils.d.ts +3 -0
  162. package/lib/packages/blocklet-ui-react/lib/blocklets.d.ts +18 -0
  163. package/lib/packages/blocklet-ui-react/lib/common/domain-warning.d.ts +12 -0
  164. package/lib/packages/blocklet-ui-react/lib/common/header-addons.d.ts +19 -0
  165. package/lib/packages/blocklet-ui-react/lib/common/link-blocker.d.ts +4 -0
  166. package/lib/packages/blocklet-ui-react/lib/common/notification-addon.d.ts +10 -0
  167. package/lib/packages/blocklet-ui-react/lib/common/overridable-theme-provider.d.ts +12 -0
  168. package/lib/packages/blocklet-ui-react/lib/common/wallet-hidden-topbar.d.ts +2 -0
  169. package/lib/packages/blocklet-ui-react/lib/common/ws.d.ts +4 -0
  170. package/lib/packages/blocklet-ui-react/lib/contexts/config-user-space.d.ts +7 -0
  171. package/lib/packages/blocklet-ui-react/lib/hooks/use-mobile.d.ts +4 -0
  172. package/lib/packages/blocklet-ui-react/lib/index.d.ts +12 -0
  173. package/lib/packages/blocklet-ui-react/lib/libs/client.d.ts +3 -0
  174. package/lib/packages/blocklet-ui-react/lib/libs/constant.d.ts +2 -0
  175. package/lib/packages/blocklet-ui-react/lib/libs/spaces.d.ts +3 -0
  176. package/lib/packages/blocklet-ui-react/lib/libs/with-hide-when-embed.d.ts +5 -0
  177. package/lib/packages/blocklet-ui-react/lib/types.d.ts +37 -0
  178. package/lib/packages/blocklet-ui-react/lib/utils.d.ts +11 -0
  179. package/lib/{@types → packages/blocklet-ui-react/src/@types}/index.d.ts +3 -3
  180. package/lib/{BlockletStudio → packages/blocklet-ui-react/src/BlockletStudio}/index.d.ts +1 -1
  181. package/lib/packages/blocklet-ui-react/src/ComponentInstaller/ComponentInstaller.stories.d.ts +9 -0
  182. package/lib/packages/blocklet-ui-react/src/ComponentInstaller/demo/basic.d.ts +29 -0
  183. package/lib/packages/blocklet-ui-react/src/ComponentInstaller/demo/mock-optional-components.d.ts +2 -0
  184. package/lib/packages/blocklet-ui-react/src/ComponentInstaller/index.d.ts +18 -0
  185. package/lib/packages/blocklet-ui-react/src/ComponentInstaller/installer-item.d.ts +18 -0
  186. package/lib/{ComponentInstaller → packages/blocklet-ui-react/src/ComponentInstaller}/use-component-installed.d.ts +1 -1
  187. package/lib/{ComponentManager → packages/blocklet-ui-react/src/ComponentManager}/components/add-component.d.ts +2 -2
  188. package/lib/packages/blocklet-ui-react/src/ComponentManager/components/check-component.d.ts +2 -0
  189. package/lib/{ComponentManager → packages/blocklet-ui-react/src/ComponentManager}/components/publish-component.d.ts +2 -2
  190. package/lib/{ComponentManager → packages/blocklet-ui-react/src/ComponentManager}/components/resource-dialog.d.ts +2 -2
  191. package/lib/packages/blocklet-ui-react/src/Dashboard/Dashboard.stories.d.ts +13 -0
  192. package/lib/packages/blocklet-ui-react/src/Dashboard/demo/basic.d.ts +29 -0
  193. package/lib/packages/blocklet-ui-react/src/Dashboard/index.d.ts +30 -0
  194. package/lib/packages/blocklet-ui-react/src/Footer/Footer.stories.d.ts +19 -0
  195. package/lib/packages/blocklet-ui-react/src/Footer/brand.d.ts +15 -0
  196. package/lib/packages/blocklet-ui-react/src/Footer/copyright.d.ts +13 -0
  197. package/lib/packages/blocklet-ui-react/src/Footer/demo/arcblock-site.d.ts +31 -0
  198. package/lib/packages/blocklet-ui-react/src/Footer/demo/brand.d.ts +1 -0
  199. package/lib/packages/blocklet-ui-react/src/Footer/demo/copyright.d.ts +1 -0
  200. package/lib/packages/blocklet-ui-react/src/Footer/demo/footer.d.ts +10 -0
  201. package/lib/packages/blocklet-ui-react/src/Footer/demo/links.d.ts +1 -0
  202. package/lib/packages/blocklet-ui-react/src/Footer/demo/social-media-icons.d.ts +1 -0
  203. package/lib/packages/blocklet-ui-react/src/Footer/index.d.ts +6 -0
  204. package/lib/packages/blocklet-ui-react/src/Footer/internal-footer.d.ts +32 -0
  205. package/lib/packages/blocklet-ui-react/src/Footer/layout/plain.d.ts +22 -0
  206. package/lib/packages/blocklet-ui-react/src/Footer/layout/row.d.ts +13 -0
  207. package/lib/packages/blocklet-ui-react/src/Footer/layout/standard.d.ts +24 -0
  208. package/lib/packages/blocklet-ui-react/src/Footer/links.d.ts +23 -0
  209. package/lib/packages/blocklet-ui-react/src/Footer/social-media.d.ts +14 -0
  210. package/lib/packages/blocklet-ui-react/src/Header/Header.stories.d.ts +26 -0
  211. package/lib/packages/blocklet-ui-react/src/Header/demo/addons-customization.d.ts +11 -0
  212. package/lib/packages/blocklet-ui-react/src/Header/demo/basic.d.ts +1 -0
  213. package/lib/packages/blocklet-ui-react/src/Header/demo/fixtures/index.d.ts +49 -0
  214. package/lib/packages/blocklet-ui-react/src/Header/demo/with-enable-connect-enable-locale.d.ts +1 -0
  215. package/lib/{Header → packages/blocklet-ui-react/src/Header}/index.d.ts +3 -2
  216. package/lib/packages/blocklet-ui-react/src/Icon/Icon.stories.d.ts +12 -0
  217. package/lib/packages/blocklet-ui-react/src/Icon/demo/basic.d.ts +1 -0
  218. package/lib/{Icon → packages/blocklet-ui-react/src/Icon}/index.d.ts +2 -3
  219. package/lib/packages/blocklet-ui-react/src/Notifications/Snackbar.d.ts +16 -0
  220. package/lib/{Notifications → packages/blocklet-ui-react/src/Notifications}/hooks/use-title.d.ts +1 -1
  221. package/lib/{Notifications → packages/blocklet-ui-react/src/Notifications}/utils.d.ts +2 -2
  222. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/config-inviter.d.ts +1 -1
  223. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/config-profile.d.ts +1 -1
  224. package/lib/packages/blocklet-ui-react/src/UserCenter/components/danger-zone.d.ts +1 -0
  225. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/editable-field.d.ts +3 -3
  226. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/nft.d.ts +1 -1
  227. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/notification.d.ts +1 -1
  228. package/lib/packages/blocklet-ui-react/src/UserCenter/components/passport.d.ts +5 -0
  229. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/privacy.d.ts +1 -1
  230. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/settings.d.ts +2 -2
  231. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/status-dialog/date-picker.d.ts +1 -1
  232. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/status-dialog/index.d.ts +1 -1
  233. package/lib/packages/blocklet-ui-react/src/UserCenter/components/status-selector/duration-menu.d.ts +7 -0
  234. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/status-selector/index.d.ts +1 -1
  235. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/status-selector/menu-item.d.ts +4 -4
  236. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/storage/action.d.ts +1 -1
  237. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/storage/connected.d.ts +1 -1
  238. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/storage/delete.d.ts +1 -1
  239. package/lib/packages/blocklet-ui-react/src/UserCenter/components/storage/disconnect.d.ts +2 -0
  240. package/lib/packages/blocklet-ui-react/src/UserCenter/components/storage/index.d.ts +2 -0
  241. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/storage/preview-nft.d.ts +1 -1
  242. package/lib/packages/blocklet-ui-react/src/UserCenter/components/third-party-login/index.d.ts +4 -0
  243. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/third-party-login/third-party-item.d.ts +2 -2
  244. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/user-center.d.ts +2 -2
  245. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/user-info/address.d.ts +2 -2
  246. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/user-info/link-preview-input.d.ts +1 -1
  247. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/user-info/metadata.d.ts +2 -2
  248. package/lib/packages/blocklet-ui-react/src/UserCenter/components/user-info/switch-role.d.ts +7 -0
  249. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/user-info/timezone-select.d.ts +1 -1
  250. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/user-info/user-basic-info.d.ts +3 -3
  251. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/user-info/user-info-item.d.ts +1 -1
  252. package/lib/packages/blocklet-ui-react/src/UserCenter/components/user-info/user-info.d.ts +6 -0
  253. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/user-info/user-status.d.ts +2 -2
  254. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/user-info/utils.d.ts +8 -5
  255. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/webhook-item.d.ts +1 -1
  256. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/libs/utils.d.ts +1 -1
  257. package/lib/{UserSessions → packages/blocklet-ui-react/src/UserSessions}/components/user-session-info.d.ts +1 -1
  258. package/lib/{UserSessions → packages/blocklet-ui-react/src/UserSessions}/components/user-sessions.d.ts +1 -1
  259. package/lib/packages/blocklet-ui-react/src/common/domain-warning.d.ts +12 -0
  260. package/lib/packages/blocklet-ui-react/src/common/header-addons.d.ts +19 -0
  261. package/lib/{common → packages/blocklet-ui-react/src/common}/link-blocker.d.ts +1 -1
  262. package/lib/{common → packages/blocklet-ui-react/src/common}/notification-addon.d.ts +3 -6
  263. package/lib/{common → packages/blocklet-ui-react/src/common}/overridable-theme-provider.d.ts +5 -8
  264. package/lib/{contexts → packages/blocklet-ui-react/src/contexts}/config-user-space.d.ts +3 -3
  265. package/lib/{libs → packages/blocklet-ui-react/src/libs}/with-hide-when-embed.d.ts +1 -1
  266. package/lib/packages/blocklet-ui-react/src/types.d.ts +36 -0
  267. package/lib/packages/blocklet-ui-react/tools/auto-exports.d.ts +1 -0
  268. package/lib/packages/blocklet-ui-react/tools/jest.d.ts +1 -0
  269. package/lib/packages/blocklet-ui-react/vite.config.d.mts +2 -0
  270. package/lib/types.js +39 -39
  271. package/lib/utils.js +61 -175
  272. package/package.json +28 -34
  273. package/src/ComponentInstaller/ComponentInstaller.stories.jsx +16 -0
  274. package/src/ComponentInstaller/index.jsx +11 -27
  275. package/src/ComponentInstaller/installer-item.jsx +1 -5
  276. package/src/ComponentManager/components/add-component.tsx +3 -3
  277. package/src/ComponentManager/components/publish-component.tsx +3 -3
  278. package/src/Dashboard/Dashboard.stories.jsx +20 -0
  279. package/src/Dashboard/index.jsx +16 -27
  280. package/src/Footer/Footer.stories.jsx +32 -0
  281. package/src/Footer/brand.jsx +1 -7
  282. package/src/Footer/copyright.jsx +1 -6
  283. package/src/Footer/index.jsx +1 -6
  284. package/src/Footer/internal-footer.jsx +26 -16
  285. package/src/Footer/layout/row.jsx +2 -7
  286. package/src/Footer/layout/standard.jsx +12 -2
  287. package/src/Footer/links.jsx +2 -7
  288. package/src/Footer/social-media.jsx +1 -5
  289. package/src/Header/Header.stories.jsx +30 -0
  290. package/src/Header/index.tsx +1 -1
  291. package/src/Icon/Icon.stories.jsx +12 -0
  292. package/src/Notifications/Snackbar.tsx +119 -126
  293. package/src/Notifications/hooks/use-title.tsx +5 -2
  294. package/src/Notifications/hooks/use-width.tsx +1 -1
  295. package/src/UserCenter/components/config-profile.tsx +0 -1
  296. package/src/UserCenter/components/danger-zone.tsx +7 -3
  297. package/src/UserCenter/components/editable-field.tsx +45 -44
  298. package/src/UserCenter/components/nft.tsx +21 -9
  299. package/src/UserCenter/components/notification.tsx +22 -6
  300. package/src/UserCenter/components/privacy.tsx +1 -1
  301. package/src/UserCenter/components/settings.tsx +6 -1
  302. package/src/UserCenter/components/status-dialog/date-picker.tsx +10 -7
  303. package/src/UserCenter/components/status-dialog/index.tsx +11 -4
  304. package/src/UserCenter/components/status-selector/duration-menu.tsx +7 -2
  305. package/src/UserCenter/components/status-selector/index.tsx +7 -1
  306. package/src/UserCenter/components/status-selector/menu-item.tsx +1 -2
  307. package/src/UserCenter/components/storage/action.tsx +1 -2
  308. package/src/UserCenter/components/storage/connected.tsx +18 -5
  309. package/src/UserCenter/components/storage/delete.tsx +1 -1
  310. package/src/UserCenter/components/storage/disconnect.tsx +10 -2
  311. package/src/UserCenter/components/storage/index.tsx +6 -1
  312. package/src/UserCenter/components/storage/preview-nft.tsx +1 -1
  313. package/src/UserCenter/components/third-party-login/index.tsx +2 -2
  314. package/src/UserCenter/components/third-party-login/third-party-item.tsx +11 -7
  315. package/src/UserCenter/components/user-center.tsx +10 -5
  316. package/src/UserCenter/components/user-info/address.tsx +12 -6
  317. package/src/UserCenter/components/user-info/link-preview-input.tsx +36 -51
  318. package/src/UserCenter/components/user-info/metadata.tsx +45 -39
  319. package/src/UserCenter/components/user-info/timezone-select.tsx +2 -5
  320. package/src/UserCenter/components/user-info/user-basic-info.tsx +24 -8
  321. package/src/UserCenter/components/user-info/user-info-item.tsx +7 -2
  322. package/src/UserCenter/components/user-info/user-status.tsx +7 -9
  323. package/src/UserCenter/components/user-info/utils.ts +77 -11
  324. package/src/UserCenter/components/webhook-item.tsx +4 -2
  325. package/src/UserSessions/components/user-sessions.tsx +1 -1
  326. package/src/common/domain-warning.jsx +2 -14
  327. package/src/common/header-addons.jsx +8 -11
  328. package/src/common/notification-addon.jsx +1 -7
  329. package/src/common/overridable-theme-provider.jsx +1 -5
  330. package/src/common/ws.js +2 -2
  331. package/src/contexts/config-user-space.tsx +3 -3
  332. package/vite.config.mjs +31 -0
  333. package/lib/@types/shims.d.ts +0 -18
  334. package/lib/ComponentInstaller/index.d.ts +0 -37
  335. package/lib/ComponentInstaller/installer-item.d.ts +0 -21
  336. package/lib/ComponentManager/components/check-component.d.ts +0 -2
  337. package/lib/Dashboard/index.d.ts +0 -44
  338. package/lib/Footer/brand.d.ts +0 -22
  339. package/lib/Footer/copyright.d.ts +0 -18
  340. package/lib/Footer/index.d.ts +0 -6
  341. package/lib/Footer/internal-footer.d.ts +0 -29
  342. package/lib/Footer/layout/plain.d.ts +0 -15
  343. package/lib/Footer/layout/row.d.ts +0 -18
  344. package/lib/Footer/layout/standard.d.ts +0 -17
  345. package/lib/Footer/links.d.ts +0 -23
  346. package/lib/Footer/social-media.d.ts +0 -14
  347. package/lib/Notifications/Snackbar.d.ts +0 -14
  348. package/lib/UserCenter/components/danger-zone.d.ts +0 -1
  349. package/lib/UserCenter/components/passport.d.ts +0 -5
  350. package/lib/UserCenter/components/status-selector/duration-menu.d.ts +0 -7
  351. package/lib/UserCenter/components/storage/disconnect.d.ts +0 -2
  352. package/lib/UserCenter/components/storage/icons/empty-spaces-nft.svg +0 -58
  353. package/lib/UserCenter/components/storage/icons/long-arrow.svg +0 -5
  354. package/lib/UserCenter/components/storage/icons/space-connected.svg +0 -3
  355. package/lib/UserCenter/components/storage/icons/space-disconnect.svg +0 -3
  356. package/lib/UserCenter/components/storage/index.d.ts +0 -2
  357. package/lib/UserCenter/components/third-party-login/index.d.ts +0 -4
  358. package/lib/UserCenter/components/user-info/switch-role.d.ts +0 -7
  359. package/lib/UserCenter/components/user-info/user-info.d.ts +0 -6
  360. package/lib/common/domain-warning.d.ts +0 -17
  361. package/lib/common/header-addons.d.ts +0 -27
  362. package/lib/types.d.ts +0 -2
  363. /package/lib/{ComponentInstaller → packages/blocklet-ui-react/src/ComponentInstaller}/locales.d.ts +0 -0
  364. /package/lib/{ComponentManager → packages/blocklet-ui-react/src/ComponentManager}/index.d.ts +0 -0
  365. /package/lib/{ComponentManager → packages/blocklet-ui-react/src/ComponentManager}/libs/locales.d.ts +0 -0
  366. /package/lib/{Notifications → packages/blocklet-ui-react/src/Notifications}/hooks/use-width.d.ts +0 -0
  367. /package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/user-info/index.d.ts +0 -0
  368. /package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/index.d.ts +0 -0
  369. /package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/libs/locales.d.ts +0 -0
  370. /package/lib/{UserSessions → packages/blocklet-ui-react/src/UserSessions}/index.d.ts +0 -0
  371. /package/lib/{UserSessions → packages/blocklet-ui-react/src/UserSessions}/libs/locales.d.ts +0 -0
  372. /package/lib/{UserSessions → packages/blocklet-ui-react/src/UserSessions}/libs/utils.d.ts +0 -0
  373. /package/lib/{blocklets.d.ts → packages/blocklet-ui-react/src/blocklets.d.ts} +0 -0
  374. /package/lib/{common → packages/blocklet-ui-react/src/common}/wallet-hidden-topbar.d.ts +0 -0
  375. /package/lib/{common → packages/blocklet-ui-react/src/common}/ws.d.ts +0 -0
  376. /package/lib/{hooks → packages/blocklet-ui-react/src/hooks}/use-mobile.d.ts +0 -0
  377. /package/lib/{index.d.ts → packages/blocklet-ui-react/src/index.d.ts} +0 -0
  378. /package/lib/{libs → packages/blocklet-ui-react/src/libs}/client.d.ts +0 -0
  379. /package/lib/{libs → packages/blocklet-ui-react/src/libs}/constant.d.ts +0 -0
  380. /package/lib/{libs → packages/blocklet-ui-react/src/libs}/spaces.d.ts +0 -0
  381. /package/lib/{utils.d.ts → packages/blocklet-ui-react/src/utils.d.ts} +0 -0
@@ -1,161 +1,120 @@
1
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
- import React from "react";
3
- import { useCreation, useMemoizedFn } from "ahooks";
4
- import { useTheme, Link } from "@mui/material";
5
- import { WELLKNOWN_SERVICE_PATH_PREFIX } from "@abtnode/constant";
6
- import { joinURL, withQuery } from "ufo";
7
- import isEmpty from "lodash/isEmpty";
8
- import { getActivityLink } from "../utils.js";
9
- const ACTIVITY_TYPES = {
10
- COMMENT: "comment",
11
- LIKE: "like",
12
- FOLLOW: "follow",
13
- TIPS: "tips",
14
- MENTION: "mention",
15
- ASSIGN: "assign"
16
- };
17
- const ACTIVITY_DESCRIPTIONS = {
18
- comment: (targetType, count) => count && count > 1 ? /* @__PURE__ */ jsxs(Fragment, { children: [
1
+ import { jsx as s, jsxs as o, Fragment as i } from "react/jsx-runtime";
2
+ import M from "react";
3
+ import { useCreation as f, useMemoizedFn as U } from "ahooks";
4
+ import { useTheme as C, Link as E } from "@mui/material";
5
+ import { WELLKNOWN_SERVICE_PATH_PREFIX as S } from "@abtnode/constant";
6
+ import { joinURL as R, withQuery as v } from "ufo";
7
+ import D from "lodash/isEmpty";
8
+ import { getActivityLink as I } from "../utils.js";
9
+ const P = {
10
+ comment: (r, l) => l && l > 1 ? /* @__PURE__ */ o(i, { children: [
19
11
  "left ",
20
- count,
12
+ l,
21
13
  " comments on your ",
22
- targetType
23
- ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
14
+ r
15
+ ] }) : /* @__PURE__ */ o(i, { children: [
24
16
  "commented on your ",
25
- targetType
17
+ r
26
18
  ] }),
27
- like: (targetType) => /* @__PURE__ */ jsxs(Fragment, { children: [
19
+ like: (r) => /* @__PURE__ */ o(i, { children: [
28
20
  "liked your ",
29
- targetType
21
+ r
30
22
  ] }),
31
- follow: () => /* @__PURE__ */ jsx(Fragment, { children: "followed you" }),
32
- tips: (targetType) => /* @__PURE__ */ jsxs(Fragment, { children: [
23
+ follow: () => /* @__PURE__ */ s(i, { children: "followed you" }),
24
+ tips: (r) => /* @__PURE__ */ o(i, { children: [
33
25
  "gave tips to your ",
34
- targetType
26
+ r
35
27
  ] }),
36
- mention: (targetType) => /* @__PURE__ */ jsxs(Fragment, { children: [
28
+ mention: (r) => /* @__PURE__ */ o(i, { children: [
37
29
  "mentioned you in ",
38
- targetType
30
+ r
39
31
  ] }),
40
- assign: () => /* @__PURE__ */ jsx(Fragment, { children: "assigned you a task" })
32
+ assign: () => /* @__PURE__ */ s(i, { children: "assigned you a task" })
41
33
  };
42
- function UserLink({ user, color }) {
43
- const { palette } = useTheme();
44
- const profileLink = withQuery(joinURL(WELLKNOWN_SERVICE_PATH_PREFIX, "user"), { did: user.did });
45
- const _color = color || palette.text.primary;
46
- return /* @__PURE__ */ jsx(
47
- Link,
34
+ function a({ user: r, color: l }) {
35
+ const { palette: d } = C(), h = v(R(S, "user"), { did: r.did }), m = l || d.text.primary;
36
+ return /* @__PURE__ */ s(
37
+ E,
48
38
  {
49
- href: profileLink,
50
- color: _color,
51
- fontWeight: 600,
39
+ href: h,
40
+ color: m,
52
41
  target: "_blank",
53
- sx: { textDecoration: "none", "&:hover": { cursor: "pointer" } },
54
- onClick: (e) => {
55
- e.customPreventRedirect = true;
42
+ onClick: (p) => {
43
+ p.customPreventRedirect = !0;
44
+ },
45
+ sx: {
46
+ fontWeight: 600,
47
+ textDecoration: "none",
48
+ "&:hover": { cursor: "pointer" }
56
49
  },
57
- children: user.fullName || "System"
50
+ children: r.fullName || "System"
58
51
  }
59
52
  );
60
53
  }
61
- UserLink.displayName = "UserLink";
62
- export default function useActivityTitle({ activity, users, actors, extra = {}, mountPoint = "" }) {
63
- const { palette } = useTheme();
64
- const { type, target } = activity || {};
65
- const { type: targetType } = target || {};
66
- const { linkColor = palette.text.primary } = extra || {};
67
- const usersMap = useCreation(() => {
68
- if (!Array.isArray(users))
69
- return /* @__PURE__ */ new Map();
70
- const map = /* @__PURE__ */ new Map();
71
- users.forEach((user) => {
72
- if (user?.did && !map.has(user.did)) {
73
- map.set(user.did, user);
74
- }
75
- });
76
- return map;
77
- }, [users]);
78
- const uniqueUsers = useCreation(() => {
79
- if (!Array.isArray(actors))
80
- return [];
81
- return actors.map((actorId) => {
82
- if (!actorId)
83
- return null;
84
- return usersMap.get(actorId) || { did: actorId, fullName: "System" };
85
- }).filter(Boolean);
86
- }, [actors, usersMap]);
87
- const formatLinkedUserNames = useMemoizedFn(() => {
88
- if (!Array.isArray(uniqueUsers) || uniqueUsers.length === 0) {
54
+ a.displayName = "UserLink";
55
+ function H({ activity: r, users: l, actors: d, extra: h = {}, mountPoint: m = "" }) {
56
+ const { palette: p } = C(), { type: u, target: g } = r || {}, { type: y } = g || {}, { linkColor: c = p.text.primary } = h || {}, k = f(() => {
57
+ if (!Array.isArray(l)) return /* @__PURE__ */ new Map();
58
+ const e = /* @__PURE__ */ new Map();
59
+ return l.forEach((t) => {
60
+ t != null && t.did && !e.has(t.did) && e.set(t.did, t);
61
+ }), e;
62
+ }, [l]), n = f(() => Array.isArray(d) ? d.map((e) => e ? k.get(e) || { did: e, fullName: "System" } : null).filter(Boolean) : [], [d, k]), L = U(() => {
63
+ if (!Array.isArray(n) || n.length === 0)
89
64
  return null;
90
- }
91
- if (uniqueUsers.length === 1) {
92
- return /* @__PURE__ */ jsx(UserLink, { user: uniqueUsers[0], color: linkColor });
93
- }
94
- const initialUsers = uniqueUsers.slice(0, -1);
95
- const lastUser = uniqueUsers[uniqueUsers.length - 1];
96
- if (uniqueUsers.length === 2) {
97
- return /* @__PURE__ */ jsxs(Fragment, { children: [
98
- /* @__PURE__ */ jsx(UserLink, { user: initialUsers[0], color: linkColor }),
65
+ if (n.length === 1)
66
+ return /* @__PURE__ */ s(a, { user: n[0], color: c });
67
+ const e = n.slice(0, -1), t = n[n.length - 1];
68
+ if (n.length === 2)
69
+ return /* @__PURE__ */ o(i, { children: [
70
+ /* @__PURE__ */ s(a, { user: e[0], color: c }),
99
71
  " and ",
100
- /* @__PURE__ */ jsx(UserLink, { user: lastUser, color: linkColor })
72
+ /* @__PURE__ */ s(a, { user: t, color: c })
101
73
  ] });
102
- }
103
- const isMoreThanThree = uniqueUsers.length > 3;
104
- const displayUsers = isMoreThanThree ? uniqueUsers.slice(0, 2) : initialUsers;
105
- return /* @__PURE__ */ jsxs(Fragment, { children: [
106
- displayUsers.map((user, index) => /* @__PURE__ */ jsxs(React.Fragment, { children: [
107
- /* @__PURE__ */ jsx(UserLink, { user, color: linkColor }),
108
- index < displayUsers.length - 1 ? ", " : ""
109
- ] }, user.did)),
110
- isMoreThanThree ? `, and ${uniqueUsers.length - 2} others` : /* @__PURE__ */ jsxs(Fragment, { children: [
74
+ const _ = n.length > 3, N = _ ? n.slice(0, 2) : e;
75
+ return /* @__PURE__ */ o(i, { children: [
76
+ N.map((T, F) => /* @__PURE__ */ o(M.Fragment, { children: [
77
+ /* @__PURE__ */ s(a, { user: T, color: c }),
78
+ F < N.length - 1 ? ", " : ""
79
+ ] }, T.did)),
80
+ _ ? `, and ${n.length - 2} others` : /* @__PURE__ */ o(i, { children: [
111
81
  ", and ",
112
- /* @__PURE__ */ jsx(UserLink, { user: lastUser, color: linkColor })
82
+ /* @__PURE__ */ s(a, { user: t, color: c })
113
83
  ] })
114
84
  ] });
115
- });
116
- const getActivityDescription = useMemoizedFn(() => {
117
- const descriptionFn = type ? ACTIVITY_DESCRIPTIONS[type] : null;
118
- return descriptionFn ? descriptionFn(targetType, users.length) : null;
119
- });
120
- const title = useCreation(() => {
121
- const linkedNames = formatLinkedUserNames();
122
- const description = getActivityDescription();
123
- if (!linkedNames || !description) {
124
- return null;
125
- }
126
- return /* @__PURE__ */ jsxs(Fragment, { children: [
127
- linkedNames,
85
+ }), A = U(() => {
86
+ const e = u ? P[u] : null;
87
+ return e ? e(y, l.length) : null;
88
+ }), w = f(() => {
89
+ const e = L(), t = A();
90
+ return !e || !t ? null : /* @__PURE__ */ o(i, { children: [
91
+ e,
128
92
  " ",
129
- description
93
+ t
130
94
  ] });
131
- }, [type, targetType, uniqueUsers, formatLinkedUserNames, getActivityDescription]);
132
- const targetLink = useCreation(() => {
133
- if (!activity)
134
- return null;
135
- const link = getActivityLink(activity);
136
- if (link?.targetLink) {
137
- return joinURL(mountPoint, link.targetLink);
138
- }
139
- return null;
140
- }, [activity, mountPoint]);
141
- if (!type || isEmpty(target)) {
142
- return null;
143
- }
144
- return /* @__PURE__ */ jsxs(Fragment, { children: [
145
- title,
95
+ }, [u, y, n, L, A]), x = f(() => {
96
+ if (!r) return null;
97
+ const e = I(r);
98
+ return e != null && e.targetLink ? R(m, e.targetLink) : null;
99
+ }, [r, m]);
100
+ return !u || D(g) ? null : /* @__PURE__ */ o(i, { children: [
101
+ w,
146
102
  " ",
147
- targetLink && /* @__PURE__ */ jsx(
148
- Link,
103
+ x && /* @__PURE__ */ s(
104
+ E,
149
105
  {
150
- href: targetLink,
151
- color: linkColor,
106
+ href: x,
107
+ color: c,
152
108
  target: "_blank",
153
109
  sx: { textDecoration: "none" },
154
110
  onClick: (e) => {
155
- e.customPreventRedirect = true;
111
+ e.customPreventRedirect = !0;
156
112
  },
157
- children: target.name
113
+ children: g.name
158
114
  }
159
115
  )
160
116
  ] });
161
117
  }
118
+ export {
119
+ H as default
120
+ };
@@ -1,11 +1,12 @@
1
- import { useTheme } from "@arcblock/ux/lib/Theme";
2
- import useMediaQuery from "@mui/material/useMediaQuery";
3
- function useWidth() {
4
- const theme = useTheme();
5
- const keys = [...theme.breakpoints.keys].reverse();
6
- return keys.reduce((output, key) => {
7
- const matches = useMediaQuery(theme.breakpoints.up(key));
8
- return !output && matches ? key : output;
1
+ import { useTheme as n } from "@arcblock/ux/lib/Theme";
2
+ import { useMediaQuery as o } from "@mui/material";
3
+ function a() {
4
+ const e = n();
5
+ return [...e.breakpoints.keys].reverse().reduce((r, s) => {
6
+ const t = o(e.breakpoints.up(s));
7
+ return !r && t ? s : r;
9
8
  }, null) || "xs";
10
9
  }
11
- export default useWidth;
10
+ export {
11
+ a as default
12
+ };
@@ -1,130 +1,90 @@
1
- import isEmpty from "lodash/isEmpty";
2
- import DOMPurify from "dompurify";
3
- import { Link, toTextList, getLink as getLinkUtil } from "@abtnode/util/lib/notification-preview/highlight";
4
- import { isSameAddr } from "@abtnode/util/lib/notification-preview/func";
5
- import { client } from "../libs/client.js";
6
- export const mergeAdjacentNotifications = (notifications) => {
7
- if (!notifications || !notifications.length) {
1
+ import L from "lodash/isEmpty";
2
+ import $ from "dompurify";
3
+ import { toTextList as k, Link as v, getLink as i } from "@abtnode/util/lib/notification-preview/highlight";
4
+ import { isSameAddr as h } from "@abtnode/util/lib/notification-preview/func";
5
+ import { client as w } from "../libs/client.js";
6
+ const M = (s) => {
7
+ if (!s || !s.length)
8
8
  return [];
9
- }
10
- const result = [];
11
- let currentGroup = null;
12
- let groupItems = [];
13
- notifications.forEach((notification) => {
14
- if (!notification.activity || !notification.activity.type || !currentGroup) {
15
- if (currentGroup) {
16
- if (groupItems.length === 1) {
17
- result.push(groupItems[0]);
18
- } else {
19
- currentGroup.items = groupItems;
20
- result.push(currentGroup);
21
- }
22
- }
23
- if (notification.activity && notification.activity.type) {
24
- currentGroup = notification;
25
- groupItems = [notification];
26
- } else {
27
- result.push(notification);
28
- currentGroup = null;
29
- groupItems = [];
30
- }
9
+ const t = [];
10
+ let r = null, l = [];
11
+ if (s.forEach((a) => {
12
+ var c, o, g, y;
13
+ if (!a.activity || !a.activity.type || !r) {
14
+ r && (l.length === 1 ? t.push(l[0]) : (r.items = l, t.push(r))), a.activity && a.activity.type ? (r = a, l = [a]) : (t.push(a), r = null, l = []);
31
15
  return;
32
16
  }
33
- const currentActivity = groupItems[0].activity;
34
- const currentType = currentActivity?.type;
35
- const currentTargetType = currentActivity?.target?.type;
36
- const currentTargetId = currentActivity?.target?.id;
37
- const newType = notification.activity.type;
38
- const newTargetType = notification.activity.target?.type;
39
- const newTargetId = notification.activity.target?.id;
40
- const shouldMerge = (
17
+ const e = l[0].activity, n = e == null ? void 0 : e.type, p = (c = e == null ? void 0 : e.target) == null ? void 0 : c.type, u = (o = e == null ? void 0 : e.target) == null ? void 0 : o.id, d = a.activity.type, m = (g = a.activity.target) == null ? void 0 : g.type, f = (y = a.activity.target) == null ? void 0 : y.id;
18
+ if (
41
19
  // activity.type 必须相同且不为null或undefined
42
- currentType && newType && currentType === newType && // 如果都没有target,可以合并
43
- (!currentActivity?.target && !notification.activity.target || // 如果都有target,则target.type和target.id都必须相同
44
- currentActivity?.target && notification.activity.target && currentTargetType === newTargetType && currentTargetId === newTargetId)
45
- );
46
- if (shouldMerge) {
47
- groupItems.push(notification);
48
- } else {
49
- if (groupItems.length === 1) {
50
- result.push(groupItems[0]);
51
- } else {
52
- const groupToAdd = Object.assign({}, currentGroup, { items: groupItems });
53
- result.push(groupToAdd);
20
+ n && d && n === d && // 如果都没有target,可以合并
21
+ (!(e != null && e.target) && !a.activity.target || // 如果都有target,则target.type和target.id都必须相同
22
+ (e == null ? void 0 : e.target) && a.activity.target && p === m && u === f)
23
+ )
24
+ l.push(a);
25
+ else {
26
+ if (l.length === 1)
27
+ t.push(l[0]);
28
+ else {
29
+ const T = Object.assign({}, r, { items: l });
30
+ t.push(T);
54
31
  }
55
- currentGroup = notification;
56
- groupItems = [notification];
32
+ r = a, l = [a];
57
33
  }
58
- });
59
- if (currentGroup) {
60
- if (groupItems.length === 1) {
61
- result.push(groupItems[0]);
62
- } else {
63
- const groupToAdd = Object.assign({}, currentGroup, { items: groupItems });
64
- result.push(groupToAdd);
34
+ }), r)
35
+ if (l.length === 1)
36
+ t.push(l[0]);
37
+ else {
38
+ const a = Object.assign({}, r, { items: l });
39
+ t.push(a);
65
40
  }
66
- }
67
- return result;
68
- };
69
- export const isIncludeActivity = (notification) => {
70
- return !isEmpty(notification.activity) && !!notification.activity?.type && !!notification.activity?.actor;
71
- };
72
- export const canAutoRead = (notification) => {
73
- const { severity } = notification || {};
74
- return !!severity && ["normal", "success", "info"].includes(severity);
75
- };
76
- export const getActivityLink = (activity) => {
77
- if (!activity) {
41
+ return t;
42
+ }, z = (s) => {
43
+ var t, r;
44
+ return !L(s.activity) && !!((t = s.activity) != null && t.type) && !!((r = s.activity) != null && r.actor);
45
+ }, D = (s) => {
46
+ const { severity: t } = s || {};
47
+ return !!t && ["normal", "success", "info"].includes(t);
48
+ }, R = (s) => {
49
+ if (!s)
78
50
  return null;
79
- }
80
- const { meta, target } = activity;
51
+ const { meta: t, target: r } = s;
81
52
  return {
82
- metaLink: meta?.id,
83
- targetLink: target?.id
53
+ metaLink: t == null ? void 0 : t.id,
54
+ targetLink: r == null ? void 0 : r.id
84
55
  };
85
- };
86
- const getUserProfileUrl = async (did, locale) => {
56
+ }, x = async (s, t) => {
87
57
  try {
88
- const profileUrl = await client.user.getProfileUrl({ did, locale });
89
- return profileUrl;
90
- } catch (error) {
91
- console.error(error);
92
- return void 0;
58
+ return await w.user.getProfileUrl({ did: s, locale: t });
59
+ } catch (r) {
60
+ console.error(r);
61
+ return;
93
62
  }
94
- };
95
- const getLink = async (item, locale) => {
96
- const { type, did } = item;
97
- if (isSameAddr(type, "did")) {
98
- const profileUrl = await getUserProfileUrl(did, locale);
99
- return profileUrl || getLinkUtil(item);
100
- }
101
- return getLinkUtil(item);
102
- };
103
- export const toClickableSpan = async (str, locale, isHighLight = true) => {
104
- const textList = toTextList(str);
105
- const result = await Promise.all(
106
- textList.map(async (item) => {
107
- if (item instanceof Link) {
108
- if (isHighLight) {
109
- const url = await getLink(item, locale);
110
- const { type, chainId, did } = item;
111
- if (isSameAddr(type, "dapp")) {
112
- return `<em class="dapp" data-type="${type}" data-chain-id="${chainId}" data-did="${did}">${item.text}</em>`;
113
- }
114
- if (url) {
115
- return `<a target="_blank" rel="noopener noreferrer" class="link" href="${url}">${item.text}</a>`;
116
- }
117
- return `<em class="common" data-type="${type}" data-chain-id="${chainId}" data-did="${did}">${item.text}</em>`;
63
+ }, U = async (s, t) => {
64
+ const { type: r, did: l } = s;
65
+ return h(r, "did") ? await x(l, t) || i(s) : i(s);
66
+ }, S = async (s, t, r = !0) => {
67
+ const l = k(s);
68
+ return await Promise.all(
69
+ l.map(async (e) => {
70
+ if (e instanceof v) {
71
+ if (r) {
72
+ const n = await U(e, t), { type: p, chainId: u, did: d } = e;
73
+ return h(p, "dapp") ? `<em class="dapp" data-type="${p}" data-chain-id="${u}" data-did="${d}">${e.text}</em>` : n ? `<a target="_blank" rel="noopener noreferrer" class="link" href="${n}">${e.text}</a>` : `<em class="common" data-type="${p}" data-chain-id="${u}" data-did="${d}">${e.text}</em>`;
118
74
  }
119
- return item.text;
75
+ return e.text;
120
76
  }
121
- return item;
77
+ return e;
122
78
  })
123
- ).then((results) => results.join(""));
124
- return result;
125
- };
126
- export const sanitize = (innerHtml) => {
127
- return DOMPurify.sanitize(innerHtml, {
128
- ALLOWED_ATTR: ["href", "target", "rel", "class", "id", "style"]
129
- });
79
+ ).then((e) => e.join(""));
80
+ }, _ = (s) => $.sanitize(s, {
81
+ ALLOWED_ATTR: ["href", "target", "rel", "class", "id", "style"]
82
+ });
83
+ export {
84
+ D as canAutoRead,
85
+ R as getActivityLink,
86
+ z as isIncludeActivity,
87
+ M as mergeAdjacentNotifications,
88
+ _ as sanitize,
89
+ S as toClickableSpan
130
90
  };
@@ -1,36 +1,26 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { Box, TextField } from "@mui/material";
3
- import { useMemoizedFn, useReactive } from "ahooks";
4
- import Toast from "@arcblock/ux/lib/Toast";
5
- import { client } from "../../libs/client.js";
6
- import { formatAxiosError } from "../libs/utils.js";
7
- export default function ConfigInviter({ user }) {
8
- const currentState = useReactive({
9
- inviter: user?.inviter,
10
- loading: false
11
- });
12
- const handleChange = useMemoizedFn(async (e) => {
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import { Box as s, TextField as v } from "@mui/material";
3
+ import { useReactive as m, useMemoizedFn as c } from "ahooks";
4
+ import d from "@arcblock/ux/lib/Toast";
5
+ import { client as u } from "../../libs/client.js";
6
+ import { formatAxiosError as g } from "../libs/utils.js";
7
+ function I({ user: t }) {
8
+ var n, r, o;
9
+ const i = m({
10
+ inviter: t == null ? void 0 : t.inviter,
11
+ loading: !1
12
+ }), l = c(async (f) => {
13
13
  try {
14
- const { value } = e.target;
15
- currentState.loading = true;
16
- await client.user.saveProfile({ inviter: value });
17
- currentState.inviter = value;
18
- } catch (err) {
19
- Toast.error(formatAxiosError(err));
14
+ const { value: e } = f.target;
15
+ i.loading = !0, await u.user.saveProfile({ inviter: e }), i.inviter = e;
16
+ } catch (e) {
17
+ d.error(g(e));
20
18
  } finally {
21
- currentState.loading = false;
19
+ i.loading = !1;
22
20
  }
23
21
  });
24
- if (!user) {
25
- return "-";
26
- }
27
- const inviteEnabled = !!window.blocklet?.settings?.invite?.enabled;
28
- if (!inviteEnabled) {
29
- return "-";
30
- }
31
- const hasInviter = !!user.inviter;
32
- if (hasInviter) {
33
- return "-";
34
- }
35
- return /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(TextField, { size: "small", fullWidth: true, label: "", value: currentState.inviter, onChange: handleChange }) });
22
+ return !t || !!!((o = (r = (n = window.blocklet) == null ? void 0 : n.settings) == null ? void 0 : r.invite) != null && o.enabled) || !!t.inviter ? "-" : /* @__PURE__ */ a(s, { children: /* @__PURE__ */ a(v, { size: "small", fullWidth: !0, label: "", value: i.inviter, onChange: l }) });
36
23
  }
24
+ export {
25
+ I as default
26
+ };