@blocklet/ui-react 2.13.70 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (381) hide show
  1. package/lib/@types/index.js +5 -18
  2. package/lib/BlockletStudio/index.js +75 -89
  3. package/lib/ComponentInstaller/index.js +153 -190
  4. package/lib/ComponentInstaller/installer-item.js +56 -55
  5. package/lib/ComponentInstaller/locales.js +19 -18
  6. package/lib/ComponentInstaller/use-component-installed.js +49 -80
  7. package/lib/ComponentManager/components/add-component.js +68 -89
  8. package/lib/ComponentManager/components/check-component.js +4 -2
  9. package/lib/ComponentManager/components/publish-component.js +48 -57
  10. package/lib/ComponentManager/components/resource-dialog.js +41 -55
  11. package/lib/ComponentManager/index.js +8 -3
  12. package/lib/ComponentManager/libs/locales.js +8 -5
  13. package/lib/Dashboard/index.js +88 -124
  14. package/lib/Footer/brand.js +25 -28
  15. package/lib/Footer/copyright.js +15 -16
  16. package/lib/Footer/index.js +55 -65
  17. package/lib/Footer/internal-footer.js +93 -95
  18. package/lib/Footer/layout/plain.js +26 -24
  19. package/lib/Footer/layout/row.js +16 -20
  20. package/lib/Footer/layout/standard.js +73 -59
  21. package/lib/Footer/links.js +100 -120
  22. package/lib/Footer/social-media.js +28 -33
  23. package/lib/Header/index.js +108 -130
  24. package/lib/Icon/index.js +43 -59
  25. package/lib/Notifications/Snackbar.js +114 -151
  26. package/lib/Notifications/hooks/use-title.js +85 -126
  27. package/lib/Notifications/hooks/use-width.js +10 -9
  28. package/lib/Notifications/utils.js +74 -114
  29. package/lib/UserCenter/components/config-inviter.js +21 -31
  30. package/lib/UserCenter/components/config-profile.js +41 -47
  31. package/lib/UserCenter/components/danger-zone.js +88 -93
  32. package/lib/UserCenter/components/editable-field.js +149 -167
  33. package/lib/UserCenter/components/nft.js +91 -81
  34. package/lib/UserCenter/components/notification.js +206 -195
  35. package/lib/UserCenter/components/passport.js +37 -53
  36. package/lib/UserCenter/components/privacy.js +53 -64
  37. package/lib/UserCenter/components/settings.js +117 -128
  38. package/lib/UserCenter/components/status-dialog/date-picker.js +35 -36
  39. package/lib/UserCenter/components/status-dialog/index.js +132 -144
  40. package/lib/UserCenter/components/status-selector/duration-menu.js +53 -48
  41. package/lib/UserCenter/components/status-selector/index.js +37 -36
  42. package/lib/UserCenter/components/status-selector/menu-item.js +13 -9
  43. package/lib/UserCenter/components/storage/action.js +27 -25
  44. package/lib/UserCenter/components/storage/connected.js +59 -30
  45. package/lib/UserCenter/components/storage/delete.js +32 -39
  46. package/lib/UserCenter/components/storage/disconnect.js +43 -25
  47. package/lib/UserCenter/components/storage/icons/empty-spaces-nft.svg.js +7 -0
  48. package/lib/UserCenter/components/storage/index.js +24 -18
  49. package/lib/UserCenter/components/storage/preview-nft.js +35 -36
  50. package/lib/UserCenter/components/third-party-login/index.js +73 -143
  51. package/lib/UserCenter/components/third-party-login/third-party-item.js +132 -153
  52. package/lib/UserCenter/components/user-center.js +345 -461
  53. package/lib/UserCenter/components/user-info/address.js +120 -100
  54. package/lib/UserCenter/components/user-info/index.js +10 -4
  55. package/lib/UserCenter/components/user-info/link-preview-input.js +148 -159
  56. package/lib/UserCenter/components/user-info/metadata.js +290 -385
  57. package/lib/UserCenter/components/user-info/switch-role.js +24 -18
  58. package/lib/UserCenter/components/user-info/timezone-select.js +37 -45
  59. package/lib/UserCenter/components/user-info/user-basic-info.js +213 -207
  60. package/lib/UserCenter/components/user-info/user-info-item.js +39 -26
  61. package/lib/UserCenter/components/user-info/user-info.js +52 -67
  62. package/lib/UserCenter/components/user-info/user-status.js +111 -154
  63. package/lib/UserCenter/components/user-info/utils.js +96 -93
  64. package/lib/UserCenter/components/webhook-item.js +95 -143
  65. package/lib/UserCenter/index.js +4 -1
  66. package/lib/UserCenter/libs/locales.js +132 -129
  67. package/lib/UserCenter/libs/utils.js +17 -22
  68. package/lib/UserSessions/components/user-session-info.js +30 -26
  69. package/lib/UserSessions/components/user-sessions.js +222 -268
  70. package/lib/UserSessions/index.js +4 -1
  71. package/lib/UserSessions/libs/locales.js +31 -28
  72. package/lib/UserSessions/libs/utils.js +30 -56
  73. package/lib/blocklets.js +75 -156
  74. package/lib/common/domain-warning.js +64 -104
  75. package/lib/common/header-addons.js +59 -80
  76. package/lib/common/link-blocker.js +10 -16
  77. package/lib/common/notification-addon.js +56 -89
  78. package/lib/common/overridable-theme-provider.js +12 -12
  79. package/lib/common/wallet-hidden-topbar.js +11 -13
  80. package/lib/common/ws.js +23 -34
  81. package/lib/contexts/config-user-space.js +34 -43
  82. package/lib/hooks/use-mobile.js +7 -4
  83. package/lib/index.js +25 -10
  84. package/lib/libs/client.js +5 -2
  85. package/lib/libs/constant.js +4 -1
  86. package/lib/libs/spaces.js +11 -11
  87. package/lib/libs/with-hide-when-embed.js +13 -15
  88. package/lib/packages/blocklet-ui-react/build.config.d.ts +2 -0
  89. package/lib/packages/blocklet-ui-react/jest.config.d.ts +8 -0
  90. package/lib/packages/blocklet-ui-react/lib/@types/index.d.ts +3 -0
  91. package/lib/packages/blocklet-ui-react/lib/BlockletStudio/index.d.ts +26 -0
  92. package/lib/packages/blocklet-ui-react/lib/ComponentInstaller/index.d.ts +18 -0
  93. package/lib/packages/blocklet-ui-react/lib/ComponentInstaller/installer-item.d.ts +18 -0
  94. package/lib/packages/blocklet-ui-react/lib/ComponentInstaller/locales.d.ts +28 -0
  95. package/lib/packages/blocklet-ui-react/lib/ComponentInstaller/use-component-installed.d.ts +12 -0
  96. package/lib/packages/blocklet-ui-react/lib/ComponentManager/components/add-component.d.ts +13 -0
  97. package/lib/packages/blocklet-ui-react/lib/ComponentManager/components/check-component.d.ts +2 -0
  98. package/lib/packages/blocklet-ui-react/lib/ComponentManager/components/publish-component.d.ts +7 -0
  99. package/lib/packages/blocklet-ui-react/lib/ComponentManager/components/resource-dialog.d.ts +11 -0
  100. package/lib/packages/blocklet-ui-react/lib/ComponentManager/index.d.ts +4 -0
  101. package/lib/packages/blocklet-ui-react/lib/ComponentManager/libs/locales.d.ts +19 -0
  102. package/lib/packages/blocklet-ui-react/lib/Dashboard/index.d.ts +27 -0
  103. package/lib/packages/blocklet-ui-react/lib/Footer/brand.d.ts +15 -0
  104. package/lib/packages/blocklet-ui-react/lib/Footer/copyright.d.ts +13 -0
  105. package/lib/packages/blocklet-ui-react/lib/Footer/index.d.ts +2 -0
  106. package/lib/packages/blocklet-ui-react/lib/Footer/internal-footer.d.ts +29 -0
  107. package/lib/packages/blocklet-ui-react/lib/Footer/layout/plain.d.ts +19 -0
  108. package/lib/packages/blocklet-ui-react/lib/Footer/layout/row.d.ts +13 -0
  109. package/lib/packages/blocklet-ui-react/lib/Footer/layout/standard.d.ts +21 -0
  110. package/lib/packages/blocklet-ui-react/lib/Footer/links.d.ts +20 -0
  111. package/lib/packages/blocklet-ui-react/lib/Footer/social-media.d.ts +14 -0
  112. package/lib/packages/blocklet-ui-react/lib/Header/index.d.ts +2 -0
  113. package/lib/packages/blocklet-ui-react/lib/Icon/index.d.ts +7 -0
  114. package/lib/packages/blocklet-ui-react/lib/Notifications/Snackbar.d.ts +8 -0
  115. package/lib/packages/blocklet-ui-react/lib/Notifications/hooks/use-title.d.ts +9 -0
  116. package/lib/packages/blocklet-ui-react/lib/Notifications/hooks/use-width.d.ts +2 -0
  117. package/lib/packages/blocklet-ui-react/lib/Notifications/utils.d.ts +10 -0
  118. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/config-inviter.d.ts +4 -0
  119. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/config-profile.d.ts +5 -0
  120. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/danger-zone.d.ts +2 -0
  121. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/editable-field.d.ts +50 -0
  122. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/nft.d.ts +4 -0
  123. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/notification.d.ts +5 -0
  124. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/passport.d.ts +5 -0
  125. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/privacy.d.ts +5 -0
  126. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/settings.d.ts +8 -0
  127. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/status-dialog/date-picker.d.ts +9 -0
  128. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/status-dialog/index.d.ts +9 -0
  129. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/status-selector/duration-menu.d.ts +7 -0
  130. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/status-selector/index.d.ts +8 -0
  131. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/status-selector/menu-item.d.ts +9 -0
  132. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/storage/action.d.ts +7 -0
  133. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/storage/connected.d.ts +4 -0
  134. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/storage/delete.d.ts +5 -0
  135. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/storage/disconnect.d.ts +2 -0
  136. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/storage/icons/empty-spaces-nft.svg.d.ts +3 -0
  137. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/storage/index.d.ts +2 -0
  138. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/storage/preview-nft.d.ts +5 -0
  139. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/third-party-login/index.d.ts +4 -0
  140. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/third-party-login/third-party-item.d.ts +4 -0
  141. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/user-center.d.ts +15 -0
  142. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/user-info/address.d.ts +7 -0
  143. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/user-info/index.d.ts +5 -0
  144. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/user-info/link-preview-input.d.ts +6 -0
  145. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/user-info/metadata.d.ts +7 -0
  146. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/user-info/switch-role.d.ts +6 -0
  147. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/user-info/timezone-select.d.ts +7 -0
  148. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/user-info/user-basic-info.d.ts +12 -0
  149. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/user-info/user-info-item.d.ts +6 -0
  150. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/user-info/user-info.d.ts +6 -0
  151. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/user-info/user-status.d.ts +9 -0
  152. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/user-info/utils.d.ts +33 -0
  153. package/lib/packages/blocklet-ui-react/lib/UserCenter/components/webhook-item.d.ts +10 -0
  154. package/lib/packages/blocklet-ui-react/lib/UserCenter/index.d.ts +2 -0
  155. package/lib/packages/blocklet-ui-react/lib/UserCenter/libs/locales.d.ts +513 -0
  156. package/lib/packages/blocklet-ui-react/lib/UserCenter/libs/utils.d.ts +3 -0
  157. package/lib/packages/blocklet-ui-react/lib/UserSessions/components/user-session-info.d.ts +5 -0
  158. package/lib/packages/blocklet-ui-react/lib/UserSessions/components/user-sessions.d.ts +8 -0
  159. package/lib/packages/blocklet-ui-react/lib/UserSessions/index.d.ts +2 -0
  160. package/lib/packages/blocklet-ui-react/lib/UserSessions/libs/locales.d.ts +88 -0
  161. package/lib/packages/blocklet-ui-react/lib/UserSessions/libs/utils.d.ts +3 -0
  162. package/lib/packages/blocklet-ui-react/lib/blocklets.d.ts +18 -0
  163. package/lib/packages/blocklet-ui-react/lib/common/domain-warning.d.ts +12 -0
  164. package/lib/packages/blocklet-ui-react/lib/common/header-addons.d.ts +19 -0
  165. package/lib/packages/blocklet-ui-react/lib/common/link-blocker.d.ts +4 -0
  166. package/lib/packages/blocklet-ui-react/lib/common/notification-addon.d.ts +10 -0
  167. package/lib/packages/blocklet-ui-react/lib/common/overridable-theme-provider.d.ts +12 -0
  168. package/lib/packages/blocklet-ui-react/lib/common/wallet-hidden-topbar.d.ts +2 -0
  169. package/lib/packages/blocklet-ui-react/lib/common/ws.d.ts +4 -0
  170. package/lib/packages/blocklet-ui-react/lib/contexts/config-user-space.d.ts +7 -0
  171. package/lib/packages/blocklet-ui-react/lib/hooks/use-mobile.d.ts +4 -0
  172. package/lib/packages/blocklet-ui-react/lib/index.d.ts +12 -0
  173. package/lib/packages/blocklet-ui-react/lib/libs/client.d.ts +3 -0
  174. package/lib/packages/blocklet-ui-react/lib/libs/constant.d.ts +2 -0
  175. package/lib/packages/blocklet-ui-react/lib/libs/spaces.d.ts +3 -0
  176. package/lib/packages/blocklet-ui-react/lib/libs/with-hide-when-embed.d.ts +5 -0
  177. package/lib/packages/blocklet-ui-react/lib/types.d.ts +37 -0
  178. package/lib/packages/blocklet-ui-react/lib/utils.d.ts +11 -0
  179. package/lib/{@types → packages/blocklet-ui-react/src/@types}/index.d.ts +3 -3
  180. package/lib/{BlockletStudio → packages/blocklet-ui-react/src/BlockletStudio}/index.d.ts +1 -1
  181. package/lib/packages/blocklet-ui-react/src/ComponentInstaller/ComponentInstaller.stories.d.ts +9 -0
  182. package/lib/packages/blocklet-ui-react/src/ComponentInstaller/demo/basic.d.ts +29 -0
  183. package/lib/packages/blocklet-ui-react/src/ComponentInstaller/demo/mock-optional-components.d.ts +2 -0
  184. package/lib/packages/blocklet-ui-react/src/ComponentInstaller/index.d.ts +18 -0
  185. package/lib/packages/blocklet-ui-react/src/ComponentInstaller/installer-item.d.ts +18 -0
  186. package/lib/{ComponentInstaller → packages/blocklet-ui-react/src/ComponentInstaller}/use-component-installed.d.ts +1 -1
  187. package/lib/{ComponentManager → packages/blocklet-ui-react/src/ComponentManager}/components/add-component.d.ts +2 -2
  188. package/lib/packages/blocklet-ui-react/src/ComponentManager/components/check-component.d.ts +2 -0
  189. package/lib/{ComponentManager → packages/blocklet-ui-react/src/ComponentManager}/components/publish-component.d.ts +2 -2
  190. package/lib/{ComponentManager → packages/blocklet-ui-react/src/ComponentManager}/components/resource-dialog.d.ts +2 -2
  191. package/lib/packages/blocklet-ui-react/src/Dashboard/Dashboard.stories.d.ts +13 -0
  192. package/lib/packages/blocklet-ui-react/src/Dashboard/demo/basic.d.ts +29 -0
  193. package/lib/packages/blocklet-ui-react/src/Dashboard/index.d.ts +30 -0
  194. package/lib/packages/blocklet-ui-react/src/Footer/Footer.stories.d.ts +19 -0
  195. package/lib/packages/blocklet-ui-react/src/Footer/brand.d.ts +15 -0
  196. package/lib/packages/blocklet-ui-react/src/Footer/copyright.d.ts +13 -0
  197. package/lib/packages/blocklet-ui-react/src/Footer/demo/arcblock-site.d.ts +31 -0
  198. package/lib/packages/blocklet-ui-react/src/Footer/demo/brand.d.ts +1 -0
  199. package/lib/packages/blocklet-ui-react/src/Footer/demo/copyright.d.ts +1 -0
  200. package/lib/packages/blocklet-ui-react/src/Footer/demo/footer.d.ts +10 -0
  201. package/lib/packages/blocklet-ui-react/src/Footer/demo/links.d.ts +1 -0
  202. package/lib/packages/blocklet-ui-react/src/Footer/demo/social-media-icons.d.ts +1 -0
  203. package/lib/packages/blocklet-ui-react/src/Footer/index.d.ts +6 -0
  204. package/lib/packages/blocklet-ui-react/src/Footer/internal-footer.d.ts +32 -0
  205. package/lib/packages/blocklet-ui-react/src/Footer/layout/plain.d.ts +22 -0
  206. package/lib/packages/blocklet-ui-react/src/Footer/layout/row.d.ts +13 -0
  207. package/lib/packages/blocklet-ui-react/src/Footer/layout/standard.d.ts +24 -0
  208. package/lib/packages/blocklet-ui-react/src/Footer/links.d.ts +23 -0
  209. package/lib/packages/blocklet-ui-react/src/Footer/social-media.d.ts +14 -0
  210. package/lib/packages/blocklet-ui-react/src/Header/Header.stories.d.ts +26 -0
  211. package/lib/packages/blocklet-ui-react/src/Header/demo/addons-customization.d.ts +11 -0
  212. package/lib/packages/blocklet-ui-react/src/Header/demo/basic.d.ts +1 -0
  213. package/lib/packages/blocklet-ui-react/src/Header/demo/fixtures/index.d.ts +49 -0
  214. package/lib/packages/blocklet-ui-react/src/Header/demo/with-enable-connect-enable-locale.d.ts +1 -0
  215. package/lib/{Header → packages/blocklet-ui-react/src/Header}/index.d.ts +3 -2
  216. package/lib/packages/blocklet-ui-react/src/Icon/Icon.stories.d.ts +12 -0
  217. package/lib/packages/blocklet-ui-react/src/Icon/demo/basic.d.ts +1 -0
  218. package/lib/{Icon → packages/blocklet-ui-react/src/Icon}/index.d.ts +2 -3
  219. package/lib/packages/blocklet-ui-react/src/Notifications/Snackbar.d.ts +16 -0
  220. package/lib/{Notifications → packages/blocklet-ui-react/src/Notifications}/hooks/use-title.d.ts +1 -1
  221. package/lib/{Notifications → packages/blocklet-ui-react/src/Notifications}/utils.d.ts +2 -2
  222. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/config-inviter.d.ts +1 -1
  223. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/config-profile.d.ts +1 -1
  224. package/lib/packages/blocklet-ui-react/src/UserCenter/components/danger-zone.d.ts +1 -0
  225. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/editable-field.d.ts +3 -3
  226. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/nft.d.ts +1 -1
  227. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/notification.d.ts +1 -1
  228. package/lib/packages/blocklet-ui-react/src/UserCenter/components/passport.d.ts +5 -0
  229. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/privacy.d.ts +1 -1
  230. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/settings.d.ts +2 -2
  231. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/status-dialog/date-picker.d.ts +1 -1
  232. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/status-dialog/index.d.ts +1 -1
  233. package/lib/packages/blocklet-ui-react/src/UserCenter/components/status-selector/duration-menu.d.ts +7 -0
  234. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/status-selector/index.d.ts +1 -1
  235. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/status-selector/menu-item.d.ts +4 -4
  236. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/storage/action.d.ts +1 -1
  237. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/storage/connected.d.ts +1 -1
  238. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/storage/delete.d.ts +1 -1
  239. package/lib/packages/blocklet-ui-react/src/UserCenter/components/storage/disconnect.d.ts +2 -0
  240. package/lib/packages/blocklet-ui-react/src/UserCenter/components/storage/index.d.ts +2 -0
  241. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/storage/preview-nft.d.ts +1 -1
  242. package/lib/packages/blocklet-ui-react/src/UserCenter/components/third-party-login/index.d.ts +4 -0
  243. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/third-party-login/third-party-item.d.ts +2 -2
  244. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/user-center.d.ts +2 -2
  245. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/user-info/address.d.ts +2 -2
  246. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/user-info/link-preview-input.d.ts +1 -1
  247. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/user-info/metadata.d.ts +2 -2
  248. package/lib/packages/blocklet-ui-react/src/UserCenter/components/user-info/switch-role.d.ts +7 -0
  249. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/user-info/timezone-select.d.ts +1 -1
  250. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/user-info/user-basic-info.d.ts +3 -3
  251. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/user-info/user-info-item.d.ts +1 -1
  252. package/lib/packages/blocklet-ui-react/src/UserCenter/components/user-info/user-info.d.ts +6 -0
  253. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/user-info/user-status.d.ts +2 -2
  254. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/user-info/utils.d.ts +8 -5
  255. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/webhook-item.d.ts +1 -1
  256. package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/libs/utils.d.ts +1 -1
  257. package/lib/{UserSessions → packages/blocklet-ui-react/src/UserSessions}/components/user-session-info.d.ts +1 -1
  258. package/lib/{UserSessions → packages/blocklet-ui-react/src/UserSessions}/components/user-sessions.d.ts +1 -1
  259. package/lib/packages/blocklet-ui-react/src/common/domain-warning.d.ts +12 -0
  260. package/lib/packages/blocklet-ui-react/src/common/header-addons.d.ts +19 -0
  261. package/lib/{common → packages/blocklet-ui-react/src/common}/link-blocker.d.ts +1 -1
  262. package/lib/{common → packages/blocklet-ui-react/src/common}/notification-addon.d.ts +3 -6
  263. package/lib/{common → packages/blocklet-ui-react/src/common}/overridable-theme-provider.d.ts +5 -8
  264. package/lib/{contexts → packages/blocklet-ui-react/src/contexts}/config-user-space.d.ts +3 -3
  265. package/lib/{libs → packages/blocklet-ui-react/src/libs}/with-hide-when-embed.d.ts +1 -1
  266. package/lib/packages/blocklet-ui-react/src/types.d.ts +36 -0
  267. package/lib/packages/blocklet-ui-react/tools/auto-exports.d.ts +1 -0
  268. package/lib/packages/blocklet-ui-react/tools/jest.d.ts +1 -0
  269. package/lib/packages/blocklet-ui-react/vite.config.d.mts +2 -0
  270. package/lib/types.js +39 -39
  271. package/lib/utils.js +61 -175
  272. package/package.json +28 -34
  273. package/src/ComponentInstaller/ComponentInstaller.stories.jsx +16 -0
  274. package/src/ComponentInstaller/index.jsx +11 -27
  275. package/src/ComponentInstaller/installer-item.jsx +1 -5
  276. package/src/ComponentManager/components/add-component.tsx +3 -3
  277. package/src/ComponentManager/components/publish-component.tsx +3 -3
  278. package/src/Dashboard/Dashboard.stories.jsx +20 -0
  279. package/src/Dashboard/index.jsx +16 -27
  280. package/src/Footer/Footer.stories.jsx +32 -0
  281. package/src/Footer/brand.jsx +1 -7
  282. package/src/Footer/copyright.jsx +1 -6
  283. package/src/Footer/index.jsx +1 -6
  284. package/src/Footer/internal-footer.jsx +26 -16
  285. package/src/Footer/layout/row.jsx +2 -7
  286. package/src/Footer/layout/standard.jsx +12 -2
  287. package/src/Footer/links.jsx +2 -7
  288. package/src/Footer/social-media.jsx +1 -5
  289. package/src/Header/Header.stories.jsx +30 -0
  290. package/src/Header/index.tsx +1 -1
  291. package/src/Icon/Icon.stories.jsx +12 -0
  292. package/src/Notifications/Snackbar.tsx +119 -126
  293. package/src/Notifications/hooks/use-title.tsx +5 -2
  294. package/src/Notifications/hooks/use-width.tsx +1 -1
  295. package/src/UserCenter/components/config-profile.tsx +0 -1
  296. package/src/UserCenter/components/danger-zone.tsx +7 -3
  297. package/src/UserCenter/components/editable-field.tsx +45 -44
  298. package/src/UserCenter/components/nft.tsx +21 -9
  299. package/src/UserCenter/components/notification.tsx +22 -6
  300. package/src/UserCenter/components/privacy.tsx +1 -1
  301. package/src/UserCenter/components/settings.tsx +6 -1
  302. package/src/UserCenter/components/status-dialog/date-picker.tsx +10 -7
  303. package/src/UserCenter/components/status-dialog/index.tsx +11 -4
  304. package/src/UserCenter/components/status-selector/duration-menu.tsx +7 -2
  305. package/src/UserCenter/components/status-selector/index.tsx +7 -1
  306. package/src/UserCenter/components/status-selector/menu-item.tsx +1 -2
  307. package/src/UserCenter/components/storage/action.tsx +1 -2
  308. package/src/UserCenter/components/storage/connected.tsx +18 -5
  309. package/src/UserCenter/components/storage/delete.tsx +1 -1
  310. package/src/UserCenter/components/storage/disconnect.tsx +10 -2
  311. package/src/UserCenter/components/storage/index.tsx +6 -1
  312. package/src/UserCenter/components/storage/preview-nft.tsx +1 -1
  313. package/src/UserCenter/components/third-party-login/index.tsx +2 -2
  314. package/src/UserCenter/components/third-party-login/third-party-item.tsx +11 -7
  315. package/src/UserCenter/components/user-center.tsx +10 -5
  316. package/src/UserCenter/components/user-info/address.tsx +12 -6
  317. package/src/UserCenter/components/user-info/link-preview-input.tsx +36 -51
  318. package/src/UserCenter/components/user-info/metadata.tsx +45 -39
  319. package/src/UserCenter/components/user-info/timezone-select.tsx +2 -5
  320. package/src/UserCenter/components/user-info/user-basic-info.tsx +24 -8
  321. package/src/UserCenter/components/user-info/user-info-item.tsx +7 -2
  322. package/src/UserCenter/components/user-info/user-status.tsx +7 -9
  323. package/src/UserCenter/components/user-info/utils.ts +77 -11
  324. package/src/UserCenter/components/webhook-item.tsx +4 -2
  325. package/src/UserSessions/components/user-sessions.tsx +1 -1
  326. package/src/common/domain-warning.jsx +2 -14
  327. package/src/common/header-addons.jsx +8 -11
  328. package/src/common/notification-addon.jsx +1 -7
  329. package/src/common/overridable-theme-provider.jsx +1 -5
  330. package/src/common/ws.js +2 -2
  331. package/src/contexts/config-user-space.tsx +3 -3
  332. package/vite.config.mjs +31 -0
  333. package/lib/@types/shims.d.ts +0 -18
  334. package/lib/ComponentInstaller/index.d.ts +0 -37
  335. package/lib/ComponentInstaller/installer-item.d.ts +0 -21
  336. package/lib/ComponentManager/components/check-component.d.ts +0 -2
  337. package/lib/Dashboard/index.d.ts +0 -44
  338. package/lib/Footer/brand.d.ts +0 -22
  339. package/lib/Footer/copyright.d.ts +0 -18
  340. package/lib/Footer/index.d.ts +0 -6
  341. package/lib/Footer/internal-footer.d.ts +0 -29
  342. package/lib/Footer/layout/plain.d.ts +0 -15
  343. package/lib/Footer/layout/row.d.ts +0 -18
  344. package/lib/Footer/layout/standard.d.ts +0 -17
  345. package/lib/Footer/links.d.ts +0 -23
  346. package/lib/Footer/social-media.d.ts +0 -14
  347. package/lib/Notifications/Snackbar.d.ts +0 -14
  348. package/lib/UserCenter/components/danger-zone.d.ts +0 -1
  349. package/lib/UserCenter/components/passport.d.ts +0 -5
  350. package/lib/UserCenter/components/status-selector/duration-menu.d.ts +0 -7
  351. package/lib/UserCenter/components/storage/disconnect.d.ts +0 -2
  352. package/lib/UserCenter/components/storage/icons/empty-spaces-nft.svg +0 -58
  353. package/lib/UserCenter/components/storage/icons/long-arrow.svg +0 -5
  354. package/lib/UserCenter/components/storage/icons/space-connected.svg +0 -3
  355. package/lib/UserCenter/components/storage/icons/space-disconnect.svg +0 -3
  356. package/lib/UserCenter/components/storage/index.d.ts +0 -2
  357. package/lib/UserCenter/components/third-party-login/index.d.ts +0 -4
  358. package/lib/UserCenter/components/user-info/switch-role.d.ts +0 -7
  359. package/lib/UserCenter/components/user-info/user-info.d.ts +0 -6
  360. package/lib/common/domain-warning.d.ts +0 -17
  361. package/lib/common/header-addons.d.ts +0 -27
  362. package/lib/types.d.ts +0 -2
  363. /package/lib/{ComponentInstaller → packages/blocklet-ui-react/src/ComponentInstaller}/locales.d.ts +0 -0
  364. /package/lib/{ComponentManager → packages/blocklet-ui-react/src/ComponentManager}/index.d.ts +0 -0
  365. /package/lib/{ComponentManager → packages/blocklet-ui-react/src/ComponentManager}/libs/locales.d.ts +0 -0
  366. /package/lib/{Notifications → packages/blocklet-ui-react/src/Notifications}/hooks/use-width.d.ts +0 -0
  367. /package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/components/user-info/index.d.ts +0 -0
  368. /package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/index.d.ts +0 -0
  369. /package/lib/{UserCenter → packages/blocklet-ui-react/src/UserCenter}/libs/locales.d.ts +0 -0
  370. /package/lib/{UserSessions → packages/blocklet-ui-react/src/UserSessions}/index.d.ts +0 -0
  371. /package/lib/{UserSessions → packages/blocklet-ui-react/src/UserSessions}/libs/locales.d.ts +0 -0
  372. /package/lib/{UserSessions → packages/blocklet-ui-react/src/UserSessions}/libs/utils.d.ts +0 -0
  373. /package/lib/{blocklets.d.ts → packages/blocklet-ui-react/src/blocklets.d.ts} +0 -0
  374. /package/lib/{common → packages/blocklet-ui-react/src/common}/wallet-hidden-topbar.d.ts +0 -0
  375. /package/lib/{common → packages/blocklet-ui-react/src/common}/ws.d.ts +0 -0
  376. /package/lib/{hooks → packages/blocklet-ui-react/src/hooks}/use-mobile.d.ts +0 -0
  377. /package/lib/{index.d.ts → packages/blocklet-ui-react/src/index.d.ts} +0 -0
  378. /package/lib/{libs → packages/blocklet-ui-react/src/libs}/client.d.ts +0 -0
  379. /package/lib/{libs → packages/blocklet-ui-react/src/libs}/constant.d.ts +0 -0
  380. /package/lib/{libs → packages/blocklet-ui-react/src/libs}/spaces.d.ts +0 -0
  381. /package/lib/{utils.d.ts → packages/blocklet-ui-react/src/utils.d.ts} +0 -0
@@ -1,78 +1,61 @@
1
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
- import { createElement } from "react";
3
- import { Icon } from "@iconify/react";
4
- import { Box, Backdrop, useMediaQuery, SwipeableDrawer, Typography, Tooltip } from "@mui/material";
5
- import styled from "@emotion/styled";
6
- import { joinURL } from "ufo";
7
- import Button from "@arcblock/ux/lib/Button";
8
- import PhoneInput, {
9
- validatePhoneNumber,
10
- getDialCodeByCountry,
11
- getCountryNameByCountry,
12
- detectCountryFromPhone
13
- } from "@arcblock/ux/lib/PhoneInput";
14
- import cloneDeep from "lodash/cloneDeep";
15
- import omit from "lodash/omit";
16
- import { mergeSx } from "@arcblock/ux/lib/Util/style";
17
- import { LOGIN_PROVIDER } from "@arcblock/ux/lib/Util/constant";
18
- import { useCreation, useMemoizedFn, useReactive } from "ahooks";
19
- import { useMemo, useRef, useState, memo, forwardRef, useEffect, lazy } from "react";
20
- import { translate } from "@arcblock/ux/lib/Locale/util";
21
- import isEmail from "validator/lib/isEmail";
22
- import isPostalCode from "validator/lib/isPostalCode";
23
- import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
24
- import { useBrowser } from "@arcblock/react-hooks";
25
- import Clock from "@arcblock/ux/lib/UserCard/Content/clock";
26
- import { translations } from "../../libs/locales.js";
27
- import EditableField, { commonInputStyle, inputFieldStyle } from "../editable-field.js";
28
- import { LinkPreviewInput } from "./link-preview-input.js";
29
- import { currentTimezone, defaultButtonStyle, primaryButtonStyle } from "./utils.js";
30
- import { TimezoneSelect } from "./timezone-select.js";
31
- import AddressEditor from "./address.js";
32
- const LocationIcon = lazy(() => import("@arcblock/icons/lib/Location"));
33
- const TimezoneIcon = lazy(() => import("@arcblock/icons/lib/Timezone"));
34
- const EmailIcon = lazy(() => import("@arcblock/icons/lib/Email"));
35
- const PhoneIcon = lazy(() => import("@arcblock/icons/lib/Phone"));
36
- const iconSize = {
1
+ import { jsxs as x, Fragment as A, jsx as a } from "react/jsx-runtime";
2
+ import { lazy as P, memo as mo, createElement as ho, useState as H, useRef as fo, useEffect as so, useMemo as Q } from "react";
3
+ import { Icon as yo } from "@iconify/react";
4
+ import { Backdrop as xo, Box as f, useMediaQuery as bo, SwipeableDrawer as uo, Typography as S, Tooltip as go } from "@mui/material";
5
+ import Co from "@emotion/styled";
6
+ import O from "@arcblock/ux/lib/Button";
7
+ import U, { detectCountryFromPhone as Y, getCountryNameByCountry as vo, validatePhoneNumber as wo, getDialCodeByCountry as ko } from "@arcblock/ux/lib/PhoneInput";
8
+ import k from "lodash/cloneDeep";
9
+ import Eo from "lodash/omit";
10
+ import { mergeSx as Io } from "@arcblock/ux/lib/Util/style";
11
+ import { LOGIN_PROVIDER as _ } from "@arcblock/ux/lib/Util/constant";
12
+ import { useReactive as E, useCreation as I, useMemoizedFn as zo } from "ahooks";
13
+ import { translate as Po } from "@arcblock/ux/lib/Locale/util";
14
+ import Vo from "validator/lib/isEmail";
15
+ import q from "validator/lib/isPostalCode";
16
+ import { useLocaleContext as Bo } from "@arcblock/ux/lib/Locale/context";
17
+ import { useBrowser as Lo } from "@arcblock/react-hooks";
18
+ import No from "@arcblock/ux/lib/UserCard/Content/clock";
19
+ import { translations as jo } from "../../libs/locales.js";
20
+ import g, { inputFieldStyle as Ao, commonInputStyle as So } from "../editable-field.js";
21
+ import { LinkPreviewInput as Oo } from "./link-preview-input.js";
22
+ import { defaultButtonStyle as J, currentTimezone as R, primaryButtonStyle as Ro } from "./utils.js";
23
+ import { TimezoneSelect as Do } from "./timezone-select.js";
24
+ import Wo from "./address.js";
25
+ const To = P(() => import("@arcblock/icons/lib/Location")), Fo = P(() => import("@arcblock/icons/lib/Timezone")), Mo = P(() => import("@arcblock/icons/lib/Email")), $o = P(() => import("@arcblock/icons/lib/Phone")), z = {
37
26
  width: 20,
38
27
  height: 20
39
- };
40
- const bioMaxLength = 200;
41
- const BackdropWrap = memo(
42
- forwardRef(function BackdropWrap2(backdropProps, ref) {
43
- return /* @__PURE__ */ createElement(
44
- Backdrop,
45
- {
46
- ref,
47
- component: "div",
48
- style: {
49
- backgroundColor: "rgba(0, 0, 0, 0.6)",
50
- backdropFilter: "blur(3px)",
51
- touchAction: "none"
52
- },
53
- ...backdropProps,
54
- key: "background"
55
- }
56
- );
57
- })
58
- );
59
- BackdropWrap.displayName = "BackdropWrap";
60
- export default function UserMetadataComponent({
61
- isMyself,
62
- user,
63
- onSave,
64
- isMobile
28
+ }, K = 200, X = mo(function({
29
+ ref: o,
30
+ ...V
31
+ }) {
32
+ return /* @__PURE__ */ ho(
33
+ xo,
34
+ {
35
+ ref: o,
36
+ component: "div",
37
+ style: {
38
+ backgroundColor: "rgba(0, 0, 0, 0.6)",
39
+ backdropFilter: "blur(3px)",
40
+ touchAction: "none"
41
+ },
42
+ ...V,
43
+ key: "background"
44
+ }
45
+ );
46
+ });
47
+ X.displayName = "BackdropWrap";
48
+ function se({
49
+ isMyself: m,
50
+ user: o,
51
+ onSave: V,
52
+ isMobile: b
65
53
  }) {
66
- const [editable, setEditable] = useState(false);
67
- const [visible, setVisible] = useState(false);
68
- const drawerDragger = useRef(null);
69
- const browser = useBrowser();
70
- const isMobileView = useMediaQuery("(max-width:640px)") || browser.mobile.any;
71
- const validateMsg = useReactive({
54
+ var $, G;
55
+ const [Z, B] = H(!1), [oo, C] = H(!1), eo = fo(null), no = Lo(), u = bo("(max-width:640px)") || no.mobile.any, p = E({
72
56
  email: "",
73
57
  phone: ""
74
- });
75
- const addressValidateMsg = useReactive({
58
+ }), s = E({
76
59
  country: "",
77
60
  province: "",
78
61
  city: "",
@@ -80,33 +63,20 @@ export default function UserMetadataComponent({
80
63
  line2: "",
81
64
  postalCode: ""
82
65
  });
83
- useEffect(() => {
84
- if (!isMobileView) {
85
- setVisible(false);
86
- }
87
- }, [isMobileView]);
88
- const phoneVerified = useCreation(() => {
89
- return user?.phoneVerified ?? false;
90
- }, [user?.phoneVerified]);
91
- const emailVerified = useCreation(() => {
92
- return user?.emailVerified ?? false;
93
- }, [user?.emailVerified]);
94
- const { locale } = useLocaleContext();
95
- const t = useMemoizedFn((key, data = {}) => {
96
- return translate(translations, key, locale, "en", data);
97
- });
98
- const metadata = useReactive(
99
- user?.metadata ? cloneDeep(user.metadata) : {
100
- joinedAt: user?.createdAt,
101
- email: user?.email,
66
+ so(() => {
67
+ u || C(!1);
68
+ }, [u]);
69
+ const D = I(() => (o == null ? void 0 : o.phoneVerified) ?? !1, [o == null ? void 0 : o.phoneVerified]), W = I(() => (o == null ? void 0 : o.emailVerified) ?? !1, [o == null ? void 0 : o.emailVerified]), { locale: L } = Bo(), c = zo((n, i = {}) => Po(jo, n, L, "en", i)), l = E(
70
+ o != null && o.metadata ? k(o.metadata) : {
71
+ joinedAt: o == null ? void 0 : o.createdAt,
72
+ email: o == null ? void 0 : o.email,
102
73
  phone: {
103
74
  country: "cn",
104
- phoneNumber: user?.phone ?? ""
75
+ phoneNumber: (o == null ? void 0 : o.phone) ?? ""
105
76
  }
106
77
  }
107
- );
108
- const address = useReactive(
109
- user?.address ? cloneDeep(user.address) : {
78
+ ), r = E(
79
+ o != null && o.address ? k(o.address) : {
110
80
  country: "",
111
81
  province: "",
112
82
  city: "",
@@ -114,269 +84,208 @@ export default function UserMetadataComponent({
114
84
  line2: "",
115
85
  postalCode: ""
116
86
  }
117
- );
118
- const isSupportAddress = useCreation(() => {
119
- return !!user?.address;
120
- }, [user?.address?.country]);
121
- const defaultCountry = useMemo(() => {
122
- if (user?.address?.country) {
123
- return user.address.country;
124
- }
125
- return locale === "zh" ? "cn" : "us";
126
- }, [user?.address?.country, locale]);
127
- const phoneValue = useCreation(() => {
128
- const phone = metadata.phone ?? user?.phone ?? {
129
- country: defaultCountry,
87
+ ), to = I(() => !!(o != null && o.address), [($ = o == null ? void 0 : o.address) == null ? void 0 : $.country]), y = Q(() => {
88
+ var n;
89
+ return (n = o == null ? void 0 : o.address) != null && n.country ? o.address.country : L === "zh" ? "cn" : "us";
90
+ }, [(G = o == null ? void 0 : o.address) == null ? void 0 : G.country, L]), N = I(() => {
91
+ const n = l.phone ?? (o == null ? void 0 : o.phone) ?? {
92
+ country: y,
130
93
  phone: ""
131
94
  };
132
- if (phone && typeof phone === "string") {
133
- const detectedCountry = detectCountryFromPhone(phone);
95
+ if (n && typeof n == "string")
134
96
  return {
135
- country: detectedCountry || defaultCountry,
136
- phone
97
+ country: Y(n) || y,
98
+ phone: n
137
99
  };
138
- }
139
- if (phone && typeof phone === "object") {
140
- const { country: phoneCountry = "", phoneNumber = "" } = phone;
141
- const detectedCountry = !phoneCountry ? detectCountryFromPhone(phoneNumber) || "" : phoneCountry;
100
+ if (n && typeof n == "object") {
101
+ const { country: i = "", phoneNumber: t = "" } = n;
142
102
  return {
143
- country: detectedCountry,
144
- phone: phoneNumber || ""
103
+ country: i || Y(t) || "",
104
+ phone: t || ""
145
105
  };
146
106
  }
147
107
  return {
148
- country: defaultCountry,
108
+ country: y,
149
109
  phone: ""
150
110
  };
151
- }, [metadata.phone, user?.phone, defaultCountry]);
152
- const onChange = (v, field) => {
153
- metadata[field] = v;
154
- };
155
- const onAddressChange = (field, value) => {
156
- address[field] = value;
157
- if (field === "city") {
158
- onChange(value, "location");
159
- }
160
- if (field === "postalCode") {
161
- addressValidateMsg.postalCode = value && !isPostalCode(value, "any") ? t("profile.address.invalidPostalCode") : "";
162
- } else {
163
- addressValidateMsg[field] = "";
164
- }
165
- };
166
- const onEdit = () => {
167
- if (!isMobileView) {
168
- setEditable(true);
169
- } else {
170
- setVisible(true);
171
- }
172
- };
173
- const onCancel = () => {
174
- const defaultMetadata = cloneDeep(user?.metadata) ?? {};
175
- if (defaultMetadata) {
176
- Object.keys(metadata).forEach((key) => {
177
- const k = key;
178
- metadata[k] = defaultMetadata[k];
179
- });
180
- }
181
- const defaultAddress = cloneDeep(user?.address) ?? {};
182
- if (defaultAddress) {
183
- Object.keys(address).forEach((key) => {
184
- const k = key;
185
- address[k] = defaultAddress[k];
186
- });
187
- }
188
- [validateMsg, addressValidateMsg].forEach((o) => {
189
- Object.keys(o).forEach((key) => {
190
- o[key] = "";
191
- });
111
+ }, [l.phone, o == null ? void 0 : o.phone, y]), h = (n, i) => {
112
+ l[i] = n;
113
+ }, io = (n, i) => {
114
+ r[n] = i, n === "city" && h(i, "location"), n === "postalCode" ? s.postalCode = i && !q(i, "any") ? c("profile.address.invalidPostalCode") : "" : s[n] = "";
115
+ }, T = () => {
116
+ u ? C(!0) : B(!0);
117
+ }, F = () => {
118
+ const n = k(o == null ? void 0 : o.metadata) ?? {};
119
+ n && Object.keys(l).forEach((t) => {
120
+ const e = t;
121
+ l[e] = n[e];
192
122
  });
193
- if (!isMobileView) {
194
- setEditable(false);
195
- } else {
196
- setVisible(false);
197
- }
198
- };
199
- const links = useMemo(() => {
200
- const defaultLinks = metadata?.links?.map((link) => link.url) || [""];
201
- return defaultLinks.length > 0 ? defaultLinks : [""];
202
- }, [metadata.links]);
203
- const handleLinksChange = (values) => {
204
- const newLinks = values.map((link) => {
205
- if (!link) {
206
- return {
207
- url: link
208
- };
209
- }
210
- const targetLink = metadata.links?.find((l) => l.url === link);
211
- if (targetLink) {
123
+ const i = k(o == null ? void 0 : o.address) ?? {};
124
+ i && Object.keys(r).forEach((t) => {
125
+ const e = t;
126
+ r[e] = i[e];
127
+ }), [p, s].forEach((t) => {
128
+ Object.keys(t).forEach((e) => {
129
+ t[e] = "";
130
+ });
131
+ }), u ? C(!1) : B(!1);
132
+ }, ao = Q(() => {
133
+ var i;
134
+ const n = ((i = l == null ? void 0 : l.links) == null ? void 0 : i.map((t) => t.url)) || [""];
135
+ return n.length > 0 ? n : [""];
136
+ }, [l.links]), lo = (n) => {
137
+ const i = n.map((t) => {
138
+ var d;
139
+ if (!t)
212
140
  return {
213
- ...targetLink,
214
- url: link
141
+ url: t
215
142
  };
216
- }
217
- return {
218
- url: link,
219
- favicon: joinURL(link, "favicon.ico")
143
+ const e = (d = l.links) == null ? void 0 : d.find((v) => v.url === t);
144
+ return e ? {
145
+ ...e,
146
+ url: t
147
+ } : {
148
+ url: t,
149
+ favicon: t
220
150
  };
221
151
  });
222
- onChange(newLinks, "links");
223
- };
224
- const handleSave = () => {
225
- Object.keys(metadata).forEach((key) => {
226
- const k = key;
227
- const value = metadata[k];
228
- if (value && typeof value === "string") {
229
- metadata[k] = value.trim();
230
- }
231
- if (k === "bio") {
232
- metadata[k] = metadata[k]?.slice(0, bioMaxLength);
233
- }
234
- if (k === "timezone") {
235
- metadata[k] = value || currentTimezone;
236
- }
237
- if (k === "phone" && value && typeof value === "object") {
238
- const phoneInput = value;
239
- const dialCode = getDialCodeByCountry(phoneInput.country);
240
- const phoneWithoutCode = phoneInput.phoneNumber?.replace(new RegExp(`^\\+${dialCode}`), "") || "";
241
- const hasActualPhoneNumber = phoneWithoutCode?.trim().length > 0;
242
- metadata[k] = {
243
- country: phoneInput.country,
244
- ...hasActualPhoneNumber ? { phoneNumber: phoneInput.phoneNumber } : {}
152
+ h(i, "links");
153
+ }, ro = () => {
154
+ if (Object.keys(l).forEach((i) => {
155
+ var d, v;
156
+ const t = i, e = l[t];
157
+ if (e && typeof e == "string" && (l[t] = e.trim()), t === "bio" && (l[t] = (d = l[t]) == null ? void 0 : d.slice(0, K)), t === "timezone" && (l[t] = e || R), t === "phone" && e && typeof e == "object") {
158
+ const w = e, co = ko(w.country), j = ((v = w.phoneNumber) == null ? void 0 : v.replace(new RegExp(`^\\+${co}`), "")) || "", po = (j == null ? void 0 : j.trim().length) > 0;
159
+ l[t] = {
160
+ country: w.country,
161
+ ...po ? { phoneNumber: w.phoneNumber } : {}
245
162
  };
246
163
  }
247
- });
248
- if (address.postalCode && !isPostalCode(address.postalCode, "any")) {
249
- addressValidateMsg.postalCode = t("profile.address.invalidPostalCode");
250
- }
251
- if ([validateMsg, addressValidateMsg].some((o) => Object.values(o).some((e) => e))) {
164
+ }), r.postalCode && !q(r.postalCode, "any") && (s.postalCode = c("profile.address.invalidPostalCode")), [p, s].some((i) => Object.values(i).some((t) => t)))
252
165
  return;
253
- }
254
- const newAddress = omit(address, "detailedAddress");
255
- if (!newAddress.country) {
256
- newAddress.country = defaultCountry;
257
- }
258
- onSave({ metadata, address: newAddress });
259
- setEditable(false);
260
- setVisible(false);
261
- };
262
- const renderEdit = (editing, mode = "self") => {
263
- return /* @__PURE__ */ jsxs(
264
- MetadataInfo,
166
+ const n = Eo(r, "detailedAddress");
167
+ n.country || (n.country = y), V({ metadata: l, address: n }), B(!1), C(!1);
168
+ }, M = (n, i = "self") => {
169
+ var t;
170
+ return /* @__PURE__ */ x(
171
+ Go,
265
172
  {
266
173
  pt: 2,
267
174
  display: "flex",
268
175
  flexDirection: "column",
269
176
  justifyContent: "space-between",
270
177
  alignItems: "flex-start",
271
- gap: !isMobile ? "16px" : "4px",
178
+ gap: b ? "4px" : "16px",
272
179
  children: [
273
- /* @__PURE__ */ jsx(
274
- EditableField,
180
+ /* @__PURE__ */ a(
181
+ g,
275
182
  {
276
- value: metadata.bio ?? "",
277
- onChange: (value) => onChange(value, "bio"),
278
- editable: editing,
183
+ value: l.bio ?? "",
184
+ onChange: (e) => h(e, "bio"),
185
+ editable: n,
279
186
  placeholder: "Bio",
280
187
  component: "textarea",
281
- inline: false,
188
+ inline: !1,
282
189
  rows: 3,
283
- label: t("profile.bio"),
284
- maxLength: bioMaxLength,
190
+ label: c("profile.bio"),
191
+ maxLength: K,
285
192
  style: {
286
- ...editing ? { marginBottom: 8 } : {}
193
+ ...n ? { marginBottom: 8 } : {}
287
194
  }
288
195
  }
289
196
  ),
290
- !editing && isMyself ? /* @__PURE__ */ jsx(
291
- Button,
197
+ !n && m ? /* @__PURE__ */ a(
198
+ O,
292
199
  {
293
- size: isMobile ? "small" : "large",
200
+ size: b ? "small" : "large",
294
201
  variant: "outlined",
295
202
  sx: {
296
- ...defaultButtonStyle,
297
- mb: !isMobile ? 2 : "4px",
298
- mt: !isMobile ? 2 : "4px",
299
- height: !isMobile ? "40px" : "32px"
203
+ ...J,
204
+ mb: b ? "4px" : 2,
205
+ mt: b ? "4px" : 2,
206
+ height: b ? "32px" : "40px"
300
207
  },
301
- onClick: onEdit,
302
- fullWidth: true,
303
- children: t("profile.editProfile")
208
+ onClick: T,
209
+ fullWidth: !0,
210
+ children: c("profile.editProfile")
304
211
  }
305
212
  ) : null,
306
- editing && isMyself && isSupportAddress ? /* @__PURE__ */ jsx(
307
- AddressEditor,
213
+ n && m && to ? /* @__PURE__ */ a(
214
+ Wo,
308
215
  {
309
- address,
310
- errors: addressValidateMsg,
311
- handleChange: onAddressChange,
312
- defaultCountry
216
+ address: r,
217
+ errors: s,
218
+ handleChange: io,
219
+ defaultCountry: y
313
220
  }
314
- ) : /* @__PURE__ */ jsx(
315
- EditableField,
221
+ ) : /* @__PURE__ */ a(
222
+ g,
316
223
  {
317
- value: metadata.location ?? user?.address?.city ?? "",
318
- onChange: (value) => onChange(value, "location"),
319
- editable: editing,
224
+ value: l.location ?? ((t = o == null ? void 0 : o.address) == null ? void 0 : t.city) ?? "",
225
+ onChange: (e) => h(e, "location"),
226
+ editable: n,
320
227
  placeholder: "Location",
321
- label: t("profile.location"),
322
- tooltip: isMyself && (address.line1 || address.line2) ? /* @__PURE__ */ jsx(Fragment, { children: ["line1", "line2"].map((k) => {
323
- const value = address[k];
324
- if (!value) {
325
- return null;
326
- }
327
- return /* @__PURE__ */ jsxs(Box, { children: [
328
- /* @__PURE__ */ jsx(Typography, { variant: "caption", component: "p", fontWeight: 600, sx: { mb: 0 }, children: t(`profile.address.${k}`) }),
329
- /* @__PURE__ */ jsx(Typography, { variant: "caption", component: "span", children: address[k] })
330
- ] }, k);
331
- }) }) : null,
228
+ label: c("profile.location"),
229
+ tooltip: m && (r.line1 || r.line2) ? /* @__PURE__ */ a(A, { children: ["line1", "line2"].map((e) => r[e] ? /* @__PURE__ */ x(f, { children: [
230
+ /* @__PURE__ */ a(
231
+ S,
232
+ {
233
+ variant: "caption",
234
+ component: "p",
235
+ sx: {
236
+ fontWeight: 600,
237
+ mb: 0
238
+ },
239
+ children: c(`profile.address.${e}`)
240
+ }
241
+ ),
242
+ /* @__PURE__ */ a(S, { variant: "caption", component: "span", children: r[e] })
243
+ ] }, e) : null) }) : null,
332
244
  renderValue: () => {
333
- const countryName = address?.country ? getCountryNameByCountry(address?.country) : "";
334
- const fullLocation = [countryName, address.province, address.city || metadata.location || ""].filter(Boolean).join(" ");
335
- return /* @__PURE__ */ jsx(Typography, { component: "span", children: fullLocation });
245
+ const d = [r != null && r.country ? vo(r == null ? void 0 : r.country) : "", r.province, r.city || l.location || ""].filter(Boolean).join(" ");
246
+ return /* @__PURE__ */ a(S, { component: "span", children: d });
336
247
  },
337
- icon: /* @__PURE__ */ jsx(LocationIcon, { ...iconSize })
248
+ icon: /* @__PURE__ */ a(To, { ...z })
338
249
  }
339
250
  ),
340
- /* @__PURE__ */ jsx(
341
- EditableField,
251
+ /* @__PURE__ */ a(
252
+ g,
342
253
  {
343
- value: metadata.timezone || currentTimezone,
344
- onChange: (value) => onChange(value, "timezone"),
345
- editable: editing,
254
+ value: l.timezone || R,
255
+ onChange: (e) => h(e, "timezone"),
256
+ editable: n,
346
257
  placeholder: "timezone",
347
- icon: /* @__PURE__ */ jsx(TimezoneIcon, { ...iconSize }),
348
- label: t("profile.timezone"),
349
- renderValue: (value) => {
350
- return /* @__PURE__ */ jsx(Clock, { value });
351
- },
352
- children: /* @__PURE__ */ jsx(
353
- TimezoneSelect,
258
+ icon: /* @__PURE__ */ a(Fo, { ...z }),
259
+ label: c("profile.timezone"),
260
+ renderValue: (e) => /* @__PURE__ */ a(No, { value: e }),
261
+ children: /* @__PURE__ */ a(
262
+ Do,
354
263
  {
355
- value: metadata.timezone || currentTimezone,
356
- onChange: (value) => onChange(value, "timezone"),
357
- disabled: !editing,
358
- mode
264
+ value: l.timezone || R,
265
+ onChange: (e) => h(e, "timezone"),
266
+ disabled: !n,
267
+ mode: i
359
268
  }
360
269
  )
361
270
  }
362
271
  ),
363
- /* @__PURE__ */ jsx(
364
- EditableField,
272
+ /* @__PURE__ */ a(
273
+ g,
365
274
  {
366
- value: metadata.email ?? user?.email ?? "",
367
- editable: editing,
368
- hidePreview: !isMyself,
369
- disabled: user?.sourceProvider === LOGIN_PROVIDER.EMAIL,
370
- canEdit: !emailVerified,
371
- verified: emailVerified,
275
+ value: l.email ?? (o == null ? void 0 : o.email) ?? "",
276
+ editable: n,
277
+ hidePreview: !m,
278
+ disabled: (o == null ? void 0 : o.sourceProvider) === _.EMAIL,
279
+ canEdit: !W,
280
+ verified: W,
372
281
  placeholder: "Email",
373
- icon: /* @__PURE__ */ jsx(EmailIcon, { ...iconSize }),
374
- label: /* @__PURE__ */ jsxs(Fragment, { children: [
375
- t("profile.email"),
376
- user?.sourceProvider === LOGIN_PROVIDER.EMAIL ? /* @__PURE__ */ jsx(Tooltip, { title: t("profile.emailSourceProviderNotAllowEdit"), children: /* @__PURE__ */ jsx(
377
- Box,
282
+ icon: /* @__PURE__ */ a(Mo, { ...z }),
283
+ label: /* @__PURE__ */ x(A, { children: [
284
+ c("profile.email"),
285
+ (o == null ? void 0 : o.sourceProvider) === _.EMAIL ? /* @__PURE__ */ a(go, { title: c("profile.emailSourceProviderNotAllowEdit"), children: /* @__PURE__ */ a(
286
+ f,
378
287
  {
379
- component: Icon,
288
+ component: yo,
380
289
  icon: "mdi:info-outline",
381
290
  sx: {
382
291
  verticalAlign: "middle",
@@ -385,45 +294,40 @@ export default function UserMetadataComponent({
385
294
  }
386
295
  ) }) : null
387
296
  ] }),
388
- onChange: (value) => onChange(value, "email"),
389
- errorMsg: validateMsg.email,
390
- renderValue: (value) => isMyself ? /* @__PURE__ */ jsx(
297
+ onChange: (e) => h(e, "email"),
298
+ errorMsg: p.email,
299
+ renderValue: (e) => m ? /* @__PURE__ */ a(
391
300
  "a",
392
301
  {
393
- href: `mailto:${value}`,
302
+ href: `mailto:${e}`,
394
303
  style: {
395
304
  color: "inherit",
396
305
  textDecoration: "none"
397
306
  },
398
- children: value
307
+ children: e
399
308
  }
400
309
  ) : null,
401
- onValueValidate: (value) => {
402
- let msg = "";
403
- if (!!value && !isEmail(value)) {
404
- msg = t("profile.emailInvalid");
405
- }
406
- validateMsg.email = msg;
310
+ onValueValidate: (e) => {
311
+ let d = "";
312
+ e && !Vo(e) && (d = c("profile.emailInvalid")), p.email = d;
407
313
  }
408
314
  }
409
315
  ),
410
- /* @__PURE__ */ jsx(
411
- EditableField,
316
+ /* @__PURE__ */ a(
317
+ g,
412
318
  {
413
- value: phoneValue.phone,
414
- editable: editing,
415
- hidePreview: !isMyself,
416
- canEdit: !phoneVerified,
417
- verified: phoneVerified,
319
+ value: N.phone,
320
+ editable: n,
321
+ hidePreview: !m,
322
+ canEdit: !D,
323
+ verified: D,
418
324
  placeholder: "Phone",
419
- icon: /* @__PURE__ */ jsx(PhoneIcon, { ...iconSize }),
420
- onChange: (value) => onChange(value, "phone"),
421
- label: t("profile.phone"),
422
- renderValue: () => {
423
- return isMyself ? /* @__PURE__ */ jsx(PhoneInput, { value: phoneValue, preview: true }) : null;
424
- },
425
- children: /* @__PURE__ */ jsx(
426
- PhoneInput,
325
+ icon: /* @__PURE__ */ a($o, { ...z }),
326
+ onChange: (e) => h(e, "phone"),
327
+ label: c("profile.phone"),
328
+ renderValue: () => m ? /* @__PURE__ */ a(U, { value: N, preview: !0 }) : null,
329
+ children: /* @__PURE__ */ a(
330
+ U,
427
331
  {
428
332
  variant: "outlined",
429
333
  className: "editable-field",
@@ -431,21 +335,15 @@ export default function UserMetadataComponent({
431
335
  sx: { backgroundColor: "transparent" },
432
336
  placeholder: "Phone"
433
337
  },
434
- value: phoneValue,
435
- error: !!validateMsg.phone,
436
- helperText: validateMsg.phone,
437
- sx: mergeSx(inputFieldStyle, !validateMsg.phone ? commonInputStyle : {}),
438
- onChange: (value) => {
439
- const isValid = validatePhoneNumber(value.phone, value.country);
440
- if (!isValid) {
441
- validateMsg.phone = t("profile.phoneInvalid");
442
- } else {
443
- validateMsg.phone = "";
444
- }
445
- onChange(
338
+ value: N,
339
+ error: !!p.phone,
340
+ helperText: p.phone,
341
+ sx: Io(Ao, p.phone ? {} : So),
342
+ onChange: (e) => {
343
+ wo(e.phone, e.country) ? p.phone = "" : p.phone = c("profile.phoneInvalid"), h(
446
344
  {
447
- country: value.country,
448
- phoneNumber: value.phone
345
+ country: e.country,
346
+ phoneNumber: e.phone
449
347
  },
450
348
  "phone"
451
349
  );
@@ -454,43 +352,45 @@ export default function UserMetadataComponent({
454
352
  )
455
353
  }
456
354
  ),
457
- /* @__PURE__ */ jsx(LinkPreviewInput, { editable: editing, links, onChange: handleLinksChange }),
458
- editing && isMyself ? /* @__PURE__ */ jsxs(
459
- Box,
355
+ /* @__PURE__ */ a(Oo, { editable: n, links: ao, onChange: lo }),
356
+ n && m ? /* @__PURE__ */ x(
357
+ f,
460
358
  {
461
- display: "flex",
462
- gap: 1,
463
359
  style: { width: "100%" },
464
- justifyContent: "flex-end",
465
- flexDirection: mode === "drawer" ? "column" : "row",
360
+ sx: {
361
+ display: "flex",
362
+ gap: 1,
363
+ justifyContent: "flex-end",
364
+ flexDirection: i === "drawer" ? "column" : "row"
365
+ },
466
366
  children: [
467
- /* @__PURE__ */ jsx(
468
- Button,
367
+ /* @__PURE__ */ a(
368
+ O,
469
369
  {
470
- fullWidth: mode === "drawer",
370
+ fullWidth: i === "drawer",
471
371
  size: "small",
472
372
  variant: "outlined",
473
- sx: { ...defaultButtonStyle, minWidth: "54px" },
474
- onClick: onCancel,
475
- children: t("common.cancel")
373
+ sx: { ...J, minWidth: "54px" },
374
+ onClick: F,
375
+ children: c("common.cancel")
476
376
  }
477
377
  ),
478
- /* @__PURE__ */ jsx(
479
- Button,
378
+ /* @__PURE__ */ a(
379
+ O,
480
380
  {
481
- fullWidth: mode === "drawer",
381
+ fullWidth: i === "drawer",
482
382
  size: "small",
483
- disabled: !!validateMsg.email || !!validateMsg.phone,
383
+ disabled: !!p.email || !!p.phone,
484
384
  variant: "outlined",
485
385
  sx: {
486
- ...primaryButtonStyle,
386
+ ...Ro,
487
387
  minWidth: "54px",
488
388
  "&.Mui-disabled": {
489
389
  backgroundColor: "rgba(0, 0, 0, 0.12)"
490
390
  }
491
391
  },
492
- onClick: handleSave,
493
- children: t("common.save")
392
+ onClick: ro,
393
+ children: c("common.save")
494
394
  }
495
395
  )
496
396
  ]
@@ -500,43 +400,45 @@ export default function UserMetadataComponent({
500
400
  }
501
401
  );
502
402
  };
503
- return /* @__PURE__ */ jsxs(Fragment, { children: [
504
- renderEdit(editable),
505
- isMobileView && /* @__PURE__ */ jsxs(
506
- SwipeableDrawer,
403
+ return /* @__PURE__ */ x(A, { children: [
404
+ M(Z),
405
+ u && /* @__PURE__ */ x(
406
+ uo,
507
407
  {
508
408
  sx: {
509
409
  zIndex: 9999
510
410
  },
511
- disableSwipeToOpen: true,
512
- onOpen: onEdit,
513
- open: visible,
411
+ disableSwipeToOpen: !0,
412
+ onOpen: T,
413
+ open: oo,
514
414
  anchor: "bottom",
515
- onClose: onCancel,
415
+ onClose: F,
516
416
  slots: {
517
- backdrop: BackdropWrap
417
+ backdrop: X
518
418
  },
519
- PaperProps: {
520
- sx: {
521
- boxShadow: "0px -2px 16px 0px rgba(0, 0, 0, 0.08)",
522
- borderRadius: 1.5,
523
- // 保持跟 DID Wallet 一致
524
- borderBottomLeftRadius: 0,
525
- borderBottomRightRadius: 0
419
+ slotProps: {
420
+ paper: {
421
+ sx: {
422
+ boxShadow: "0px -2px 16px 0px rgba(0, 0, 0, 0.08)",
423
+ borderRadius: 1.5,
424
+ // 保持跟 DID Wallet 一致
425
+ borderBottomLeftRadius: 0,
426
+ borderBottomRightRadius: 0
427
+ }
526
428
  }
527
429
  },
528
430
  children: [
529
- /* @__PURE__ */ jsx(
530
- Box,
431
+ /* @__PURE__ */ a(
432
+ f,
531
433
  {
532
- ref: drawerDragger,
434
+ ref: eo,
533
435
  sx: {
534
436
  padding: "16px 32px",
535
437
  margin: "-8px auto -16px",
536
438
  zIndex: 1
537
439
  },
538
- children: /* @__PURE__ */ jsx(
539
- Box,
440
+ children: /* @__PURE__ */ a(
441
+ f,
540
442
  {
541
443
  sx: {
542
444
  width: "48px",
@@ -548,15 +450,15 @@ export default function UserMetadataComponent({
548
450
  )
549
451
  }
550
452
  ),
551
- /* @__PURE__ */ jsx(
552
- Box,
453
+ /* @__PURE__ */ a(
454
+ f,
553
455
  {
554
- p: 2,
555
456
  sx: {
457
+ p: 2,
556
458
  maxHeight: "500px",
557
459
  overflowY: "auto"
558
460
  },
559
- children: renderEdit(true, "drawer")
461
+ children: M(!0, "drawer")
560
462
  }
561
463
  )
562
464
  ]
@@ -564,7 +466,7 @@ export default function UserMetadataComponent({
564
466
  )
565
467
  ] });
566
468
  }
567
- const MetadataInfo = styled(Box)`
469
+ const Go = Co(f)`
568
470
  width: 100%;
569
471
 
570
472
  .MuiOutlinedInput-root {
@@ -602,3 +504,6 @@ const MetadataInfo = styled(Box)`
602
504
  }
603
505
  }
604
506
  `;
507
+ export {
508
+ se as default
509
+ };