@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,142 +1,129 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { Alert, Box, CircularProgress, Stack, Typography } from "@mui/material";
3
- import { useCreation, useMemoizedFn, useReactive, useRequest } from "ahooks";
4
- import { Icon } from "@iconify/react";
5
- import AddRoundedIcon from "@iconify-icons/material-symbols/add-rounded";
6
- import Switch from "@arcblock/ux/lib/Switch";
7
- import Button from "@arcblock/ux/lib/Button";
8
- import Toast from "@arcblock/ux/lib/Toast";
9
- import { getWalletDid } from "@arcblock/ux/lib/SessionUser/libs/utils";
10
- import { translate } from "@arcblock/ux/lib/Locale/util";
11
- import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
12
- import DID from "@arcblock/ux/lib/DID";
13
- import { translations } from "../libs/locales.js";
14
- import WebhookItem from "./webhook-item.js";
15
- import { formatAxiosError } from "../libs/utils.js";
16
- import { client } from "../../libs/client.js";
17
- function NotificationItem({
18
- title,
19
- description,
20
- value,
21
- onChange,
22
- isMobile
1
+ import { jsx as r, jsxs as h } from "react/jsx-runtime";
2
+ import { Alert as T, Box as w, CircularProgress as j, Typography as S, Stack as F } from "@mui/material";
3
+ import { useMemoizedFn as c, useReactive as B, useRequest as E, useCreation as C } from "ahooks";
4
+ import { Icon as G } from "@iconify/react";
5
+ import L from "@iconify-icons/material-symbols/add-rounded";
6
+ import M from "@arcblock/ux/lib/Switch";
7
+ import P from "@arcblock/ux/lib/Button";
8
+ import f from "@arcblock/ux/lib/Toast";
9
+ import { getWalletDid as A } from "@arcblock/ux/lib/SessionUser/libs/utils";
10
+ import { translate as U } from "@arcblock/ux/lib/Locale/util";
11
+ import { useLocaleContext as _ } from "@arcblock/ux/lib/Locale/context";
12
+ import $ from "@arcblock/ux/lib/DID";
13
+ import { translations as q } from "../libs/locales.js";
14
+ import D from "./webhook-item.js";
15
+ import { formatAxiosError as I } from "../libs/utils.js";
16
+ import { client as y } from "../../libs/client.js";
17
+ function g({
18
+ title: a,
19
+ description: s,
20
+ value: m,
21
+ onChange: i,
22
+ isMobile: n
23
23
  }) {
24
- const handleClick = useMemoizedFn((event) => {
25
- event.stopPropagation();
24
+ const t = c((l) => {
25
+ l.stopPropagation();
26
26
  });
27
- return /* @__PURE__ */ jsxs(Box, { display: "flex", alignItems: "center", gap: 1, children: [
28
- /* @__PURE__ */ jsx(Switch, { checked: value, size: "small", onChange }),
29
- /* @__PURE__ */ jsxs(
30
- Typography,
31
- {
32
- color: "text.primary",
33
- sx: {
34
- fontSize: 14,
35
- display: "flex",
36
- flexWrap: isMobile ? "wrap" : "nowrap",
37
- columnGap: 1,
38
- flex: 1,
39
- whiteSpace: isMobile ? "normal" : "nowrap"
40
- },
41
- onClick: handleClick,
42
- children: [
43
- title,
44
- description
45
- ]
46
- }
47
- )
48
- ] });
27
+ return /* @__PURE__ */ h(
28
+ w,
29
+ {
30
+ sx: {
31
+ display: "flex",
32
+ alignItems: "center",
33
+ gap: 1
34
+ },
35
+ children: [
36
+ /* @__PURE__ */ r(M, { checked: m, size: "small", onChange: i }),
37
+ /* @__PURE__ */ h(
38
+ S,
39
+ {
40
+ onClick: t,
41
+ sx: {
42
+ color: "text.primary",
43
+ fontSize: 14,
44
+ display: "flex",
45
+ flexWrap: n ? "wrap" : "nowrap",
46
+ columnGap: 1,
47
+ flex: 1,
48
+ whiteSpace: n ? "normal" : "nowrap"
49
+ },
50
+ children: [
51
+ a,
52
+ s
53
+ ]
54
+ }
55
+ )
56
+ ]
57
+ }
58
+ );
49
59
  }
50
- export default function Notification({ user, isMobile }) {
51
- const { locale } = useLocaleContext();
52
- const t = useMemoizedFn((key, data = {}) => {
53
- return translate(translations, key, locale, "en", data);
54
- });
55
- const currentState = useReactive({
56
- showAdd: false
57
- });
58
- const notificationConfigState = useRequest(
59
- async () => {
60
- const data = await client.user.getUserNotificationConfig();
61
- return data;
62
- },
60
+ function ne({ user: a, isMobile: s }) {
61
+ var b, v;
62
+ const { locale: m } = _(), i = c((e, o = {}) => U(q, e, m, "en", o)), n = B({
63
+ showAdd: !1
64
+ }), t = E(
65
+ async () => await y.user.getUserNotificationConfig(),
63
66
  {
64
- refreshDeps: [user],
67
+ refreshDeps: [a],
65
68
  loadingDelay: 300
66
69
  }
67
- );
68
- const notifications = useCreation(() => {
70
+ ), l = C(() => {
71
+ var e;
69
72
  return {
70
- wallet: true,
71
- email: true,
72
- phone: false,
73
- push: true,
74
- ...notificationConfigState?.data?.notifications || {}
73
+ wallet: !0,
74
+ email: !0,
75
+ phone: !1,
76
+ push: !0,
77
+ ...((e = t == null ? void 0 : t.data) == null ? void 0 : e.notifications) || {}
75
78
  };
76
- }, [notificationConfigState?.data?.notifications]);
77
- const webhooks = useCreation(() => {
78
- return notificationConfigState?.data?.webhooks || [];
79
- }, [notificationConfigState?.data?.webhooks]);
80
- const onSaveChanges = useMemoizedFn(async (values) => {
79
+ }, [(b = t == null ? void 0 : t.data) == null ? void 0 : b.notifications]), p = C(() => {
80
+ var e;
81
+ return ((e = t == null ? void 0 : t.data) == null ? void 0 : e.webhooks) || [];
82
+ }, [(v = t == null ? void 0 : t.data) == null ? void 0 : v.webhooks]), u = c(async (e) => {
81
83
  try {
82
- await client.user.saveUserNotificationConfig(values);
83
- Toast.success(t("saveSuccess"));
84
- notificationConfigState.run();
85
- } catch (err) {
86
- Toast.error(formatAxiosError(err));
84
+ await y.user.saveUserNotificationConfig(e), f.success(i("saveSuccess")), t.run();
85
+ } catch (o) {
86
+ f.error(I(o));
87
87
  }
88
- });
89
- const handleChangeSwitch = useMemoizedFn(async (channel, value) => {
90
- await onSaveChanges({
88
+ }), x = c(async (e, o) => {
89
+ await u({
91
90
  notifications: {
92
- [channel]: value
91
+ [e]: o
93
92
  }
94
93
  });
95
- });
96
- const handleTestWebhook = async (data) => {
94
+ }), k = async (e) => {
97
95
  try {
98
- await client.user.testNotificationWebhook(data);
99
- Toast.success(t("webhookTested"));
100
- } catch (err) {
101
- Toast.error(formatAxiosError(err));
96
+ await y.user.testNotificationWebhook(e), f.success(i("webhookTested"));
97
+ } catch (o) {
98
+ f.error(I(o));
102
99
  }
103
- };
104
- const handleDeleteWebhook = useMemoizedFn(async (index) => {
105
- await onSaveChanges({
106
- webhooks: webhooks.filter((_, i) => i !== index)
100
+ }, W = c(async (e) => {
101
+ await u({
102
+ webhooks: p.filter((o, d) => d !== e)
107
103
  });
108
- });
109
- const handleEditWebhook = useMemoizedFn(async (index, webhook) => {
110
- await onSaveChanges({
111
- webhooks: webhooks.map((item, i) => i === index ? webhook : item)
112
- });
113
- });
114
- const handleAddWebhook = useMemoizedFn(async (webhook) => {
115
- await onSaveChanges({
116
- webhooks: [...webhooks, webhook]
104
+ }), N = c(async (e, o) => {
105
+ await u({
106
+ webhooks: p.map((d, R) => R === e ? o : d)
117
107
  });
118
- currentState.showAdd = false;
108
+ }), z = c(async (e) => {
109
+ await u({
110
+ webhooks: [...p, e]
111
+ }), n.showAdd = !1;
119
112
  });
120
- if (notificationConfigState.error) {
121
- return /* @__PURE__ */ jsx(Alert, { severity: "error", children: notificationConfigState.error.message });
122
- }
123
- if (notificationConfigState.loading || !notificationConfigState.data) {
124
- return /* @__PURE__ */ jsx(
125
- Box,
126
- {
127
- sx: {
128
- display: "flex",
129
- justifyContent: "center",
130
- alignItems: "center",
131
- height: "100px"
132
- },
133
- children: /* @__PURE__ */ jsx(CircularProgress, {})
134
- }
135
- );
136
- }
137
- return /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", flexDirection: "column", gap: 2 }, children: [
138
- /* @__PURE__ */ jsxs(
139
- Box,
113
+ return t.error ? /* @__PURE__ */ r(T, { severity: "error", children: t.error.message }) : t.loading || !t.data ? /* @__PURE__ */ r(
114
+ w,
115
+ {
116
+ sx: {
117
+ display: "flex",
118
+ justifyContent: "center",
119
+ alignItems: "center",
120
+ height: "100px"
121
+ },
122
+ children: /* @__PURE__ */ r(j, {})
123
+ }
124
+ ) : /* @__PURE__ */ h(w, { sx: { display: "flex", flexDirection: "column", gap: 2 }, children: [
125
+ /* @__PURE__ */ h(
126
+ w,
140
127
  {
141
128
  sx: {
142
129
  display: "flex",
@@ -171,96 +158,120 @@ export default function Notification({ user, isMobile }) {
171
158
  }
172
159
  },
173
160
  children: [
174
- /* @__PURE__ */ jsx(
175
- NotificationItem,
161
+ /* @__PURE__ */ r(
162
+ g,
176
163
  {
177
- value: notifications.wallet,
178
- isMobile,
179
- title: t("walletNotification"),
180
- onChange: (event) => handleChangeSwitch("wallet", event.target.checked),
181
- description: getWalletDid(user) && /* @__PURE__ */ jsx(
182
- DID,
164
+ value: l.wallet,
165
+ isMobile: s,
166
+ title: i("walletNotification"),
167
+ onChange: (e) => x("wallet", e.target.checked),
168
+ description: A(a) && /* @__PURE__ */ r(
169
+ $,
183
170
  {
184
- did: getWalletDid(user),
185
- showQrcode: false,
186
- showAvatar: !isMobile,
187
- copyable: true,
188
- compact: true,
189
- responsive: true,
190
- locale,
191
- startChars: isMobile ? 2 : 6
171
+ did: A(a),
172
+ showQrcode: !1,
173
+ showAvatar: !s,
174
+ copyable: !0,
175
+ compact: !0,
176
+ responsive: !0,
177
+ locale: m,
178
+ startChars: s ? 2 : 6
192
179
  }
193
180
  )
194
181
  }
195
182
  ),
196
- /* @__PURE__ */ jsx(
197
- NotificationItem,
183
+ /* @__PURE__ */ r(
184
+ g,
198
185
  {
199
- value: notifications.email,
200
- isMobile,
201
- onChange: (event) => handleChangeSwitch("email", event.target.checked),
202
- title: t("emailNotification"),
203
- description: user?.email && /* @__PURE__ */ jsx(Typography, { component: "span", color: "text.secondary", fontSize: 13, children: user?.email })
186
+ value: l.email,
187
+ isMobile: s,
188
+ onChange: (e) => x("email", e.target.checked),
189
+ title: i("emailNotification"),
190
+ description: (a == null ? void 0 : a.email) && /* @__PURE__ */ r(
191
+ S,
192
+ {
193
+ component: "span",
194
+ sx: {
195
+ color: "text.secondary",
196
+ fontSize: 13
197
+ },
198
+ children: a == null ? void 0 : a.email
199
+ }
200
+ )
204
201
  }
205
202
  ),
206
- /* @__PURE__ */ jsx(
207
- NotificationItem,
203
+ /* @__PURE__ */ r(
204
+ g,
208
205
  {
209
- isMobile,
210
- value: notifications.push,
211
- title: t("pushNotification"),
212
- onChange: (event) => handleChangeSwitch("push", event.target.checked)
206
+ isMobile: s,
207
+ value: l.push,
208
+ title: i("pushNotification"),
209
+ onChange: (e) => x("push", e.target.checked)
213
210
  }
214
211
  )
215
212
  ]
216
213
  }
217
214
  ),
218
- /* @__PURE__ */ jsxs(Stack, { spacing: 1.5, useFlexGap: true, direction: "column", alignItems: "start", children: [
219
- webhooks.map((item, index) => /* @__PURE__ */ jsx(
220
- WebhookItem,
221
- {
222
- onTest: handleTestWebhook,
223
- onDelete: () => handleDeleteWebhook(index),
224
- onSave: (...args) => handleEditWebhook(index, ...args),
225
- type: item.type,
226
- url: item.url,
227
- edit: false
228
- },
229
- `${index}_${item.url}`
230
- )),
231
- currentState.showAdd && /* @__PURE__ */ jsx(
232
- WebhookItem,
233
- {
234
- onTest: handleTestWebhook,
235
- onCancel: () => {
236
- currentState.showAdd = false;
237
- },
238
- onSave: (...args) => handleAddWebhook(...args),
239
- edit: true
215
+ /* @__PURE__ */ h(
216
+ F,
217
+ {
218
+ spacing: 1.5,
219
+ useFlexGap: !0,
220
+ direction: "column",
221
+ sx: {
222
+ alignItems: "start"
240
223
  },
241
- "add"
242
- ),
243
- /* @__PURE__ */ jsx(
244
- Button,
245
- {
246
- variant: "outlined",
247
- size: "small",
248
- sx: {
249
- color: "text.primary",
250
- borderColor: "divider",
251
- "&:hover": {
252
- borderColor: "divider"
224
+ children: [
225
+ p.map((e, o) => /* @__PURE__ */ r(
226
+ D,
227
+ {
228
+ onTest: k,
229
+ onDelete: () => W(o),
230
+ onSave: (...d) => N(o, ...d),
231
+ type: e.type,
232
+ url: e.url,
233
+ edit: !1
253
234
  },
254
- py: 0.5,
255
- borderRadius: 1
256
- },
257
- startIcon: /* @__PURE__ */ jsx(Icon, { icon: AddRoundedIcon }),
258
- onClick: () => {
259
- currentState.showAdd = true;
260
- },
261
- children: t("addWebhook")
262
- }
263
- )
264
- ] })
235
+ `${o}_${e.url}`
236
+ )),
237
+ n.showAdd && /* @__PURE__ */ r(
238
+ D,
239
+ {
240
+ onTest: k,
241
+ onCancel: () => {
242
+ n.showAdd = !1;
243
+ },
244
+ onSave: (...e) => z(...e),
245
+ edit: !0
246
+ },
247
+ "add"
248
+ ),
249
+ /* @__PURE__ */ r(
250
+ P,
251
+ {
252
+ variant: "outlined",
253
+ size: "small",
254
+ sx: {
255
+ color: "text.primary",
256
+ borderColor: "divider",
257
+ "&:hover": {
258
+ borderColor: "divider"
259
+ },
260
+ py: 0.5,
261
+ borderRadius: 1
262
+ },
263
+ startIcon: /* @__PURE__ */ r(G, { icon: L }),
264
+ onClick: () => {
265
+ n.showAdd = !0;
266
+ },
267
+ children: i("addWebhook")
268
+ }
269
+ )
270
+ ]
271
+ }
272
+ )
265
273
  ] });
266
274
  }
275
+ export {
276
+ ne as default
277
+ };
@@ -1,54 +1,35 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { Box } from "@mui/material";
3
- import Empty from "@arcblock/ux/lib/Empty";
4
- import { useTheme } from "@arcblock/ux/lib/Theme";
5
- import PassportItem from "@arcblock/ux/lib/Passport";
6
- import { PASSPORT_STATUS } from "@arcblock/ux/lib/Util/constant";
7
- import { useCreation, useMemoizedFn } from "ahooks";
8
- import uniqBy from "lodash/uniqBy";
9
- import { translate } from "@arcblock/ux/lib/Locale/util";
10
- import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
11
- import { translations } from "../libs/locales.js";
12
- import { createPassportSvg } from "../libs/utils.js";
13
- export default function Passport({ user, ...rest }) {
14
- const { locale } = useLocaleContext();
15
- const t = useMemoizedFn((key, data = {}) => {
16
- return translate(translations, key, locale, "en", data);
17
- });
18
- const theme = useTheme();
19
- const passports = useCreation(() => {
20
- const passportList = (user?.passports || []).map((x) => ({
21
- ...x,
22
- revoked: x.status === PASSPORT_STATUS.REVOKED
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { Box as s } from "@mui/material";
3
+ import y from "@arcblock/ux/lib/Empty";
4
+ import { useTheme as g } from "@arcblock/ux/lib/Theme";
5
+ import h from "@arcblock/ux/lib/Passport";
6
+ import { PASSPORT_STATUS as u } from "@arcblock/ux/lib/Util/constant";
7
+ import { useMemoizedFn as C, useCreation as l } from "ahooks";
8
+ import f from "lodash/uniqBy";
9
+ import { translate as P } from "@arcblock/ux/lib/Locale/util";
10
+ import { useLocaleContext as k } from "@arcblock/ux/lib/Locale/context";
11
+ import { translations as v } from "../libs/locales.js";
12
+ import { createPassportSvg as S } from "../libs/utils.js";
13
+ function D({ user: o, ...a }) {
14
+ const { locale: c } = k(), m = C((t, r = {}) => P(v, t, c, "en", r)), d = g(), e = l(() => {
15
+ const t = ((o == null ? void 0 : o.passports) || []).map((r) => ({
16
+ ...r,
17
+ revoked: r.status === u.REVOKED
23
18
  }));
24
- passportList.sort((a, b) => {
25
- if (a.revoked === b.revoked) {
26
- return 0;
27
- }
28
- if (a.revoked) {
29
- return 1;
30
- }
31
- return -1;
32
- });
33
- return uniqBy(
34
- passportList.filter((x) => !x.display),
19
+ return t.sort((r, x) => r.revoked === x.revoked ? 0 : r.revoked ? 1 : -1), f(
20
+ t.filter((r) => !r.display),
35
21
  "role"
36
22
  ).concat(
37
- uniqBy(
38
- passportList.filter((x) => x.display),
23
+ f(
24
+ t.filter((r) => r.display),
39
25
  "display.content"
40
26
  )
41
27
  );
42
- }, [user?.passports]);
43
- const currentRole = useCreation(() => passports?.find((item) => item.name === user.role), [passports, user?.role]);
44
- const activeColor = theme.palette.primary.main;
45
- if (passports.length === 0) {
46
- return /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Empty, { children: t("noPassport") }) });
47
- }
48
- return /* @__PURE__ */ jsx(
49
- Box,
28
+ }, [o == null ? void 0 : o.passports]), p = l(() => e == null ? void 0 : e.find((t) => t.name === o.role), [e, o == null ? void 0 : o.role]), n = d.palette.primary.main;
29
+ return e.length === 0 ? /* @__PURE__ */ i(s, { children: /* @__PURE__ */ i(y, { children: m("noPassport") }) }) : /* @__PURE__ */ i(
30
+ s,
50
31
  {
51
- ...rest,
32
+ ...a,
52
33
  sx: {
53
34
  display: "grid",
54
35
  justifyItems: "start",
@@ -59,16 +40,16 @@ export default function Passport({ user, ...rest }) {
59
40
  lg: "repeat(5, 1fr)"
60
41
  },
61
42
  gap: 2.5,
62
- ...rest.sx
43
+ ...a.sx
63
44
  },
64
- children: passports.map((x) => /* @__PURE__ */ jsx(
65
- PassportItem,
45
+ children: e.map((t) => /* @__PURE__ */ i(
46
+ h,
66
47
  {
67
- passport: x,
68
- user,
48
+ passport: t,
49
+ user: o,
69
50
  color: window.blocklet.passportColor,
70
- createPassportSvg,
71
- title: currentRole && currentRole.role === x.role ? t("currentPassport") : "",
51
+ createPassportSvg: S,
52
+ title: p && p.role === t.role ? m("currentPassport") : "",
72
53
  sx: {
73
54
  flexDirection: "column",
74
55
  alignItems: "center",
@@ -81,15 +62,18 @@ export default function Passport({ user, ...rest }) {
81
62
  display: "flex",
82
63
  justifyContent: "center",
83
64
  backgroundColor: "grey.50",
84
- boxShadow: currentRole && currentRole.role === x.role ? `0px 2px 4px 0px ${activeColor}, 0px 1px 2px -1px ${activeColor}, 0px 0px 0px 1px ${activeColor} !important` : "unset"
65
+ boxShadow: p && p.role === t.role ? `0px 2px 4px 0px ${n}, 0px 1px 2px -1px ${n}, 0px 0px 0px 1px ${n} !important` : "unset"
85
66
  },
86
67
  ".passport-item__body": {
87
68
  marginLeft: "0 !important"
88
69
  }
89
70
  }
90
71
  },
91
- x.id
72
+ t.id
92
73
  ))
93
74
  }
94
75
  );
95
76
  }
77
+ export {
78
+ D as default
79
+ };