@blocklet/ui-react 2.13.70 → 3.0.0

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 (380) 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 +90 -66
  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 +159 -156
  56. package/lib/UserCenter/components/user-info/metadata.js +291 -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 +52 -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 +29 -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 +23 -5
  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 +31 -13
  318. package/src/UserCenter/components/user-info/metadata.tsx +44 -37
  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/webhook-item.tsx +4 -2
  324. package/src/UserSessions/components/user-sessions.tsx +1 -1
  325. package/src/common/domain-warning.jsx +2 -14
  326. package/src/common/header-addons.jsx +8 -11
  327. package/src/common/notification-addon.jsx +1 -7
  328. package/src/common/overridable-theme-provider.jsx +1 -5
  329. package/src/common/ws.js +2 -2
  330. package/src/contexts/config-user-space.tsx +3 -3
  331. package/vite.config.mjs +31 -0
  332. package/lib/@types/shims.d.ts +0 -18
  333. package/lib/ComponentInstaller/index.d.ts +0 -37
  334. package/lib/ComponentInstaller/installer-item.d.ts +0 -21
  335. package/lib/ComponentManager/components/check-component.d.ts +0 -2
  336. package/lib/Dashboard/index.d.ts +0 -44
  337. package/lib/Footer/brand.d.ts +0 -22
  338. package/lib/Footer/copyright.d.ts +0 -18
  339. package/lib/Footer/index.d.ts +0 -6
  340. package/lib/Footer/internal-footer.d.ts +0 -29
  341. package/lib/Footer/layout/plain.d.ts +0 -15
  342. package/lib/Footer/layout/row.d.ts +0 -18
  343. package/lib/Footer/layout/standard.d.ts +0 -17
  344. package/lib/Footer/links.d.ts +0 -23
  345. package/lib/Footer/social-media.d.ts +0 -14
  346. package/lib/Notifications/Snackbar.d.ts +0 -14
  347. package/lib/UserCenter/components/danger-zone.d.ts +0 -1
  348. package/lib/UserCenter/components/passport.d.ts +0 -5
  349. package/lib/UserCenter/components/status-selector/duration-menu.d.ts +0 -7
  350. package/lib/UserCenter/components/storage/disconnect.d.ts +0 -2
  351. package/lib/UserCenter/components/storage/icons/empty-spaces-nft.svg +0 -58
  352. package/lib/UserCenter/components/storage/icons/long-arrow.svg +0 -5
  353. package/lib/UserCenter/components/storage/icons/space-connected.svg +0 -3
  354. package/lib/UserCenter/components/storage/icons/space-disconnect.svg +0 -3
  355. package/lib/UserCenter/components/storage/index.d.ts +0 -2
  356. package/lib/UserCenter/components/third-party-login/index.d.ts +0 -4
  357. package/lib/UserCenter/components/user-info/switch-role.d.ts +0 -7
  358. package/lib/UserCenter/components/user-info/user-info.d.ts +0 -6
  359. package/lib/common/domain-warning.d.ts +0 -17
  360. package/lib/common/header-addons.d.ts +0 -27
  361. package/lib/types.d.ts +0 -2
  362. /package/lib/{ComponentInstaller → packages/blocklet-ui-react/src/ComponentInstaller}/locales.d.ts +0 -0
  363. /package/lib/{ComponentManager → packages/blocklet-ui-react/src/ComponentManager}/index.d.ts +0 -0
  364. /package/lib/{ComponentManager → packages/blocklet-ui-react/src/ComponentManager}/libs/locales.d.ts +0 -0
  365. /package/lib/{Notifications → packages/blocklet-ui-react/src/Notifications}/hooks/use-width.d.ts +0 -0
  366. /package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/user-info/index.d.ts +0 -0
  367. /package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/index.d.ts +0 -0
  368. /package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/libs/locales.d.ts +0 -0
  369. /package/lib/{UserSessions → packages/blocklet-ui-react/src/UserSessions}/index.d.ts +0 -0
  370. /package/lib/{UserSessions → packages/blocklet-ui-react/src/UserSessions}/libs/locales.d.ts +0 -0
  371. /package/lib/{UserSessions → packages/blocklet-ui-react/src/UserSessions}/libs/utils.d.ts +0 -0
  372. /package/lib/{blocklets.d.ts → packages/blocklet-ui-react/src/blocklets.d.ts} +0 -0
  373. /package/lib/{common → packages/blocklet-ui-react/src/common}/wallet-hidden-topbar.d.ts +0 -0
  374. /package/lib/{common → packages/blocklet-ui-react/src/common}/ws.d.ts +0 -0
  375. /package/lib/{hooks → packages/blocklet-ui-react/src/hooks}/use-mobile.d.ts +0 -0
  376. /package/lib/{index.d.ts → packages/blocklet-ui-react/src/index.d.ts} +0 -0
  377. /package/lib/{libs → packages/blocklet-ui-react/src/libs}/client.d.ts +0 -0
  378. /package/lib/{libs → packages/blocklet-ui-react/src/libs}/constant.d.ts +0 -0
  379. /package/lib/{libs → packages/blocklet-ui-react/src/libs}/spaces.d.ts +0 -0
  380. /package/lib/{utils.d.ts → packages/blocklet-ui-react/src/utils.d.ts} +0 -0
@@ -1,96 +1,75 @@
1
- import { jsx } from "react/jsx-runtime";
1
+ import { jsx as i, Fragment as N } from "react/jsx-runtime";
2
2
  import "iconify-icon";
3
- import { useContext, createElement } from "react";
4
- import PropTypes from "prop-types";
5
- import { Fragment } from "react/jsx-runtime";
6
- import { SessionContext } from "@arcblock/did-connect/lib/Session";
7
- import SessionUser from "@arcblock/ux/lib/SessionUser";
8
- import SessionBlocklet from "@arcblock/ux/lib/SessionBlocklet";
9
- import LocaleSelector from "@arcblock/ux/lib/Locale/selector";
10
- import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
11
- import ThemeModeToggle from "@arcblock/ux/lib/Config/theme-mode-toggle";
12
- import { SessionManagerProps } from "../types.js";
13
- import { getLocalizedNavigation, filterNavByRole } from "../blocklets.js";
14
- import NotificationAddon from "./notification-addon.js";
15
- import DomainWarning from "./domain-warning.js";
16
- const hasNotification = () => {
17
- const navigations = window?.blocklet?.navigation ?? [];
18
- return !!navigations.find((n) => n.id === "/userCenter/notification");
3
+ import { use as T, createElement as R } from "react";
4
+ import a from "prop-types";
5
+ import { SessionContext as S } from "@arcblock/did-connect/lib/Session";
6
+ import M from "@arcblock/ux/lib/SessionUser";
7
+ import D from "@arcblock/ux/lib/SessionBlocklet";
8
+ import P from "@arcblock/ux/lib/Locale/selector";
9
+ import { useLocaleContext as j } from "@arcblock/ux/lib/Locale/context";
10
+ import k from "@arcblock/ux/lib/Config/theme-mode-toggle";
11
+ import { SessionManagerProps as z } from "../types.js";
12
+ import { getLocalizedNavigation as E, filterNavByRole as W } from "../blocklets.js";
13
+ import q from "./notification-addon.js";
14
+ import F from "./domain-warning.js";
15
+ const H = () => {
16
+ var e;
17
+ return !!(((e = window == null ? void 0 : window.blocklet) == null ? void 0 : e.navigation) ?? []).find((c) => c.id === "/userCenter/notification");
19
18
  };
20
- export default function HeaderAddons({ formattedBlocklet, addons, showDomainWarningDialog, sessionManagerProps }) {
21
- const sessionCtx = useContext(SessionContext);
22
- const { locale, languages } = useLocaleContext() || {};
23
- const { enableConnect = true, enableLocale = true } = formattedBlocklet;
24
- const authenticated = !!sessionCtx?.session?.user;
25
- let localizedNav = getLocalizedNavigation(formattedBlocklet?.navigation?.sessionManager, locale) || [];
26
- localizedNav = filterNavByRole(localizedNav, sessionCtx?.session?.user?.role);
27
- const renderAddons = () => {
28
- if (addons && typeof addons !== "function") {
29
- return Array.isArray(addons) ? addons : [addons];
30
- }
31
- let addonsArray = [];
32
- if (hasNotification()) {
33
- addonsArray.push(/* @__PURE__ */ jsx(NotificationAddon, { session: sessionCtx.session }, "notification-addon"));
34
- }
35
- if (enableLocale && locale && languages.length > 1) {
36
- addonsArray.push(/* @__PURE__ */ jsx(LocaleSelector, { showText: false }, "locale-selector"));
37
- }
38
- addonsArray.push(/* @__PURE__ */ jsx(ThemeModeToggle, {}, "theme-mode-toggle"));
39
- if (enableConnect && sessionCtx) {
40
- const menu = [];
41
- if (authenticated) {
42
- const navList = localizedNav ? localizedNav.slice(0, 5) : [];
43
- navList.forEach((x) => {
44
- menu.push({
45
- label: x.title,
46
- icon: x.icon ? /* @__PURE__ */ jsx("iconify-icon", { icon: x.icon, height: 24, style: { marginRight: 8 } }) : null,
47
- component: "a",
48
- href: x.link,
49
- key: x.link
50
- });
19
+ function O({
20
+ formattedBlocklet: s,
21
+ addons: e = null,
22
+ showDomainWarningDialog: c = !0,
23
+ sessionManagerProps: d = { showRole: !0 }
24
+ }) {
25
+ var m, u, p, g;
26
+ const o = T(S), { locale: r, languages: y } = j() || {}, { enableConnect: A = !0, enableLocale: v = !0 } = s, b = !!((m = o == null ? void 0 : o.session) != null && m.user);
27
+ let l = E((u = s == null ? void 0 : s.navigation) == null ? void 0 : u.sessionManager, r) || [];
28
+ l = W(l, (g = (p = o == null ? void 0 : o.session) == null ? void 0 : p.user) == null ? void 0 : g.role);
29
+ const f = (() => {
30
+ if (e && typeof e != "function")
31
+ return Array.isArray(e) ? e : [e];
32
+ let n = [];
33
+ if (H() && n.push(/* @__PURE__ */ i(q, { session: o.session }, "notification-addon")), v && r && y.length > 1 && n.push(/* @__PURE__ */ i(P, { showText: !1 }, "locale-selector")), n.push(/* @__PURE__ */ i(k, {}, "theme-mode-toggle")), A && o) {
34
+ const h = [];
35
+ b && (l ? l.slice(0, 5) : []).forEach((t) => {
36
+ h.push({
37
+ label: t.title,
38
+ icon: t.icon ? /* @__PURE__ */ i("iconify-icon", { icon: t.icon, height: 24, style: { marginRight: 8 } }) : null,
39
+ component: "a",
40
+ href: t.link,
41
+ key: t.link
51
42
  });
52
- }
53
- addonsArray.push(/* @__PURE__ */ jsx(SessionBlocklet, { session: sessionCtx.session, locale }, "session-blocklet"));
54
- addonsArray.push(
55
- /* @__PURE__ */ jsx(
56
- SessionUser,
43
+ }), n.push(/* @__PURE__ */ i(D, { session: o.session, locale: r }, "session-blocklet")), n.push(
44
+ /* @__PURE__ */ i(
45
+ M,
57
46
  {
58
- session: sessionCtx.session,
59
- locale,
60
- menu,
61
- showRole: true,
62
- ...sessionManagerProps
47
+ session: o.session,
48
+ locale: r,
49
+ menu: h,
50
+ showRole: !0,
51
+ ...d
63
52
  },
64
53
  "session-user"
65
54
  )
66
55
  );
67
56
  }
68
- if (typeof addons === "function") {
69
- addonsArray = addons(addonsArray) || [];
70
- }
71
- return addonsArray;
72
- };
73
- const renderedAddons = renderAddons();
74
- const nodes = Array.isArray(renderedAddons) ? renderedAddons : [renderedAddons];
75
- const mergedNodes = [
76
- showDomainWarningDialog ? /* @__PURE__ */ jsx(DomainWarning, { session: sessionCtx?.session, locale }) : null,
77
- ...nodes
57
+ return typeof e == "function" && (n = e(n) || []), n;
58
+ })(), w = Array.isArray(f) ? f : [f], L = [
59
+ c ? /* @__PURE__ */ i(F, { session: o == null ? void 0 : o.session, locale: r }) : null,
60
+ ...w
78
61
  ].filter(Boolean);
79
- return createElement(Fragment, null, ...mergedNodes);
62
+ return R(N, null, ...L);
80
63
  }
81
- HeaderAddons.propTypes = {
82
- formattedBlocklet: PropTypes.object.isRequired,
64
+ O.propTypes = {
65
+ formattedBlocklet: a.object.isRequired,
83
66
  // 需要考虑 定制的 addons 与内置的 连接钱包/选择语言 addons 共存的情况
84
67
  // - PropTypes.func: 可以把自定义 addons 插在 session-manager 或 locale-selector (如果存在的话) 前/中/后
85
68
  // - PropTypes.node: 将 addons 原样传给 UX Header 组件
86
- addons: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
87
- sessionManagerProps: SessionManagerProps,
88
- showDomainWarningDialog: PropTypes.bool
69
+ addons: a.oneOfType([a.func, a.node]),
70
+ sessionManagerProps: z,
71
+ showDomainWarningDialog: a.bool
89
72
  };
90
- HeaderAddons.defaultProps = {
91
- addons: null,
92
- sessionManagerProps: {
93
- showRole: true
94
- },
95
- showDomainWarningDialog: true
73
+ export {
74
+ O as default
96
75
  };
@@ -1,18 +1,12 @@
1
- import { jsx } from "react/jsx-runtime";
2
- function hasParentOfType(node, type) {
3
- if (!node)
4
- return false;
5
- if (type === node.nodeName)
6
- return true;
7
- return hasParentOfType(node.parentNode, type);
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ function r(n, e) {
3
+ return n ? e === n.nodeName ? !0 : r(n.parentNode, e) : !1;
8
4
  }
9
- function LinkBlocker({ ...rest }) {
10
- const handleOnClick = (e) => {
11
- const isInsideLink = hasParentOfType(e.target, "A");
12
- if (isInsideLink) {
13
- e.preventDefault();
14
- }
15
- };
16
- return /* @__PURE__ */ jsx("div", { onClick: handleOnClick, ...rest });
5
+ function s({ ...n }) {
6
+ return /* @__PURE__ */ t("div", { onClick: (i) => {
7
+ r(i.target, "A") && i.preventDefault();
8
+ }, ...n });
17
9
  }
18
- export default LinkBlocker;
10
+ export {
11
+ s as default
12
+ };
@@ -1,109 +1,76 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import Badge from "@mui/material/Badge";
3
- import PropTypes from "prop-types";
4
- import { useCallback, useEffect, useMemo } from "react";
5
- import { IconButton } from "@mui/material";
6
- import { useSnackbar } from "notistack";
7
- import NotificationsOutlinedIcon from "@arcblock/icons/lib/Notification";
8
- import { useCreation } from "ahooks";
9
- import { EVENTS, WELLKNOWN_SERVICE_PATH_PREFIX } from "@abtnode/constant";
10
- import useBrowser from "@arcblock/react-hooks/lib/useBrowser";
11
- import { joinURL, withQuery } from "ufo";
12
- import { useListenWsClient } from "./ws.js";
13
- import NotificationSnackbar from "../Notifications/Snackbar.js";
14
- import { compareVersions } from "../utils.js";
15
- const viewAllUrl = joinURL(WELLKNOWN_SERVICE_PATH_PREFIX, "user", "notifications");
16
- const getNotificationLink = (notification) => {
17
- return withQuery(viewAllUrl, {
18
- id: notification.id,
19
- severity: notification.severity || "all",
20
- componentDid: notification.source === "system" ? "system" : notification.componentDid || "all"
21
- });
22
- };
23
- export default function NotificationAddon({ session = {} }) {
24
- const { unReadCount, user, setUnReadCount } = session;
25
- const userDid = useCreation(() => user?.did, [user]);
26
- const { enqueueSnackbar } = useSnackbar();
27
- const browser = useBrowser();
28
- const hiddenNotificationToast = useMemo(() => {
29
- return browser.arcSphere || browser.wallet;
30
- }, [browser]);
31
- const serverVersion = useCreation(() => {
32
- return window.blocklet?.serverVersion;
33
- }, []);
34
- const wsClient = useListenWsClient("user");
35
- const listenEvent = useCreation(
36
- () => `${window.blocklet.did}/${userDid}/${EVENTS.NOTIFICATION_BLOCKLET_CREATE}`,
37
- [userDid]
38
- );
39
- const readListenEvent = useCreation(
40
- () => `${window.blocklet.did}/${userDid}/${EVENTS.NOTIFICATION_BLOCKLET_READ}`,
41
- [userDid]
42
- );
43
- const listenCallback = useCallback(
44
- (notification) => {
45
- const { receivers } = notification ?? {};
46
- const { receiver: notificationReceiver } = receivers[0] ?? {};
47
- if (notificationReceiver === userDid) {
48
- setUnReadCount((x) => x + 1);
49
- const isCompatible = compareVersions(serverVersion, "1.16.42-beta-20250407");
50
- if (!hiddenNotificationToast && notification.source === "component" && isCompatible) {
51
- const link = getNotificationLink(notification);
52
- const { severity, description } = notification || {};
53
- const disableAutoHide = ["error", "warning"].includes(severity) || notification.sticky;
54
- enqueueSnackbar(description, {
55
- variant: severity,
56
- autoHideDuration: disableAutoHide ? null : 5e3,
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import R from "prop-types";
3
+ import { useMemo as O, useCallback as h, useEffect as _ } from "react";
4
+ import { IconButton as $, Badge as g } from "@mui/material";
5
+ import { useSnackbar as B } from "notistack";
6
+ import D from "@arcblock/icons/lib/Notification";
7
+ import { useCreation as c } from "ahooks";
8
+ import { WELLKNOWN_SERVICE_PATH_PREFIX as S, EVENTS as y } from "@abtnode/constant";
9
+ import V from "@arcblock/react-hooks/lib/useBrowser";
10
+ import { joinURL as x, withQuery as U } from "ufo";
11
+ import { useListenWsClient as j } from "./ws.js";
12
+ import F from "../Notifications/Snackbar.js";
13
+ import { compareVersions as H } from "../utils.js";
14
+ const b = x(S, "user", "notifications"), K = (r) => U(b, {
15
+ id: r.id,
16
+ severity: r.severity || "all",
17
+ componentDid: r.source === "system" ? "system" : r.componentDid || "all"
18
+ });
19
+ function P({ session: r = {} }) {
20
+ const { unReadCount: w, user: i, setUnReadCount: n } = r, o = c(() => i == null ? void 0 : i.did, [i]), { enqueueSnackbar: E } = B(), l = V(), k = O(() => l.arcSphere || l.wallet, [l]), N = c(() => {
21
+ var e;
22
+ return (e = window.blocklet) == null ? void 0 : e.serverVersion;
23
+ }, []), t = j("user"), d = c(
24
+ () => `${window.blocklet.did}/${o}/${y.NOTIFICATION_BLOCKLET_CREATE}`,
25
+ [o]
26
+ ), a = c(
27
+ () => `${window.blocklet.did}/${o}/${y.NOTIFICATION_BLOCKLET_READ}`,
28
+ [o]
29
+ ), u = h(
30
+ (e) => {
31
+ const { receivers: f } = e ?? {}, { receiver: p } = f[0] ?? {};
32
+ if (p === o) {
33
+ n((v) => v + 1);
34
+ const C = H(N, "1.16.42-beta-20250407");
35
+ if (!k && e.source === "component" && C) {
36
+ const v = K(e), { severity: T, description: I } = e || {}, L = ["error", "warning"].includes(T) || e.sticky;
37
+ E(I, {
38
+ variant: T,
39
+ autoHideDuration: L ? null : 5e3,
57
40
  // eslint-disable-next-line react/no-unstable-nested-components
58
- content: (key) => /* @__PURE__ */ jsx(NotificationSnackbar, { viewAllUrl: link, keyId: key, notification })
41
+ content: (A) => /* @__PURE__ */ s(F, { viewAllUrl: v, keyId: A, notification: e })
59
42
  });
60
43
  }
61
44
  }
62
45
  },
63
- [userDid, setUnReadCount, enqueueSnackbar, serverVersion, hiddenNotificationToast]
64
- );
65
- const readListenCallback = useCallback(
66
- (data) => {
67
- const { receiver, readCount } = data ?? {};
68
- if (receiver === userDid) {
69
- setUnReadCount((x) => Math.max(x - readCount, 0));
70
- }
46
+ [o, n, E, N, k]
47
+ ), m = h(
48
+ (e) => {
49
+ const { receiver: f, readCount: p } = e ?? {};
50
+ f === o && n((C) => Math.max(C - p, 0));
71
51
  },
72
- [userDid, setUnReadCount]
52
+ [o, n]
73
53
  );
74
- useEffect(() => {
75
- if (wsClient) {
76
- wsClient.on(listenEvent, listenCallback);
77
- wsClient.on(readListenEvent, readListenCallback);
78
- }
79
- return () => {
80
- if (wsClient) {
81
- wsClient.off(listenEvent, listenCallback);
82
- wsClient.off(readListenEvent, readListenCallback);
83
- }
84
- };
85
- }, [wsClient, setUnReadCount, listenCallback, listenEvent, readListenCallback, readListenEvent]);
86
- if (!session.user || !viewAllUrl) {
87
- return null;
88
- }
89
- return /* @__PURE__ */ jsx(
90
- IconButton,
54
+ return _(() => (t && (t.on(d, u), t.on(a, m)), () => {
55
+ t && (t.off(d, u), t.off(a, m));
56
+ }), [t, n, u, d, m, a]), !r.user || !b ? null : /* @__PURE__ */ s(
57
+ $,
91
58
  {
92
59
  size: "medium",
93
60
  variant: "outlined",
94
- href: viewAllUrl,
61
+ href: b,
95
62
  sx: {
96
63
  "&:hover": {
97
64
  borderRadius: "50%"
98
65
  }
99
66
  },
100
- children: /* @__PURE__ */ jsx(Badge, { badgeContent: unReadCount, color: "error", invisible: unReadCount === 0, children: /* @__PURE__ */ jsx(NotificationsOutlinedIcon, { style: { width: "auto", height: 24 } }) })
67
+ children: /* @__PURE__ */ s(g, { badgeContent: w, color: "error", invisible: w === 0, children: /* @__PURE__ */ s(D, { style: { width: "auto", height: 24 } }) })
101
68
  }
102
69
  );
103
70
  }
104
- NotificationAddon.propTypes = {
105
- session: PropTypes.object
71
+ P.propTypes = {
72
+ session: R.object
106
73
  };
107
- NotificationAddon.defaultProps = {
108
- session: {}
74
+ export {
75
+ P as default
109
76
  };
@@ -1,15 +1,15 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import PropTypes from "prop-types";
3
- import { createTheme, ThemeProvider } from "@arcblock/ux/lib/Theme";
4
- const defaultTheme = createTheme();
5
- export default function OverridableThemeProvider({ theme: themeOverrides, children }) {
6
- const theme = themeOverrides ? createTheme(themeOverrides) : defaultTheme;
7
- return /* @__PURE__ */ jsx(ThemeProvider, { theme, children });
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import r from "prop-types";
3
+ import { createTheme as o, ThemeProvider as p } from "@arcblock/ux/lib/Theme";
4
+ const n = o();
5
+ function h({ theme: e = null, children: t }) {
6
+ const m = e ? o(e) : n;
7
+ return /* @__PURE__ */ i(p, { theme: m, children: t });
8
8
  }
9
- OverridableThemeProvider.propTypes = {
10
- children: PropTypes.any.isRequired,
11
- theme: PropTypes.object
9
+ h.propTypes = {
10
+ children: r.any.isRequired,
11
+ theme: r.object
12
12
  };
13
- OverridableThemeProvider.defaultProps = {
14
- theme: null
13
+ export {
14
+ h as default
15
15
  };
@@ -1,14 +1,12 @@
1
- import { useEffect } from 'react';
2
- import useBrowser from '@arcblock/react-hooks/lib/useBrowser';
3
- import bridge from '@arcblock/bridge';
4
-
5
- // wallet webview 环境中, 隐藏 wallet topbar
6
- // eslint-disable-next-line import/prefer-default-export
7
- export const useWalletHiddenTopbar = () => {
8
- const browser = useBrowser();
9
- useEffect(() => {
10
- if (browser.wallet || browser.arcSphere) {
11
- bridge.call('arcHideTopBar', '{}');
12
- }
13
- }, [browser]);
1
+ import { useEffect as e } from "react";
2
+ import o from "@arcblock/react-hooks/lib/useBrowser";
3
+ import t from "@arcblock/bridge";
4
+ const s = () => {
5
+ const r = o();
6
+ e(() => {
7
+ (r.wallet || r.arcSphere) && t.call("arcHideTopBar", "{}");
8
+ }, [r]);
9
+ };
10
+ export {
11
+ s as useWalletHiddenTopbar
14
12
  };
package/lib/common/ws.js CHANGED
@@ -1,38 +1,27 @@
1
- import { useContext } from 'react';
2
- import { WsClient } from '@arcblock/ws';
3
- import { SessionContext } from '@arcblock/did-connect/lib/Session';
4
- import { joinURL } from 'ufo';
5
- import { BLOCKLET_SERVICE_PATH_PREFIX } from '@arcblock/ux/lib/Util/constant';
6
-
7
- const client = {};
8
-
9
- export function create(endpoint = 'admin') {
10
- let pathPrefix = '/';
11
- if (!window?.blocklet && window?.env?.apiPrefix) {
12
- pathPrefix = window.env.apiPrefix;
13
- }
14
- const url = joinURL(pathPrefix, BLOCKLET_SERVICE_PATH_PREFIX, endpoint);
15
- return new WsClient(url, {
16
- heartbeatIntervalMs: 100 * 1000,
1
+ import { use as o } from "react";
2
+ import { WsClient as n } from "@arcblock/ws";
3
+ import { SessionContext as f } from "@arcblock/did-connect/lib/Session";
4
+ import { joinURL as m } from "ufo";
5
+ import { BLOCKLET_SERVICE_PATH_PREFIX as a } from "@arcblock/ux/lib/Util/constant";
6
+ const e = {};
7
+ function c(t = "admin") {
8
+ var s;
9
+ let r = "/";
10
+ !(window != null && window.blocklet) && ((s = window == null ? void 0 : window.env) != null && s.apiPrefix) && (r = window.env.apiPrefix);
11
+ const i = m(r, a, t);
12
+ return new n(i, {
13
+ heartbeatIntervalMs: 100 * 1e3
17
14
  });
18
15
  }
19
-
20
- export default function getWsClient(endpoint = 'admin') {
21
- if (!client[endpoint]) {
22
- client[endpoint] = create(endpoint);
23
- }
24
-
25
- return client[endpoint];
16
+ function l(t = "admin") {
17
+ return e[t] || (e[t] = c(t)), e[t];
26
18
  }
27
-
28
- export const useListenWsClient = (endpoint = 'admin') => {
29
- const sessionCtx = useContext(SessionContext);
30
- const { session } = sessionCtx ?? {};
31
-
32
- if (!client[endpoint] && session.user) {
33
- client[endpoint] = getWsClient(endpoint);
34
- client[endpoint].connect();
35
- }
36
-
37
- return client[endpoint];
19
+ const E = (t = "admin") => {
20
+ const r = o(f), { session: i } = r ?? {};
21
+ return !e[t] && i.user && (e[t] = l(t), e[t].connect()), e[t];
22
+ };
23
+ export {
24
+ c as create,
25
+ l as default,
26
+ E as useListenWsClient
38
27
  };
@@ -1,53 +1,44 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { createContext, useContext, useMemo, useState, useEffect } from "react";
3
- import { SessionContext } from "@arcblock/did-connect/lib/Session";
4
- const ConfigUserSpaceContext = createContext({});
5
- const { Provider, Consumer } = ConfigUserSpaceContext;
6
- function ConfigUserSpaceProvider({ children }) {
7
- const [loading] = useState(false);
8
- const { session } = useContext(SessionContext);
9
- const { user } = session;
10
- const [spaceGateway, setSpaceGateway] = useState();
11
- const storageEndpoint = useMemo(() => {
12
- return user?.didSpace?.endpoint;
13
- }, [user?.didSpace]);
14
- useEffect(() => {
15
- setSpaceGateway(user?.didSpace);
16
- }, [user?.didSpace]);
17
- const deleteSpaceGateway = async () => {
18
- setSpaceGateway(void 0);
1
+ import { jsx as g } from "react/jsx-runtime";
2
+ import { createContext as C, useState as p, use as r, useMemo as m, useEffect as u } from "react";
3
+ import { SessionContext as y } from "@arcblock/did-connect/lib/Session";
4
+ const d = C({}), { Provider: w, Consumer: U } = d;
5
+ function h({ children: n }) {
6
+ const [S] = p(!1), { session: a } = r(y), { user: e } = a, [s, o] = p(), c = m(() => {
7
+ var t;
8
+ return (t = e == null ? void 0 : e.didSpace) == null ? void 0 : t.endpoint;
9
+ }, [e == null ? void 0 : e.didSpace]);
10
+ u(() => {
11
+ o(e == null ? void 0 : e.didSpace);
12
+ }, [e == null ? void 0 : e.didSpace]);
13
+ const f = async () => {
14
+ o(void 0);
15
+ }, i = (t) => {
19
16
  };
20
- const settingStorageEndpoint = (endpoint) => {
21
- };
22
- const updateSpaceGateway = async (x) => {
23
- setSpaceGateway(x);
24
- await settingStorageEndpoint(x.endpoint);
25
- };
26
- const hasStorageEndpoint = Boolean(storageEndpoint && spaceGateway);
27
- return /* @__PURE__ */ jsx(
28
- Provider,
17
+ return /* @__PURE__ */ g(
18
+ w,
29
19
  {
30
20
  value: {
31
- loading,
32
- spaceGateway,
33
- session,
34
- deleteSpaceGateway,
35
- updateSpaceGateway,
36
- storageEndpoint,
37
- settingStorageEndpoint,
38
- hasStorageEndpoint
21
+ loading: S,
22
+ spaceGateway: s,
23
+ session: a,
24
+ deleteSpaceGateway: f,
25
+ updateSpaceGateway: async (t) => {
26
+ o(t), await i(t.endpoint);
27
+ },
28
+ storageEndpoint: c,
29
+ settingStorageEndpoint: i,
30
+ hasStorageEndpoint: !!(c && s)
39
31
  },
40
- children
32
+ children: n
41
33
  }
42
34
  );
43
35
  }
44
- function useConfigUserSpaceContext() {
45
- const res = useContext(ConfigUserSpaceContext);
46
- return res;
36
+ function P() {
37
+ return r(d);
47
38
  }
48
39
  export {
49
- ConfigUserSpaceContext,
50
- ConfigUserSpaceProvider,
51
- Consumer as ConfigUserSpaceConsumer,
52
- useConfigUserSpaceContext
40
+ U as ConfigUserSpaceConsumer,
41
+ d as ConfigUserSpaceContext,
42
+ h as ConfigUserSpaceProvider,
43
+ P as useConfigUserSpaceContext
53
44
  };
@@ -1,5 +1,8 @@
1
- import { useTheme, useMediaQuery } from "@mui/material";
2
- export default function useMobile({ key = "sm" } = {}) {
3
- const theme = useTheme();
4
- return useMediaQuery(theme.breakpoints.down(key));
1
+ import { useTheme as t, useMediaQuery as r } from "@mui/material";
2
+ function u({ key: e = "sm" } = {}) {
3
+ const o = t();
4
+ return r(o.breakpoints.down(e));
5
5
  }
6
+ export {
7
+ u as default
8
+ };
package/lib/index.js CHANGED
@@ -1,10 +1,25 @@
1
- export { default as Header } from "./Header/index.js";
2
- export { default as Footer } from "./Footer/index.js";
3
- export { default as Dashboard } from "./Dashboard/index.js";
4
- export { default as Icon } from "./Icon/index.js";
5
- export { default as ComponentInstaller } from "./ComponentInstaller/index.js";
6
- export { default as BlockletStudio } from "./BlockletStudio/index.js";
7
- export { default as useComponentInstaller } from "./ComponentInstaller/use-component-installed.js";
8
- export * from "./UserCenter/index.js";
9
- export * from "./UserSessions/index.js";
10
- export * from "./ComponentManager/index.js";
1
+ import { default as t } from "./Header/index.js";
2
+ import { default as a } from "./Footer/index.js";
3
+ import { default as s } from "./Dashboard/index.js";
4
+ import { default as d } from "./Icon/index.js";
5
+ import { default as p, default as n } from "./ComponentInstaller/index.js";
6
+ import { default as x } from "./BlockletStudio/index.js";
7
+ import { default as c } from "./ComponentInstaller/use-component-installed.js";
8
+ import { default as i } from "./UserCenter/components/user-center.js";
9
+ import { default as b } from "./UserSessions/components/user-sessions.js";
10
+ import { default as S } from "./ComponentManager/components/publish-component.js";
11
+ import { default as A } from "./ComponentManager/components/add-component.js";
12
+ export {
13
+ A as AddComponent,
14
+ x as BlockletStudio,
15
+ p as CheckComponent,
16
+ n as ComponentInstaller,
17
+ s as Dashboard,
18
+ a as Footer,
19
+ t as Header,
20
+ d as Icon,
21
+ S as PublishComponent,
22
+ i as UserCenter,
23
+ b as UserSessions,
24
+ c as useComponentInstaller
25
+ };
@@ -1,2 +1,5 @@
1
- import { BlockletSDK } from "@blocklet/js-sdk";
2
- export const client = new BlockletSDK();
1
+ import { BlockletSDK as o } from "@blocklet/js-sdk";
2
+ const e = new o();
3
+ export {
4
+ e as client
5
+ };
@@ -1 +1,4 @@
1
- export const EMBED_MODE_KEY = "blocklet-ui-react-embed-mode";
1
+ const e = "blocklet-ui-react-embed-mode";
2
+ export {
3
+ e as EMBED_MODE_KEY
4
+ };