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