@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,19 +1,22 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { memo } from "react";
3
- import { Chip } from "@mui/material";
4
- import { Icon } from "@iconify/react";
5
- import SwapHorizRoundedIcon from "@iconify-icons/material-symbols/swap-horiz-rounded";
6
- import { useCreation } from "ahooks";
7
- function SwitchRole({ user, switchPassport }) {
8
- const currentRole = useCreation(
1
+ import { jsx as a } from "react/jsx-runtime";
2
+ import { memo as r } from "react";
3
+ import { Chip as p } from "@mui/material";
4
+ import { Icon as m } from "@iconify/react";
5
+ import e from "@iconify-icons/material-symbols/swap-horiz-rounded";
6
+ import { useCreation as c } from "ahooks";
7
+ function f({ user: o, switchPassport: i }) {
8
+ const t = c(
9
9
  // FIXME: @zhanghan 感觉应该把 name 的判断去掉?
10
- () => (user?.passports || [])?.find((item) => item.name === user.role || item.role === user.role),
11
- [user?.passports, user?.role]
10
+ () => {
11
+ var l;
12
+ return (l = (o == null ? void 0 : o.passports) || []) == null ? void 0 : l.find((n) => n.name === o.role || n.role === o.role);
13
+ },
14
+ [o == null ? void 0 : o.passports, o == null ? void 0 : o.role]
12
15
  );
13
- return /* @__PURE__ */ jsx(
14
- Chip,
16
+ return /* @__PURE__ */ a(
17
+ p,
15
18
  {
16
- label: currentRole?.title || user?.role || "Guest",
19
+ label: (t == null ? void 0 : t.title) || (o == null ? void 0 : o.role) || "Guest",
17
20
  size: "small",
18
21
  variant: "outlined",
19
22
  sx: {
@@ -30,11 +33,14 @@ function SwitchRole({ user, switchPassport }) {
30
33
  boxShadow: "none"
31
34
  }
32
35
  },
33
- clickable: true,
34
- deleteIcon: /* @__PURE__ */ jsx(Icon, { icon: SwapHorizRoundedIcon, color: "inherit" }),
35
- onDelete: switchPassport,
36
- onClick: switchPassport
36
+ clickable: !0,
37
+ deleteIcon: /* @__PURE__ */ a(m, { icon: e, color: "inherit" }),
38
+ onDelete: i,
39
+ onClick: i
37
40
  }
38
41
  );
39
42
  }
40
- export default memo(SwitchRole);
43
+ const k = r(f);
44
+ export {
45
+ k as default
46
+ };
@@ -1,46 +1,35 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useState, useEffect, useMemo } from "react";
3
- import MenuItem from "@mui/material/MenuItem";
4
- import Select from "@mui/material/Select";
5
- import ListSubheader from "@mui/material/ListSubheader";
6
- import TextField from "@mui/material/TextField";
7
- import debounce from "lodash/debounce";
8
- import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown";
9
- import { getTimezones } from "./utils.js";
10
- const timezones = getTimezones();
11
- export function TimezoneSelect({ value, onChange, disabled = false, mode = "self" }) {
12
- const [timezoneData, setTimezoneData] = useState(timezones);
13
- const [searchText, setSearchText] = useState("");
14
- const timezoneDebounce = useMemo(
15
- () => debounce((v) => {
16
- return v ? timezones.filter((tz) => tz.value.toLowerCase().includes(v.toLowerCase())) : timezones;
17
- }, 300),
1
+ import { jsxs as h, jsx as t } from "react/jsx-runtime";
2
+ import { useState as a, useMemo as v, useEffect as d } from "react";
3
+ import { Select as x, ListSubheader as b, TextField as C, MenuItem as z } from "@mui/material";
4
+ import g from "lodash/debounce";
5
+ import { KeyboardArrowDown as T } from "@mui/icons-material";
6
+ import { getTimezones as w } from "./utils.js";
7
+ const r = w();
8
+ function P({ value: s, onChange: u, disabled: l = !1, mode: c = "self" }) {
9
+ const [m, p] = a(r), [i, f] = a(""), o = v(
10
+ () => g((e) => e ? r.filter((n) => n.value.toLowerCase().includes(e.toLowerCase())) : r, 300),
18
11
  []
19
12
  );
20
- useEffect(() => {
21
- const data = timezoneDebounce(searchText);
22
- setTimezoneData(data ?? timezones);
23
- }, [searchText, timezoneDebounce]);
24
- useEffect(() => {
25
- return () => {
26
- timezoneDebounce.cancel();
27
- };
28
- }, [timezoneDebounce]);
29
- return /* @__PURE__ */ jsxs(
30
- Select,
13
+ return d(() => {
14
+ const e = o(i);
15
+ p(e ?? r);
16
+ }, [i, o]), d(() => () => {
17
+ o.cancel();
18
+ }, [o]), /* @__PURE__ */ h(
19
+ x,
31
20
  {
32
- className: `timezone-select ${disabled ? "disabled" : ""}`,
33
- value,
34
- onChange: (e) => onChange(e.target.value),
35
- disabled,
36
- displayEmpty: true,
21
+ className: `timezone-select ${l ? "disabled" : ""}`,
22
+ value: s,
23
+ onChange: (e) => u(e.target.value),
24
+ disabled: l,
25
+ displayEmpty: !0,
37
26
  variant: "outlined",
38
27
  placeholder: "Timezone",
39
- IconComponent: (props) => /* @__PURE__ */ jsx(
40
- KeyboardArrowDownIcon,
28
+ IconComponent: (e) => /* @__PURE__ */ t(
29
+ T,
41
30
  {
42
- ...props,
43
- sx: { fontSize: 18, color: (theme) => `${theme.palette.text.secondary} !important` }
31
+ ...e,
32
+ sx: { fontSize: 18, color: (n) => `${n.palette.text.secondary} !important` }
44
33
  }
45
34
  ),
46
35
  MenuProps: {
@@ -50,7 +39,7 @@ export function TimezoneSelect({ value, onChange, disabled = false, mode = "self
50
39
  }
51
40
  },
52
41
  style: {
53
- zIndex: mode === "drawer" ? 9999 : 1300
42
+ zIndex: c === "drawer" ? 9999 : 1300
54
43
  }
55
44
  },
56
45
  sx: {
@@ -65,16 +54,16 @@ export function TimezoneSelect({ value, onChange, disabled = false, mode = "self
65
54
  }
66
55
  },
67
56
  children: [
68
- /* @__PURE__ */ jsx(ListSubheader, { children: /* @__PURE__ */ jsx(
69
- TextField,
57
+ /* @__PURE__ */ t(b, { children: /* @__PURE__ */ t(
58
+ C,
70
59
  {
71
- autoFocus: true,
72
- value: searchText,
60
+ autoFocus: !0,
61
+ value: i,
73
62
  placeholder: "Timezone",
74
63
  variant: "outlined",
75
64
  size: "small",
76
- fullWidth: true,
77
- onChange: (event) => setSearchText(event.target.value),
65
+ fullWidth: !0,
66
+ onChange: (e) => f(e.target.value),
78
67
  onClick: (e) => e.stopPropagation(),
79
68
  onKeyDown: (e) => e.stopPropagation(),
80
69
  sx: {
@@ -94,8 +83,11 @@ export function TimezoneSelect({ value, onChange, disabled = false, mode = "self
94
83
  }
95
84
  }
96
85
  ) }),
97
- timezoneData.map((tz) => /* @__PURE__ */ jsx(MenuItem, { value: tz.value, children: tz.label }, tz.value))
86
+ m.map((e) => /* @__PURE__ */ t(z, { value: e.value, children: e.label }, e.value))
98
87
  ]
99
88
  }
100
89
  );
101
90
  }
91
+ export {
92
+ P as TimezoneSelect
93
+ };
@@ -1,231 +1,223 @@
1
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
- import { Box, Divider, Typography, IconButton, Collapse } from "@mui/material";
3
- import Avatar from "@arcblock/ux/lib/Avatar";
4
- import DID from "@arcblock/ux/lib/DID";
5
- import { useMemoizedFn } from "ahooks";
6
- import { translate } from "@arcblock/ux/lib/Locale/util";
7
- import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
8
- import noop from "lodash/noop";
9
- import { useEffect, useState } from "react";
10
- import Toast from "@arcblock/ux/lib/Toast";
11
- import { parseURL, joinURL } from "ufo";
12
- import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown";
13
- import KeyboardArrowUpIcon from "@mui/icons-material/KeyboardArrowUp";
14
- import { translations } from "../../libs/locales.js";
15
- import { formatAxiosError } from "../../libs/utils.js";
16
- import { currentTimezone, getStatusDuration, isValidUrl } from "./utils.js";
17
- import SwitchRole from "./switch-role.js";
18
- import UserMetadataComponent from "./metadata.js";
19
- import UserStatus from "./user-status.js";
20
- import UserInfo from "./user-info.js";
21
- import { client } from "../../../libs/client.js";
22
- export default function UserBasicInfo({
23
- user,
24
- isMyself = true,
25
- showFullDid = true,
26
- switchPassport,
27
- switchProfile,
28
- isMobile = false,
29
- onlyProfile = false,
30
- refreshProfile,
31
- ...rest
1
+ import { jsxs as c, jsx as r, Fragment as N } from "react/jsx-runtime";
2
+ import { Box as l, Typography as z, Divider as T, IconButton as F, Collapse as K } from "@mui/material";
3
+ import W from "@arcblock/ux/lib/Avatar";
4
+ import O from "@arcblock/ux/lib/DID";
5
+ import { useMemoizedFn as Q } from "ahooks";
6
+ import { translate as V } from "@arcblock/ux/lib/Locale/util";
7
+ import { useLocaleContext as Y } from "@arcblock/ux/lib/Locale/context";
8
+ import $ from "lodash/noop";
9
+ import { useState as S, useEffect as j } from "react";
10
+ import I from "@arcblock/ux/lib/Toast";
11
+ import { parseURL as q, joinURL as G } from "ufo";
12
+ import { KeyboardArrowUp as H, KeyboardArrowDown as J } from "@mui/icons-material";
13
+ import { translations as X } from "../../libs/locales.js";
14
+ import { formatAxiosError as R } from "../../libs/utils.js";
15
+ import { currentTimezone as Z, getStatusDuration as _, isValidUrl as P } from "./utils.js";
16
+ import M from "./switch-role.js";
17
+ import tt from "./metadata.js";
18
+ import ot from "./user-status.js";
19
+ import rt from "./user-info.js";
20
+ import { client as u } from "../../../libs/client.js";
21
+ function St({
22
+ user: t,
23
+ isMyself: a = !0,
24
+ showFullDid: x = !0,
25
+ switchPassport: A,
26
+ switchProfile: b,
27
+ isMobile: e = !1,
28
+ onlyProfile: p = !1,
29
+ refreshProfile: h,
30
+ ...m
32
31
  }) {
33
- const { locale } = useLocaleContext();
34
- const [userStatus, setUserStatus] = useState(void 0);
35
- const t = useMemoizedFn((key, data = {}) => {
36
- return translate(translations, key, locale, "en", data);
37
- });
38
- const [expanded, setExpanded] = useState(!isMobile || onlyProfile);
39
- useEffect(() => {
40
- setUserStatus(user?.metadata?.status);
41
- }, [user]);
42
- useEffect(() => {
43
- setExpanded(!isMobile || onlyProfile);
44
- }, [isMobile, onlyProfile]);
45
- const onUpdateUserStatus = async (v) => {
46
- if (!isMyself) {
47
- return;
48
- }
49
- try {
50
- if (v) {
51
- const dateRange = getStatusDuration(v);
52
- v.dateRange = dateRange.length > 0 ? dateRange : userStatus?.dateRange ?? [];
53
- }
54
- setUserStatus(v);
55
- await client.user.saveProfile({
56
- // @ts-ignore
57
- metadata: {
58
- ...user?.metadata ?? { joinedAt: user?.createdAt, email: user?.email, phone: user?.phone },
59
- status: v || {}
32
+ var U;
33
+ const { locale: g } = Y(), [d, w] = S(void 0), v = Q((n, o = {}) => V(X, n, g, "en", o)), [s, y] = S(!e || p);
34
+ j(() => {
35
+ var n;
36
+ w((n = t == null ? void 0 : t.metadata) == null ? void 0 : n.status);
37
+ }, [t]), j(() => {
38
+ y(!e || p);
39
+ }, [e, p]);
40
+ const D = async (n) => {
41
+ if (a)
42
+ try {
43
+ if (n) {
44
+ const o = _(n);
45
+ n.dateRange = o.length > 0 ? o : (d == null ? void 0 : d.dateRange) ?? [];
60
46
  }
61
- });
62
- refreshProfile();
63
- } catch (err) {
64
- console.error(err);
65
- Toast.error(formatAxiosError(err));
66
- }
67
- };
68
- const toggleExpand = () => {
69
- setExpanded(!expanded);
47
+ w(n), await u.user.saveProfile({
48
+ // @ts-ignore
49
+ metadata: {
50
+ ...(t == null ? void 0 : t.metadata) ?? { joinedAt: t == null ? void 0 : t.createdAt, email: t == null ? void 0 : t.email, phone: t == null ? void 0 : t.phone },
51
+ status: n || {}
52
+ }
53
+ }), h();
54
+ } catch (o) {
55
+ console.error(o), I.error(R(o));
56
+ }
57
+ }, L = () => {
58
+ y(!s);
70
59
  };
71
- if (!user) {
60
+ if (!t)
72
61
  return null;
73
- }
74
- const onSave = async (v) => {
75
- if (!isMyself) {
62
+ const k = async (n) => {
63
+ var C;
64
+ if (!a)
76
65
  return;
77
- }
78
- const { metadata, address } = v;
66
+ const { metadata: o, address: E } = n;
79
67
  try {
80
- const newLinks = metadata?.links?.map((link) => {
81
- if (!link.url || !isValidUrl(link.url))
82
- return null;
68
+ const f = ((C = o == null ? void 0 : o.links) == null ? void 0 : C.map((i) => {
69
+ if (!i.url || !P(i.url)) return null;
83
70
  try {
84
- const parsedUrl = parseURL(link.url);
85
- if (!parsedUrl.protocol) {
86
- link.url = joinURL("https://", link.url);
87
- }
88
- return link;
89
- } catch (e) {
90
- console.error("Invalid URL:", link.url);
91
- return null;
71
+ return q(i.url).protocol || (i.url = G("https://", i.url)), i;
72
+ } catch {
73
+ return console.error("Invalid URL:", i.url), null;
92
74
  }
93
- }).filter((l) => !!l) || [];
94
- metadata.links = newLinks;
95
- await client.user.saveProfile({ metadata, address });
96
- refreshProfile();
97
- } catch (err) {
98
- console.error(err);
99
- Toast.error(formatAxiosError(err));
75
+ }).filter((i) => !!i)) || [];
76
+ o.links = f, await u.user.saveProfile({ metadata: o, address: E }), h();
77
+ } catch (f) {
78
+ console.error(f), I.error(R(f));
100
79
  }
101
80
  };
102
- return /* @__PURE__ */ jsxs(
103
- Box,
81
+ return /* @__PURE__ */ c(
82
+ l,
104
83
  {
105
- ...rest,
84
+ ...m,
106
85
  sx: {
107
86
  position: "relative",
108
- ...rest.sx ?? {}
87
+ ...m.sx ?? {}
109
88
  },
110
89
  children: [
111
- /* @__PURE__ */ jsxs(Box, { className: "user-info", display: "flex", flexDirection: isMobile ? "row" : "column", gap: 2, children: [
112
- /* @__PURE__ */ jsxs(
113
- Box,
114
- {
115
- className: "user-avatar",
116
- position: "relative",
90
+ /* @__PURE__ */ c(
91
+ l,
92
+ {
93
+ className: "user-info",
94
+ sx: {
117
95
  display: "flex",
118
- alignItems: "center",
119
- justifyContent: "space-between",
120
- children: [
121
- /* @__PURE__ */ jsx(
122
- Avatar,
123
- {
124
- src: user?.avatar,
125
- did: user?.did,
126
- size: rest.size || (isMobile ? 64 : 100),
127
- variant: "circle",
128
- shape: "circle",
129
- sx: {
130
- borderRadius: "100%",
131
- backgroundColor: "#fff",
132
- position: "relative",
133
- overflow: "hidden",
134
- flexShrink: 0,
135
- ...isMyself ? {
136
- cursor: "pointer",
137
- "&::after": {
138
- content: `"${t("switchProfile")}"`,
139
- color: "white",
140
- position: "absolute",
141
- fontSize: "12px",
142
- bottom: 0,
143
- left: 0,
144
- right: 0,
145
- height: "25%",
146
- backgroundColor: "rgba(0, 0, 0, 0.3)",
96
+ flexDirection: e ? "row" : "column",
97
+ gap: 2
98
+ },
99
+ children: [
100
+ /* @__PURE__ */ c(
101
+ l,
102
+ {
103
+ className: "user-avatar",
104
+ sx: {
105
+ position: "relative",
106
+ display: "flex",
107
+ alignItems: "center",
108
+ justifyContent: "space-between"
109
+ },
110
+ children: [
111
+ /* @__PURE__ */ r(
112
+ W,
113
+ {
114
+ src: t == null ? void 0 : t.avatar,
115
+ did: t == null ? void 0 : t.did,
116
+ size: m.size || (e ? 64 : 100),
117
+ variant: "circle",
118
+ shape: "circle",
119
+ sx: {
120
+ borderRadius: "100%",
121
+ backgroundColor: "#fff",
122
+ position: "relative",
123
+ overflow: "hidden",
124
+ flexShrink: 0,
125
+ ...a ? {
126
+ cursor: "pointer",
127
+ "&::after": {
128
+ content: `"${v("switchProfile")}"`,
129
+ color: "white",
130
+ position: "absolute",
131
+ fontSize: "12px",
132
+ bottom: 0,
133
+ left: 0,
134
+ right: 0,
135
+ height: "25%",
136
+ backgroundColor: "rgba(0, 0, 0, 0.3)",
137
+ display: "flex",
138
+ justifyContent: "center",
139
+ alignItems: "center"
140
+ }
141
+ } : {}
142
+ },
143
+ onClick: a ? b : $
144
+ }
145
+ ),
146
+ /* @__PURE__ */ r(
147
+ ot,
148
+ {
149
+ isMobile: e,
150
+ size: m.size || (e ? 64 : 100),
151
+ isMyself: a,
152
+ timezone: ((U = t == null ? void 0 : t.metadata) == null ? void 0 : U.timezone) || Z,
153
+ status: d,
154
+ onChange: D
155
+ }
156
+ )
157
+ ]
158
+ }
159
+ ),
160
+ /* @__PURE__ */ c(
161
+ l,
162
+ {
163
+ sx: {
164
+ flex: 1,
165
+ overflow: "hidden"
166
+ },
167
+ children: [
168
+ /* @__PURE__ */ c(
169
+ z,
170
+ {
171
+ variant: "h6",
172
+ component: "div",
173
+ sx: {
174
+ flex: 1,
175
+ fontWeight: 600,
147
176
  display: "flex",
148
- justifyContent: "center",
149
- alignItems: "center"
150
- }
151
- } : {}
152
- },
153
- onClick: isMyself ? switchProfile : noop
154
- }
155
- ),
156
- /* @__PURE__ */ jsx(
157
- UserStatus,
158
- {
159
- isMobile,
160
- size: rest.size || (isMobile ? 64 : 100),
161
- isMyself,
162
- timezone: user?.metadata?.timezone || currentTimezone,
163
- status: userStatus,
164
- onChange: onUpdateUserStatus
165
- }
166
- )
167
- ]
168
- }
169
- ),
170
- /* @__PURE__ */ jsxs(
171
- Box,
172
- {
173
- sx: {
174
- flex: 1,
175
- overflow: "hidden"
176
- },
177
- children: [
178
- /* @__PURE__ */ jsxs(
179
- Typography,
180
- {
181
- variant: "h6",
182
- component: "div",
183
- sx: {
184
- flex: 1,
185
- fontWeight: 600,
186
- display: "flex",
187
- alignItems: "center",
188
- gap: 1,
189
- fontSize: "24px !important",
190
- flexWrap: "wrap"
191
- },
192
- children: [
193
- /* @__PURE__ */ jsx(
194
- "span",
195
- {
196
- style: {
197
- overflow: "hidden",
198
- textOverflow: "ellipsis",
199
- whiteSpace: "nowrap"
200
- },
201
- children: user?.fullName
202
- }
203
- ),
204
- isMyself ? /* @__PURE__ */ jsx(SwitchRole, { user, switchPassport }) : null
205
- ]
206
- }
207
- ),
208
- /* @__PURE__ */ jsx(DID, { did: user.did, showQrcode: true, copyable: true, compact: !showFullDid, responsive: !showFullDid, locale })
209
- ]
210
- }
211
- )
212
- ] }),
213
- /* @__PURE__ */ jsx(UserMetadataComponent, { isMobile, isMyself, user, onSave }),
214
- isMyself ? /* @__PURE__ */ jsxs(Fragment, { children: [
215
- /* @__PURE__ */ jsx(Divider, { sx: { my: isMobile ? 1 : 3 } }),
216
- isMobile && !onlyProfile ? /* @__PURE__ */ jsx(
217
- Box,
177
+ alignItems: "center",
178
+ gap: 1,
179
+ fontSize: "24px !important",
180
+ flexWrap: "wrap"
181
+ },
182
+ children: [
183
+ /* @__PURE__ */ r(
184
+ "span",
185
+ {
186
+ style: {
187
+ overflow: "hidden",
188
+ textOverflow: "ellipsis",
189
+ whiteSpace: "nowrap"
190
+ },
191
+ children: t == null ? void 0 : t.fullName
192
+ }
193
+ ),
194
+ a ? /* @__PURE__ */ r(M, { user: t, switchPassport: A }) : null
195
+ ]
196
+ }
197
+ ),
198
+ /* @__PURE__ */ r(O, { did: t.did, showQrcode: !0, copyable: !0, compact: !x, responsive: !x, locale: g })
199
+ ]
200
+ }
201
+ )
202
+ ]
203
+ }
204
+ ),
205
+ /* @__PURE__ */ r(tt, { isMobile: e, isMyself: a, user: t, onSave: k }),
206
+ a ? /* @__PURE__ */ c(N, { children: [
207
+ /* @__PURE__ */ r(T, { sx: { my: e ? 1 : 3 } }),
208
+ e && !p ? /* @__PURE__ */ r(
209
+ l,
218
210
  {
219
211
  sx: {
220
212
  display: "flex",
221
213
  justifyContent: "center",
222
214
  mb: 0
223
215
  },
224
- children: /* @__PURE__ */ jsx(
225
- IconButton,
216
+ children: /* @__PURE__ */ r(
217
+ F,
226
218
  {
227
219
  size: "small",
228
- onClick: toggleExpand,
220
+ onClick: L,
229
221
  sx: {
230
222
  backgroundColor: "grey.50",
231
223
  "&:hover": {
@@ -233,17 +225,31 @@ export default function UserBasicInfo({
233
225
  opacity: 0.8
234
226
  }
235
227
  },
236
- children: expanded ? /* @__PURE__ */ jsx(KeyboardArrowUpIcon, {}) : /* @__PURE__ */ jsx(KeyboardArrowDownIcon, {})
228
+ children: s ? /* @__PURE__ */ r(H, {}) : /* @__PURE__ */ r(J, {})
237
229
  }
238
230
  )
239
231
  }
240
232
  ) : null,
241
- /* @__PURE__ */ jsxs(Collapse, { in: expanded, timeout: "auto", children: [
242
- /* @__PURE__ */ jsx(Typography, { component: "p", color: "text.secondary", fontSize: "14px", mb: 2, children: t("profile.justForYou") }),
243
- /* @__PURE__ */ jsx(UserInfo, { user, isMySelf: isMyself })
233
+ /* @__PURE__ */ c(K, { in: s, timeout: "auto", children: [
234
+ /* @__PURE__ */ r(
235
+ z,
236
+ {
237
+ component: "p",
238
+ sx: {
239
+ color: "text.secondary",
240
+ fontSize: "14px",
241
+ mb: 2
242
+ },
243
+ children: v("profile.justForYou")
244
+ }
245
+ ),
246
+ /* @__PURE__ */ r(rt, { user: t, isMySelf: a })
244
247
  ] })
245
248
  ] }) : null
246
249
  ]
247
250
  }
248
251
  );
249
252
  }
253
+ export {
254
+ St as default
255
+ };