@arcblock/ux 3.4.15 → 3.5.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 (333) hide show
  1. package/lib/package.json.js +1 -1
  2. package/package.json +10 -7
  3. package/src/ActionButton/ActionButton.stories.jsx +0 -61
  4. package/src/ActionButton/index.jsx +0 -106
  5. package/src/ActivityIndicator/ActivityIndicator.stories.jsx +0 -9
  6. package/src/ActivityIndicator/index.jsx +0 -140
  7. package/src/Address/Address.stories.jsx +0 -38
  8. package/src/Address/compact-text.jsx +0 -76
  9. package/src/Address/did-address.tsx +0 -223
  10. package/src/Address/index.tsx +0 -21
  11. package/src/Address/responsive-did-address.tsx +0 -154
  12. package/src/Alert/Alert.stories.jsx +0 -100
  13. package/src/Alert/index.jsx +0 -130
  14. package/src/AnimationWaiter/AnimationWaiter.stories.jsx +0 -35
  15. package/src/AnimationWaiter/dark-animation.json +0 -1
  16. package/src/AnimationWaiter/default-animation.json +0 -1
  17. package/src/AnimationWaiter/index.jsx +0 -296
  18. package/src/Async/index.tsx +0 -44
  19. package/src/Avatar/Avatar.stories.jsx +0 -11
  20. package/src/Avatar/did-motif.jsx +0 -38
  21. package/src/Avatar/etherscan-blockies.js +0 -81
  22. package/src/Avatar/index.jsx +0 -195
  23. package/src/Badge/Badge.stories.jsx +0 -41
  24. package/src/Badge/index.jsx +0 -101
  25. package/src/Blocklet/Blocklet.stories.jsx +0 -21
  26. package/src/Blocklet/blocklet.jsx +0 -276
  27. package/src/Blocklet/index.js +0 -5
  28. package/src/Blocklet/utils.jsx +0 -58
  29. package/src/BlockletContext/index.tsx +0 -72
  30. package/src/BlockletNFT/BlockletNFT.stories.jsx +0 -21
  31. package/src/BlockletNFT/index.jsx +0 -378
  32. package/src/BlockletV2/Blocklet.stories.jsx +0 -34
  33. package/src/BlockletV2/blocklet.tsx +0 -247
  34. package/src/BlockletV2/components/icon-text.tsx +0 -47
  35. package/src/BlockletV2/components/tooltip-icon.tsx +0 -52
  36. package/src/BlockletV2/index.ts +0 -6
  37. package/src/BlockletV2/utils.js +0 -75
  38. package/src/Button/Button.stories.jsx +0 -24
  39. package/src/Button/index.js +0 -9
  40. package/src/Button/wrap.jsx +0 -126
  41. package/src/ButtonGroup/index.js +0 -16
  42. package/src/CardSelector/index.tsx +0 -136
  43. package/src/Center/Center.stories.jsx +0 -20
  44. package/src/Center/index.tsx +0 -33
  45. package/src/ClickToCopy/ClickToCopy.stories.jsx +0 -24
  46. package/src/ClickToCopy/copy-button.tsx +0 -43
  47. package/src/ClickToCopy/hook.ts +0 -42
  48. package/src/ClickToCopy/index.tsx +0 -96
  49. package/src/CloseButton/index.tsx +0 -37
  50. package/src/CodeBlock/CodeBlock.stories.jsx +0 -22
  51. package/src/CodeBlock/LightBox.tsx +0 -87
  52. package/src/CodeBlock/index.tsx +0 -217
  53. package/src/Colors/Colors.stories.jsx +0 -211
  54. package/src/Colors/index.ts +0 -4
  55. package/src/Colors/themes/default.ts +0 -8
  56. package/src/Colors/themes/did-connect.ts +0 -64
  57. package/src/Colors/themes/temp.ts +0 -52
  58. package/src/Config/Config.stories.jsx +0 -16
  59. package/src/Config/config-provider.tsx +0 -62
  60. package/src/Config/index.ts +0 -2
  61. package/src/Config/theme-mode-toggle.tsx +0 -38
  62. package/src/ContactForm/ContactForm.stories.jsx +0 -32
  63. package/src/ContactForm/index.tsx +0 -264
  64. package/src/CookieConsent/CookieConsent.stories.jsx +0 -33
  65. package/src/CookieConsent/index.tsx +0 -104
  66. package/src/CountDown/CountDown.stories.jsx +0 -15
  67. package/src/CountDown/index.tsx +0 -170
  68. package/src/DID/DID.stories.jsx +0 -37
  69. package/src/DID/index.tsx +0 -393
  70. package/src/DIDConnect/app-icon.tsx +0 -37
  71. package/src/DIDConnect/app-info-item.tsx +0 -93
  72. package/src/DIDConnect/auth-apps/auth-apps-info.tsx +0 -77
  73. package/src/DIDConnect/auth-apps/index.tsx +0 -278
  74. package/src/DIDConnect/auth-apps/switch-role.tsx +0 -47
  75. package/src/DIDConnect/did-connect-container.tsx +0 -326
  76. package/src/DIDConnect/did-connect-footer.tsx +0 -76
  77. package/src/DIDConnect/did-connect-logo.tsx +0 -8
  78. package/src/DIDConnect/icons/did-wallet-logo.tsx +0 -18
  79. package/src/DIDConnect/icons/github-logo.tsx +0 -17
  80. package/src/DIDConnect/index.ts +0 -11
  81. package/src/DIDConnect/landing-page.tsx +0 -218
  82. package/src/DIDConnect/powered-by.tsx +0 -48
  83. package/src/DIDConnect/provider-icon.tsx +0 -62
  84. package/src/DIDConnect/request-storage-access-api-dialog.tsx +0 -304
  85. package/src/DIDConnect/with-container.tsx +0 -323
  86. package/src/DIDConnect/with-ux-theme.tsx +0 -22
  87. package/src/DIDLogo/Logo.stories.jsx +0 -11
  88. package/src/DIDLogo/index.tsx +0 -168
  89. package/src/Datatable/CustomToolbar.jsx +0 -415
  90. package/src/Datatable/Datatable.stories.jsx +0 -92
  91. package/src/Datatable/DatatableContext.jsx +0 -35
  92. package/src/Datatable/TableSearch.jsx +0 -166
  93. package/src/Datatable/index.jsx +0 -652
  94. package/src/Datatable/utils.js +0 -161
  95. package/src/Dialog/Dialog.stories.jsx +0 -21
  96. package/src/Dialog/confirm.jsx +0 -143
  97. package/src/Dialog/dialog.jsx +0 -199
  98. package/src/Dialog/index.js +0 -4
  99. package/src/Dialog/types.d.ts +0 -20
  100. package/src/Dialog/use-confirm.jsx +0 -188
  101. package/src/DriftBot/index.tsx +0 -81
  102. package/src/Earth/Earth.stories.jsx +0 -39
  103. package/src/Earth/countries.json +0 -8057
  104. package/src/Earth/index.tsx +0 -515
  105. package/src/Earth/util.ts +0 -72
  106. package/src/Empty/Empty.stories.jsx +0 -23
  107. package/src/Empty/index.jsx +0 -48
  108. package/src/ErrorBoundary/ErrorBoundary.stories.jsx +0 -13
  109. package/src/ErrorBoundary/fallback.tsx +0 -85
  110. package/src/ErrorBoundary/index.ts +0 -1
  111. package/src/Footer/Footer.stories.jsx +0 -13
  112. package/src/Footer/index.tsx +0 -130
  113. package/src/Header/Header.stories.jsx +0 -30
  114. package/src/Header/addon-button.tsx +0 -41
  115. package/src/Header/auto-hidden.tsx +0 -31
  116. package/src/Header/header-addons.tsx +0 -37
  117. package/src/Header/header.tsx +0 -214
  118. package/src/Header/index.ts +0 -3
  119. package/src/Header/responsive-header.tsx +0 -145
  120. package/src/Icon/Icon.stories.jsx +0 -45
  121. package/src/Icon/image.tsx +0 -53
  122. package/src/Icon/index.tsx +0 -63
  123. package/src/Img/Img.stories.jsx +0 -17
  124. package/src/Img/index.jsx +0 -258
  125. package/src/InfoRow/InfoRow.stories.jsx +0 -14
  126. package/src/InfoRow/index.tsx +0 -91
  127. package/src/Layout/Layout.stories.jsx +0 -24
  128. package/src/Layout/dashboard/external-link.tsx +0 -59
  129. package/src/Layout/dashboard/full-page.tsx +0 -58
  130. package/src/Layout/dashboard/index.tsx +0 -260
  131. package/src/Layout/dashboard/sidebar.tsx +0 -198
  132. package/src/Layout/dashboard-legacy/header.tsx +0 -156
  133. package/src/Layout/dashboard-legacy/index.tsx +0 -127
  134. package/src/Layout/dashboard-legacy/sidebar.tsx +0 -129
  135. package/src/Layout/index.tsx +0 -310
  136. package/src/LoadingMask/index.tsx +0 -108
  137. package/src/Locale/LocaleSelector.stories.jsx +0 -44
  138. package/src/Locale/browser-lang.ts +0 -65
  139. package/src/Locale/context.tsx +0 -162
  140. package/src/Locale/languages.ts +0 -58
  141. package/src/Locale/selector.tsx +0 -174
  142. package/src/Locale/util.ts +0 -38
  143. package/src/Logo/Logo.stories.jsx +0 -23
  144. package/src/Logo/images/logo-dark-text.svg +0 -3
  145. package/src/Logo/images/logo-dark-top.svg +0 -6
  146. package/src/Logo/images/logo-light-text.svg +0 -3
  147. package/src/Logo/images/logo-light-top.svg +0 -6
  148. package/src/Logo/index.tsx +0 -58
  149. package/src/Metric/Metric.stories.jsx +0 -29
  150. package/src/Metric/index.tsx +0 -130
  151. package/src/MuiWrap/index.tsx +0 -10
  152. package/src/NFTDisplay/NFTBroken.svg +0 -34
  153. package/src/NFTDisplay/NFTDisplay.stories.jsx +0 -30
  154. package/src/NFTDisplay/README.md +0 -59
  155. package/src/NFTDisplay/aspect-ratio-container.tsx +0 -36
  156. package/src/NFTDisplay/broken.tsx +0 -51
  157. package/src/NFTDisplay/displayApi.ts +0 -43
  158. package/src/NFTDisplay/index.tsx +0 -393
  159. package/src/NFTDisplay/loading.tsx +0 -16
  160. package/src/NFTDisplay/preview.tsx +0 -84
  161. package/src/NFTDisplay/render-svg.tsx +0 -21
  162. package/src/NFTDisplay/svg-embedder/img.tsx +0 -27
  163. package/src/NFTDisplay/svg-embedder/inline-svg.tsx +0 -36
  164. package/src/NavMenu/NavMenu.stories.jsx +0 -17
  165. package/src/NavMenu/images/OCAP.svg +0 -1
  166. package/src/NavMenu/images/abt-network.svg +0 -1
  167. package/src/NavMenu/images/ai-kit.svg +0 -1
  168. package/src/NavMenu/images/aigne-image-smith.svg +0 -1
  169. package/src/NavMenu/images/aigne.svg +0 -1
  170. package/src/NavMenu/images/aistro.png +0 -0
  171. package/src/NavMenu/images/arcsphere.svg +0 -1
  172. package/src/NavMenu/images/blocklet-framework.svg +0 -1
  173. package/src/NavMenu/images/blocklet-launcher.svg +0 -1
  174. package/src/NavMenu/images/blocklet-server.svg +0 -1
  175. package/src/NavMenu/images/blocklet-store.svg +0 -1
  176. package/src/NavMenu/images/creator-studio.svg +0 -1
  177. package/src/NavMenu/images/did-wallet.svg +0 -1
  178. package/src/NavMenu/images/did.svg +0 -1
  179. package/src/NavMenu/images/nft-studio.svg +0 -1
  180. package/src/NavMenu/images/payment-kit.png +0 -0
  181. package/src/NavMenu/images/vc.svg +0 -1
  182. package/src/NavMenu/images/web3-kit.svg +0 -1
  183. package/src/NavMenu/index.ts +0 -3
  184. package/src/NavMenu/nav-menu-context.tsx +0 -30
  185. package/src/NavMenu/nav-menu.tsx +0 -441
  186. package/src/NavMenu/products.tsx +0 -830
  187. package/src/NavMenu/style.ts +0 -258
  188. package/src/NavMenu/sub-container.tsx +0 -125
  189. package/src/NavMenu/sub-item-group.tsx +0 -42
  190. package/src/OrgTransfer/index.tsx +0 -53
  191. package/src/OrgTransfer/locales.ts +0 -25
  192. package/src/OrgTransfer/selector.tsx +0 -252
  193. package/src/OrgTransfer/type.ts +0 -31
  194. package/src/PageScroller/index.tsx +0 -316
  195. package/src/PageScroller/story/FifthComponent.jsx +0 -7
  196. package/src/PageScroller/story/FirstComponent.jsx +0 -7
  197. package/src/PageScroller/story/FourthComponent.jsx +0 -7
  198. package/src/PageScroller/story/FullPage.jsx +0 -55
  199. package/src/PageScroller/story/PageContain.jsx +0 -59
  200. package/src/PageScroller/story/PageScroller.stories.jsx +0 -18
  201. package/src/PageScroller/story/SecondComponent.jsx +0 -7
  202. package/src/PageScroller/story/ThirdComponent.jsx +0 -7
  203. package/src/PageScroller/story/index.css +0 -115
  204. package/src/PageScroller/usePrevValue.ts +0 -11
  205. package/src/Passport/index.ts +0 -3
  206. package/src/Passport/passport.tsx +0 -118
  207. package/src/PhoneInput/PhoneInput.stories.jsx +0 -12
  208. package/src/PhoneInput/country-select.tsx +0 -148
  209. package/src/PhoneInput/index.tsx +0 -269
  210. package/src/PoweredByArcBlock/index.tsx +0 -27
  211. package/src/PricingTable/PricingPlan.tsx +0 -120
  212. package/src/PricingTable/PricingTable.stories.jsx +0 -38
  213. package/src/PricingTable/index.tsx +0 -59
  214. package/src/QRCode/QRCode.stories.jsx +0 -13
  215. package/src/QRCode/index.tsx +0 -66
  216. package/src/RelativeTime/RelativeTime.stories.jsx +0 -20
  217. package/src/RelativeTime/index.tsx +0 -334
  218. package/src/Result/Result.stories.jsx +0 -61
  219. package/src/Result/common.tsx +0 -119
  220. package/src/Result/index.tsx +0 -30
  221. package/src/Result/result.tsx +0 -65
  222. package/src/Result/translations.ts +0 -57
  223. package/src/Screenshot/BaseScreenshot/index.tsx +0 -73
  224. package/src/Screenshot/BaseScreenshot/shells/Macbook.tsx +0 -38
  225. package/src/Screenshot/BaseScreenshot/shells/Phone.tsx +0 -35
  226. package/src/Screenshot/Screenshot.stories.jsx +0 -44
  227. package/src/Screenshot/devices.css +0 -1366
  228. package/src/Screenshot/index.tsx +0 -300
  229. package/src/SessionBlocklet/index.tsx +0 -178
  230. package/src/SessionManager/SessionManager.stories.jsx +0 -9
  231. package/src/SessionManager/index.tsx +0 -3
  232. package/src/SessionPermission/index.tsx +0 -26
  233. package/src/SessionUser/components/did-space.tsx +0 -68
  234. package/src/SessionUser/components/logged-in.tsx +0 -338
  235. package/src/SessionUser/components/quick-login-item.tsx +0 -132
  236. package/src/SessionUser/components/session-user-item.tsx +0 -93
  237. package/src/SessionUser/components/session-user-switch.tsx +0 -240
  238. package/src/SessionUser/components/un-login.tsx +0 -257
  239. package/src/SessionUser/components/user-info.tsx +0 -201
  240. package/src/SessionUser/index.tsx +0 -68
  241. package/src/SessionUser/libs/translation.ts +0 -30
  242. package/src/SessionUser/libs/utils.ts +0 -39
  243. package/src/SharedBridge/index.tsx +0 -126
  244. package/src/SocialShare/index.tsx +0 -194
  245. package/src/Sparkline/Sparkline.stories.jsx +0 -13
  246. package/src/Sparkline/index.tsx +0 -231
  247. package/src/Spinner/Spinner.stories.jsx +0 -98
  248. package/src/Spinner/index.tsx +0 -20
  249. package/src/SplitButton/SplitButton.stories.jsx +0 -32
  250. package/src/SplitButton/index.tsx +0 -116
  251. package/src/SplitButton/useClickAway.tsx +0 -24
  252. package/src/Success/index.tsx +0 -175
  253. package/src/Switch/Switch.stories.jsx +0 -16
  254. package/src/Switch/index.jsx +0 -79
  255. package/src/Tabs/Tabs.stories.jsx +0 -18
  256. package/src/Tabs/index.tsx +0 -255
  257. package/src/Tag/Tag.stories.jsx +0 -15
  258. package/src/Tag/index.jsx +0 -106
  259. package/src/TextCollapse/TextCollapse.stories.jsx +0 -73
  260. package/src/TextCollapse/index.tsx +0 -85
  261. package/src/Theme/Theme.stories.jsx +0 -11
  262. package/src/Theme/index.ts +0 -21
  263. package/src/Theme/theme-provider.tsx +0 -374
  264. package/src/Theme/theme.ts +0 -229
  265. package/src/Toast/Toast.stories.jsx +0 -28
  266. package/src/Toast/index.tsx +0 -80
  267. package/src/Typography/index.tsx +0 -124
  268. package/src/UserCard/Cards/avatar-only.tsx +0 -27
  269. package/src/UserCard/Cards/basic-info.tsx +0 -43
  270. package/src/UserCard/Cards/index.tsx +0 -16
  271. package/src/UserCard/Cards/social-actions.tsx +0 -196
  272. package/src/UserCard/Container/card.tsx +0 -63
  273. package/src/UserCard/Container/dialog.tsx +0 -37
  274. package/src/UserCard/Content/basic.tsx +0 -330
  275. package/src/UserCard/Content/clock.tsx +0 -82
  276. package/src/UserCard/Content/minimal.tsx +0 -113
  277. package/src/UserCard/Content/shorten-label.tsx +0 -32
  278. package/src/UserCard/Content/tooltip-avatar.tsx +0 -80
  279. package/src/UserCard/UserCard.stories.jsx +0 -19
  280. package/src/UserCard/components.tsx +0 -81
  281. package/src/UserCard/index.tsx +0 -132
  282. package/src/UserCard/types.ts +0 -165
  283. package/src/UserCard/use-follow.tsx +0 -111
  284. package/src/UserCard/utils.ts +0 -155
  285. package/src/Util/WebWalletOpener.stories.jsx +0 -5
  286. package/src/Util/client.ts +0 -4
  287. package/src/Util/constant.ts +0 -70
  288. package/src/Util/deprecate.tsx +0 -29
  289. package/src/Util/federated.ts +0 -125
  290. package/src/Util/iframe.ts +0 -19
  291. package/src/Util/index.ts +0 -760
  292. package/src/Util/logger.ts +0 -44
  293. package/src/Util/passport.ts +0 -127
  294. package/src/Util/security.ts +0 -72
  295. package/src/Util/style.ts +0 -17
  296. package/src/Util/wallet.ts +0 -35
  297. package/src/VerificationCode/index.tsx +0 -83
  298. package/src/Video/Video.stories.jsx +0 -6
  299. package/src/Video/index.tsx +0 -70
  300. package/src/Wallet/Action.stories.jsx +0 -8
  301. package/src/Wallet/Action.tsx +0 -118
  302. package/src/Wallet/Download.stories.jsx +0 -9
  303. package/src/Wallet/Download.tsx +0 -157
  304. package/src/Wallet/Open.tsx +0 -47
  305. package/src/Wallet/OpenInWallet.stories.jsx +0 -5
  306. package/src/Wallet/images/abtwallet.png +0 -0
  307. package/src/Wallet/images/android_download.svg +0 -22
  308. package/src/Wallet/images/app-store.svg +0 -30
  309. package/src/Wallet/images/google-play.svg +0 -69
  310. package/src/WalletOSIcon/index.tsx +0 -47
  311. package/src/WebWalletSWKeeper/index.tsx +0 -117
  312. package/src/WechatPrompt/images/android.png +0 -0
  313. package/src/WechatPrompt/images/ios.png +0 -0
  314. package/src/WechatPrompt/index.tsx +0 -75
  315. package/src/global.d.ts +0 -28
  316. package/src/hooks/use-blocklet-logo.tsx +0 -32
  317. package/src/hooks/use-clock.tsx +0 -62
  318. package/src/hooks/use-location-state.tsx +0 -117
  319. package/src/hooks/use-mobile.tsx +0 -6
  320. package/src/index.ts +0 -79
  321. package/src/type.d.ts +0 -44
  322. package/src/withTheme/index.tsx +0 -72
  323. package/src/withTracker/README.md +0 -37
  324. package/src/withTracker/action/bind-wallet.tsx +0 -17
  325. package/src/withTracker/action/login.tsx +0 -18
  326. package/src/withTracker/action/pay.tsx +0 -14
  327. package/src/withTracker/action/switch-passport.tsx +0 -20
  328. package/src/withTracker/constant/index.tsx +0 -3
  329. package/src/withTracker/env.tsx +0 -1
  330. package/src/withTracker/error_boundary.jsx +0 -34
  331. package/src/withTracker/index.tsx +0 -50
  332. package/src/withTracker/libs/utm.ts +0 -46
  333. package/vite.config.mjs +0 -37
@@ -1,48 +0,0 @@
1
- import { Box, useTheme } from '@mui/material';
2
- import { Icon } from '@iconify/react';
3
- import shieldCheckIcon from '@iconify-icons/mdi/shield-check';
4
-
5
- import DidConnectLogo from './did-connect-logo';
6
- import { mergeSx } from '../Util/style';
7
-
8
- export default function PoweredBy({ ...rest }) {
9
- const { palette } = useTheme();
10
-
11
- return (
12
- <Box
13
- {...rest}
14
- sx={mergeSx(
15
- {
16
- display: 'flex',
17
- alignItems: 'center',
18
- justifyContent: 'center',
19
- color: 'text.secondary',
20
- gap: 0.5,
21
- fontSize: 12,
22
- fontFamily: 'Lexend',
23
- whiteSpace: 'nowrap',
24
- },
25
- rest?.sx
26
- )}>
27
- <Icon icon={shieldCheckIcon} color={palette.success.main} />
28
- Secured by
29
- <Box
30
- component="a"
31
- href="https://www.didconnect.io/"
32
- target="_blank"
33
- rel="noopener"
34
- sx={{
35
- color: 'initial',
36
- display: 'flex',
37
- alignItems: 'center',
38
- gap: 0.5,
39
- textDecoration: 'none',
40
- '&:hover': {
41
- textDecoration: 'underline',
42
- },
43
- }}>
44
- <DidConnectLogo />
45
- </Box>
46
- </Box>
47
- );
48
- }
@@ -1,62 +0,0 @@
1
- import { memo } from 'react';
2
- import mailOutlineRoundedIcon from '@iconify-icons/material-symbols/mail-outline-rounded';
3
- import appleIcon from '@iconify-icons/logos/apple';
4
- import googleIcon from '@iconify-icons/logos/google-icon';
5
- import auth0Icon from '@iconify-icons/logos/auth0-icon';
6
- import passKeyRoundedIcon from '@iconify-icons/material-symbols/passkey-rounded';
7
- import { Icon } from '@iconify/react';
8
- import { Box, BoxProps, SxProps } from '@mui/material';
9
-
10
- import { LOGIN_PROVIDER } from '../Util/constant';
11
- import { mergeSx } from '../Util/style';
12
- import DIDWalletLogo from './icons/did-wallet-logo';
13
- import GithubLogo from './icons/github-logo';
14
-
15
- function ProviderIcon({
16
- provider = 'wallet',
17
- ...rest
18
- }: {
19
- provider?: (typeof LOGIN_PROVIDER)[keyof typeof LOGIN_PROVIDER] | 'wallet-web';
20
- } & BoxProps) {
21
- if (['wallet', 'wallet-web'].includes(provider)) {
22
- // @ts-ignore
23
- return <DIDWalletLogo {...rest} />;
24
- }
25
-
26
- if (provider === LOGIN_PROVIDER.GITHUB) {
27
- return (
28
- <Box component="span" {...rest} sx={mergeSx({ display: 'inline-block' }, rest.sx as SxProps)}>
29
- <GithubLogo width="100%" height="100%" fill="currentColor" />
30
- </Box>
31
- );
32
- }
33
-
34
- const iconMap = {
35
- [LOGIN_PROVIDER.AUTH0]: auth0Icon,
36
- [LOGIN_PROVIDER.EMAIL]: mailOutlineRoundedIcon,
37
- [LOGIN_PROVIDER.APPLE]: appleIcon,
38
- [LOGIN_PROVIDER.GOOGLE]: googleIcon,
39
- [LOGIN_PROVIDER.PASSKEY]: passKeyRoundedIcon,
40
- [LOGIN_PROVIDER.TWITTER]: {
41
- body: '<path fill="currentColor" d="M149.079 108.399L242.33 0h-22.098l-80.97 94.12L74.59 0H0l97.796 142.328L0 256h22.1l85.507-99.395L175.905 256h74.59L149.073 108.399zM118.81 143.58l-9.909-14.172l-78.84-112.773h33.943l63.625 91.011l9.909 14.173l82.705 118.3H186.3l-67.49-96.533z"/>',
42
- width: 251,
43
- height: 251,
44
- },
45
- };
46
-
47
- return iconMap[provider] ? (
48
- <Box
49
- component={Icon}
50
- icon={iconMap[provider]}
51
- fill="currentColor"
52
- {...rest}
53
- sx={mergeSx(
54
- { width: '100%', height: '100%' },
55
- provider === LOGIN_PROVIDER.TWITTER ? { scale: '0.8' } : {},
56
- rest.sx as SxProps
57
- )}
58
- />
59
- ) : null;
60
- }
61
-
62
- export default memo(ProviderIcon);
@@ -1,304 +0,0 @@
1
- import { Box, Button, Typography, Chip, List, ListItem } from '@mui/material';
2
- import { Icon } from '@iconify/react';
3
- import externalLinkIcon from '@iconify-icons/tabler/external-link';
4
- import lockOutlineIcon from '@iconify-icons/material-symbols/lock-outline';
5
- import checkCircleIcon from '@iconify-icons/material-symbols/check-circle';
6
- import rocketLaunchRoundedIcon from '@iconify-icons/material-symbols/rocket-launch-rounded';
7
- import { useMemoizedFn, useReactive } from 'ahooks';
8
- import { memo, useImperativeHandle, useRef } from 'react';
9
- import noop from 'lodash/noop';
10
-
11
- import { Locale } from '../type';
12
- import { translate } from '../Locale/util';
13
- import DIDConnectContainer from './did-connect-container';
14
- import CloseButton from '../CloseButton';
15
- import SharedBridge from '../SharedBridge';
16
- import { setVisitorId } from '../Util';
17
-
18
- type StorageAccessState = 'prompt' | 'granted' | 'denied';
19
-
20
- const translations: Record<
21
- Locale,
22
- {
23
- allow: string;
24
- dataUsage: string;
25
- title: string;
26
- clickAllow: ({ allowButton }: { allowButton: React.ReactNode }) => React.ReactNode;
27
- reason: ({ site }: { site: React.ReactNode }) => React.ReactNode;
28
- afterAllow: {
29
- title: string;
30
- list1: string;
31
- list2: string;
32
- };
33
- }
34
- > = {
35
- en: {
36
- allow: 'Allow',
37
- dataUsage:
38
- 'Your data is only used for identity authentication, and will not be collected or used for any other purpose.',
39
- title: 'Authorization Request',
40
- clickAllow: ({ allowButton }: { allowButton: React.ReactNode }) => {
41
- return <>You only need to click the {allowButton} button below, and you will not see this request again.</>;
42
- },
43
- reason: ({ site }) => {
44
- return <>For a better login experience, we need to apply for the storage permission of the {site} site.</>;
45
- },
46
- afterAllow: {
47
- title: 'After authorization, you will enjoy:',
48
- list1: 'More convenient login experience',
49
- list2: 'Faster access speed',
50
- },
51
- },
52
- zh: {
53
- allow: '允许',
54
- dataUsage: '您的数据仅用于身份认证,不会被收集或用于其他用途。',
55
- title: '授权请求',
56
- clickAllow: ({ allowButton }) => {
57
- return <>您只需要点击下方的 {allowButton} 按钮,后续将不会再看到这个请求。</>;
58
- },
59
- reason: ({ site }) => {
60
- return <>为了让您获得更好的登录体验,我们需要申请 {site} 站点存储权限。</>;
61
- },
62
- afterAllow: {
63
- title: '授权后,您将享受:',
64
- list1: '更便捷的登录体验',
65
- list2: '更快的访问速度',
66
- },
67
- },
68
- };
69
-
70
- function RequestStorageAccessApiDialog({
71
- ref = undefined,
72
- locale = 'en',
73
- src,
74
- storageAccessState,
75
- }: {
76
- locale?: Locale;
77
- src: string;
78
- storageAccessState: StorageAccessState;
79
- } & {
80
- ref?: React.Ref<unknown>;
81
- }) {
82
- const sharedBridgeRef = useRef<{ callIframe: (method: string) => Promise<any> }>(null);
83
- const currentState = useReactive({
84
- callback: noop,
85
- open: false,
86
- get origin() {
87
- try {
88
- return new URL(src).origin;
89
- } catch (error) {
90
- return src;
91
- }
92
- },
93
- get host() {
94
- try {
95
- return new URL(src).host;
96
- } catch (error) {
97
- return src;
98
- }
99
- },
100
- });
101
- const t = useMemoizedFn((key, data = {}) => {
102
- return translate(translations, key, locale, 'en', data);
103
- });
104
-
105
- const reset = useMemoizedFn(() => {
106
- currentState.open = false;
107
- currentState.callback = noop;
108
- });
109
-
110
- const open = useMemoizedFn(() => {
111
- currentState.open = true;
112
- });
113
- const close = useMemoizedFn(() => {
114
- currentState.open = false;
115
- });
116
-
117
- const _requestStorageAccess = useMemoizedFn(
118
- async (callback: (result: boolean, origin?: 'broswer' | 'system') => void) => {
119
- const result = await sharedBridgeRef.current?.callIframe('requestStorageAccess');
120
- if (result.value) {
121
- callback(true, 'broswer');
122
- } else if (storageAccessState === undefined) {
123
- // 用户未在当前网页交互过,此时必然需要进行一次弹窗
124
- callback(false, 'system');
125
- } else if (storageAccessState === 'denied') {
126
- // 用户已经明确拒绝过跨站授权,直接弹窗
127
- callback(false);
128
- } else {
129
- // NOTICE: 暂时保留这部分逻辑,后续可能会用上
130
- // else if (
131
- // result.error?.name === 'NotAllowedError' &&
132
- // result.error?.message === 'requestStorageAccess not allowed'
133
- // ) {
134
- // // 操作被浏览器禁止,需要用户手动与 iframe 交互一次才可以
135
- // currentState.open = true;
136
- // currentState.callback = callback;
137
- // }
138
- currentState.open = true;
139
- currentState.callback = callback;
140
- }
141
- }
142
- );
143
- const requestStorageAccess = useMemoizedFn(() => {
144
- return new Promise((resolve) => {
145
- _requestStorageAccess((result, origin) => {
146
- reset();
147
- resolve({ value: result, origin });
148
- });
149
- });
150
- });
151
-
152
- const handleAllow = useMemoizedFn(() => {
153
- currentState.open = false;
154
- });
155
- const handleClose = useMemoizedFn(() => {
156
- currentState.open = false;
157
- currentState.callback(false, 'system');
158
- });
159
-
160
- useImperativeHandle(ref, () => ({
161
- open,
162
- close,
163
- requestStorageAccess,
164
- }));
165
-
166
- return (
167
- <DIDConnectContainer popup open={currentState.open} onClose={handleClose} keepMounted>
168
- <Box
169
- sx={{
170
- backgroundColor: 'background.default',
171
- display: 'flex',
172
- flexDirection: 'column',
173
- height: '100%',
174
- position: 'relative',
175
- maxWidth: '100%',
176
- transition: 'width 0.2s ease-in-out',
177
- margin: 'auto',
178
- p: 3,
179
- gap: 2,
180
- }}>
181
- <CloseButton
182
- onClose={handleClose}
183
- sx={{
184
- position: 'absolute',
185
- right: 14,
186
- top: 14,
187
- }}
188
- />
189
- <Typography
190
- component="div"
191
- variant="h4"
192
- sx={{
193
- fontWeight: 700,
194
- fontFamily: 'Lexend',
195
- display: 'flex',
196
- alignItems: 'center',
197
- gap: 1,
198
- }}>
199
- <Box
200
- component={Icon}
201
- icon={lockOutlineIcon}
202
- sx={{
203
- fontSize: 28,
204
- color: 'warning.main',
205
- }}
206
- />
207
- {t('title')}
208
- </Typography>
209
- <Box sx={{ display: 'flex', flexDirection: 'column', gap: 1 }}>
210
- {/* 不需要随意更改以下内容的格式化,否则会影响到 UI 的展示 */}
211
- <Typography>
212
- {t('reason', {
213
- site: (
214
- <Chip
215
- clickable
216
- component="a"
217
- href={currentState.origin}
218
- label={currentState.host}
219
- size="small"
220
- deleteIcon={<Icon icon={externalLinkIcon} />}
221
- onDelete={() => {}}
222
- target="_blank"
223
- />
224
- ),
225
- })}
226
- </Typography>
227
- <Typography component="div">
228
- {t('clickAllow', {
229
- allowButton: <Chip label={t('allow')} size="small" color="success" />,
230
- })}
231
- </Typography>
232
- <Box sx={{ mt: 2 }}>
233
- <Typography sx={{ display: 'flex', alignItems: 'center', gap: 1, mb: 0.5 }}>
234
- <Box
235
- component={Icon}
236
- icon={checkCircleIcon}
237
- sx={{
238
- fontSize: 24,
239
- color: 'success.main',
240
- }}
241
- />
242
- {t('afterAllow.title')}
243
- </Typography>
244
- <List dense sx={{ py: 0, pl: 2 }}>
245
- <ListItem sx={{ display: 'flex', alignItems: 'center', gap: 0.8 }}>
246
- <Box
247
- component={Icon}
248
- icon={rocketLaunchRoundedIcon}
249
- sx={{
250
- fontSize: 20,
251
- color: 'success.main',
252
- }}
253
- />
254
- {t('afterAllow.list1')}
255
- </ListItem>
256
- <ListItem sx={{ display: 'flex', alignItems: 'center', gap: 0.8 }}>
257
- <Box
258
- component={Icon}
259
- icon={rocketLaunchRoundedIcon}
260
- sx={{
261
- fontSize: 20,
262
- color: 'success.main',
263
- }}
264
- />
265
- {t('afterAllow.list2')}
266
- </ListItem>
267
- </List>
268
- </Box>
269
-
270
- <Typography
271
- component="div"
272
- variant="body2"
273
- sx={{
274
- color: 'grey.700',
275
- }}>
276
- {t('dataUsage')}
277
- </Typography>
278
- </Box>
279
-
280
- <Box sx={{ display: 'flex', justifyContent: 'center' }}>
281
- <Box sx={{ position: 'relative', display: 'inline-block', cursor: 'pointer' }}>
282
- <Button variant="contained" color="success" onClick={handleAllow} sx={{ minWidth: 100, letterSpacing: 1 }}>
283
- {t('allow')}
284
- </Button>
285
- <SharedBridge
286
- ref={sharedBridgeRef}
287
- onClick={({ value, visitorId }) => {
288
- if (visitorId) setVisitorId(visitorId);
289
-
290
- currentState.callback(value, 'broswer');
291
- }}
292
- src={src}
293
- sx={{
294
- zIndex: 1,
295
- }}
296
- />
297
- </Box>
298
- </Box>
299
- </Box>
300
- </DIDConnectContainer>
301
- );
302
- }
303
-
304
- export default memo(RequestStorageAccessApiDialog);