@blocklet/did-space-react 0.5.60 → 0.5.62
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.
- package/README.md +1 -1
- package/dist/cjs/components/base-connect-to/stories/basic.d.ts +2 -0
- package/dist/cjs/components/space-card/stories/basic.d.ts +2 -0
- package/dist/es/components/base-connect-to/stories/basic.d.ts +2 -0
- package/dist/es/components/space-card/stories/basic.d.ts +2 -0
- package/package.json +41 -37
- package/.turbo/turbo-build.log +0 -69
- package/.turbo/turbo-lint$colon$fix.log +0 -8
- package/build.config.ts +0 -47
- package/src/components/auth-connect-to/base-auth.tsx +0 -64
- package/src/components/auth-connect-to/gateway-auth.tsx +0 -53
- package/src/components/auth-connect-to/index.tsx +0 -71
- package/src/components/base-connect-to/base-connect-to.stories.tsx +0 -11
- package/src/components/base-connect-to/index.tsx +0 -160
- package/src/components/preview-space-nft/index.tsx +0 -78
- package/src/components/session-connect-to/index.tsx +0 -39
- package/src/components/session-connect-to/re-connect.tsx +0 -57
- package/src/components/space-card/index.tsx +0 -288
- package/src/components/space-card/space-card.stories.tsx +0 -13
- package/src/hooks/use-locale.ts +0 -15
- package/src/hooks/use-mobile.ts +0 -8
- package/src/hooks/use-space-info.ts +0 -32
- package/src/icons/empty-space-nft.svg +0 -59
- package/src/icons/index.tsx +0 -12
- package/src/icons/space-connect-error.svg +0 -4
- package/src/icons/space-connected.svg +0 -4
- package/src/icons/space-disconnect.svg +0 -4
- package/src/index.ts +0 -21
- package/src/libs/api.ts +0 -5
- package/src/libs/constants.ts +0 -4
- package/src/libs/gateway.ts +0 -55
- package/src/libs/util.ts +0 -103
- package/src/locales/en.tsx +0 -54
- package/src/locales/index.tsx +0 -7
- package/src/locales/zh.tsx +0 -53
- package/src/types/index.ts +0 -51
- package/src/types/shims.d.ts +0 -15
- package/vite.config.ts +0 -32
- /package/{es → dist/cjs}/components/auth-connect-to/base-auth.d.ts +0 -0
- /package/{lib → dist/cjs}/components/auth-connect-to/base-auth.js +0 -0
- /package/{es → dist/cjs}/components/auth-connect-to/gateway-auth.d.ts +0 -0
- /package/{lib → dist/cjs}/components/auth-connect-to/gateway-auth.js +0 -0
- /package/{es → dist/cjs}/components/auth-connect-to/index.d.ts +0 -0
- /package/{lib → dist/cjs}/components/auth-connect-to/index.js +0 -0
- /package/{es → dist/cjs}/components/base-connect-to/base-connect-to.stories.d.ts +0 -0
- /package/{es → dist/cjs}/components/base-connect-to/index.d.ts +0 -0
- /package/{lib → dist/cjs}/components/base-connect-to/index.js +0 -0
- /package/{es → dist/cjs}/components/preview-space-nft/index.d.ts +0 -0
- /package/{lib → dist/cjs}/components/preview-space-nft/index.js +0 -0
- /package/{es → dist/cjs}/components/session-connect-to/index.d.ts +0 -0
- /package/{lib → dist/cjs}/components/session-connect-to/index.js +0 -0
- /package/{es → dist/cjs}/components/session-connect-to/re-connect.d.ts +0 -0
- /package/{lib → dist/cjs}/components/session-connect-to/re-connect.js +0 -0
- /package/{es → dist/cjs}/components/space-card/index.d.ts +0 -0
- /package/{lib → dist/cjs}/components/space-card/index.js +0 -0
- /package/{es → dist/cjs}/components/space-card/space-card.stories.d.ts +0 -0
- /package/{es → dist/cjs}/hooks/use-locale.d.ts +0 -0
- /package/{lib → dist/cjs}/hooks/use-locale.js +0 -0
- /package/{es → dist/cjs}/hooks/use-mobile.d.ts +0 -0
- /package/{lib → dist/cjs}/hooks/use-mobile.js +0 -0
- /package/{es → dist/cjs}/hooks/use-space-info.d.ts +0 -0
- /package/{lib → dist/cjs}/hooks/use-space-info.js +0 -0
- /package/{lib → dist/cjs}/icons/empty-space-nft.svg.js +0 -0
- /package/{es → dist/cjs}/icons/index.d.ts +0 -0
- /package/{lib → dist/cjs}/icons/index.js +0 -0
- /package/{lib → dist/cjs}/icons/space-connect-error.svg.js +0 -0
- /package/{lib → dist/cjs}/icons/space-connected.svg.js +0 -0
- /package/{lib → dist/cjs}/icons/space-disconnect.svg.js +0 -0
- /package/{es → dist/cjs}/index.d.ts +0 -0
- /package/{lib → dist/cjs}/index.js +0 -0
- /package/{es → dist/cjs}/libs/api.d.ts +0 -0
- /package/{lib → dist/cjs}/libs/api.js +0 -0
- /package/{es → dist/cjs}/libs/constants.d.ts +0 -0
- /package/{lib → dist/cjs}/libs/constants.js +0 -0
- /package/{es → dist/cjs}/libs/gateway.d.ts +0 -0
- /package/{lib → dist/cjs}/libs/gateway.js +0 -0
- /package/{es → dist/cjs}/libs/util.d.ts +0 -0
- /package/{lib → dist/cjs}/libs/util.js +0 -0
- /package/{es → dist/cjs}/locales/en.d.ts +0 -0
- /package/{lib → dist/cjs}/locales/en.js +0 -0
- /package/{es → dist/cjs}/locales/index.d.ts +0 -0
- /package/{lib → dist/cjs}/locales/index.js +0 -0
- /package/{es → dist/cjs}/locales/zh.d.ts +0 -0
- /package/{lib → dist/cjs}/locales/zh.js +0 -0
- /package/{es → dist/cjs}/types/index.d.ts +0 -0
- /package/{lib → dist/cjs}/types/index.js +0 -0
- /package/{lib → dist/es}/components/auth-connect-to/base-auth.d.ts +0 -0
- /package/{es → dist/es}/components/auth-connect-to/base-auth.js +0 -0
- /package/{lib → dist/es}/components/auth-connect-to/gateway-auth.d.ts +0 -0
- /package/{es → dist/es}/components/auth-connect-to/gateway-auth.js +0 -0
- /package/{lib → dist/es}/components/auth-connect-to/index.d.ts +0 -0
- /package/{es → dist/es}/components/auth-connect-to/index.js +0 -0
- /package/{lib → dist/es}/components/base-connect-to/base-connect-to.stories.d.ts +0 -0
- /package/{lib → dist/es}/components/base-connect-to/index.d.ts +0 -0
- /package/{es → dist/es}/components/base-connect-to/index.js +0 -0
- /package/{lib → dist/es}/components/preview-space-nft/index.d.ts +0 -0
- /package/{es → dist/es}/components/preview-space-nft/index.js +0 -0
- /package/{lib → dist/es}/components/session-connect-to/index.d.ts +0 -0
- /package/{es → dist/es}/components/session-connect-to/index.js +0 -0
- /package/{lib → dist/es}/components/session-connect-to/re-connect.d.ts +0 -0
- /package/{es → dist/es}/components/session-connect-to/re-connect.js +0 -0
- /package/{lib → dist/es}/components/space-card/index.d.ts +0 -0
- /package/{es → dist/es}/components/space-card/index.js +0 -0
- /package/{lib → dist/es}/components/space-card/space-card.stories.d.ts +0 -0
- /package/{lib → dist/es}/hooks/use-locale.d.ts +0 -0
- /package/{es → dist/es}/hooks/use-locale.js +0 -0
- /package/{lib → dist/es}/hooks/use-mobile.d.ts +0 -0
- /package/{es → dist/es}/hooks/use-mobile.js +0 -0
- /package/{lib → dist/es}/hooks/use-space-info.d.ts +0 -0
- /package/{es → dist/es}/hooks/use-space-info.js +0 -0
- /package/{es → dist/es}/icons/empty-space-nft.svg.js +0 -0
- /package/{lib → dist/es}/icons/index.d.ts +0 -0
- /package/{es → dist/es}/icons/index.js +0 -0
- /package/{es → dist/es}/icons/space-connect-error.svg.js +0 -0
- /package/{es → dist/es}/icons/space-connected.svg.js +0 -0
- /package/{es → dist/es}/icons/space-disconnect.svg.js +0 -0
- /package/{lib → dist/es}/index.d.ts +0 -0
- /package/{es → dist/es}/index.js +0 -0
- /package/{lib → dist/es}/libs/api.d.ts +0 -0
- /package/{es → dist/es}/libs/api.js +0 -0
- /package/{lib → dist/es}/libs/constants.d.ts +0 -0
- /package/{es → dist/es}/libs/constants.js +0 -0
- /package/{lib → dist/es}/libs/gateway.d.ts +0 -0
- /package/{es → dist/es}/libs/gateway.js +0 -0
- /package/{lib → dist/es}/libs/util.d.ts +0 -0
- /package/{es → dist/es}/libs/util.js +0 -0
- /package/{lib → dist/es}/locales/en.d.ts +0 -0
- /package/{es → dist/es}/locales/en.js +0 -0
- /package/{lib → dist/es}/locales/index.d.ts +0 -0
- /package/{es → dist/es}/locales/index.js +0 -0
- /package/{lib → dist/es}/locales/zh.d.ts +0 -0
- /package/{es → dist/es}/locales/zh.js +0 -0
- /package/{lib → dist/es}/types/index.d.ts +0 -0
- /package/{es → dist/es}/types/index.js +0 -0
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/did-space-react",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.62",
|
|
4
4
|
"description": "Reusable react components for did space",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -10,12 +10,16 @@
|
|
|
10
10
|
"author": "wangshijun<wangshijun2010@gmail.com>",
|
|
11
11
|
"homepage": "https://github.com/ArcBlock/did-spaces#readme",
|
|
12
12
|
"license": "Apache-2.0",
|
|
13
|
-
"main": "
|
|
14
|
-
"module": "es/index.js",
|
|
13
|
+
"main": "dist/cjs/index.js",
|
|
14
|
+
"module": "dist/es/index.js",
|
|
15
15
|
"repository": {
|
|
16
16
|
"type": "git",
|
|
17
17
|
"url": "git+https://github.com/ArcBlock/did-spaces.git"
|
|
18
18
|
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist",
|
|
21
|
+
"package.json"
|
|
22
|
+
],
|
|
19
23
|
"scripts": {
|
|
20
24
|
"lint": "tsc --noEmit && eslint src tests --ext js --ext jsx --ext ts --ext tsx",
|
|
21
25
|
"lint:fix": "npm run lint -- --fix",
|
|
@@ -28,55 +32,55 @@
|
|
|
28
32
|
"coverage": "vitest run --coverage",
|
|
29
33
|
"start": "storybook dev -p 6006",
|
|
30
34
|
"build-storybook": "storybook build",
|
|
31
|
-
"cpfiles": "copyfiles -u 1 './src/**/*.css'
|
|
35
|
+
"cpfiles": "copyfiles -u 1 './src/**/*.css' dist/cjs/ && copyfiles -u 1 './src/**/*.css' dist/es/"
|
|
32
36
|
},
|
|
33
37
|
"bugs": {
|
|
34
38
|
"url": "https://github.com/ArcBlock/did-spaces/issues"
|
|
35
39
|
},
|
|
36
40
|
"exports": {
|
|
37
41
|
".": {
|
|
38
|
-
"import": "./es/index.js",
|
|
39
|
-
"require": "./
|
|
42
|
+
"import": "./dist/es/index.js",
|
|
43
|
+
"require": "./dist/cjs/index.js"
|
|
40
44
|
},
|
|
41
|
-
"./
|
|
42
|
-
"import": "./es/hooks/*.js",
|
|
43
|
-
"require": "./
|
|
45
|
+
"./hooks/*": {
|
|
46
|
+
"import": "./dist/es/hooks/*.js",
|
|
47
|
+
"require": "./dist/cjs/hooks/*.js"
|
|
44
48
|
},
|
|
45
|
-
"./
|
|
46
|
-
"import": "./es/libs/*.js",
|
|
47
|
-
"require": "./
|
|
49
|
+
"./libs/*": {
|
|
50
|
+
"import": "./dist/es/libs/*.js",
|
|
51
|
+
"require": "./dist/cjs/libs/*.js"
|
|
48
52
|
},
|
|
49
|
-
"./
|
|
50
|
-
"import": "./es/components/auth-connect-to/index.js",
|
|
51
|
-
"require": "./
|
|
53
|
+
"./components/auth-connect-to": {
|
|
54
|
+
"import": "./dist/es/components/auth-connect-to/index.js",
|
|
55
|
+
"require": "./dist/cjs/components/auth-connect-to/index.js"
|
|
52
56
|
},
|
|
53
|
-
"./
|
|
54
|
-
"import": "./es/components/base-connect-to/index.js",
|
|
55
|
-
"require": "./
|
|
57
|
+
"./components/base-connect-to": {
|
|
58
|
+
"import": "./dist/es/components/base-connect-to/index.js",
|
|
59
|
+
"require": "./dist/cjs/components/base-connect-to/index.js"
|
|
56
60
|
},
|
|
57
|
-
"./
|
|
58
|
-
"import": "./es/components/preview-space-nft/index.js",
|
|
59
|
-
"require": "./
|
|
61
|
+
"./components/preview-space-nft": {
|
|
62
|
+
"import": "./dist/es/components/preview-space-nft/index.js",
|
|
63
|
+
"require": "./dist/cjs/components/preview-space-nft/index.js"
|
|
60
64
|
},
|
|
61
|
-
"./
|
|
62
|
-
"import": "./es/components/session-connect-to/index.js",
|
|
63
|
-
"require": "./
|
|
65
|
+
"./components/session-connect-to": {
|
|
66
|
+
"import": "./dist/es/components/session-connect-to/index.js",
|
|
67
|
+
"require": "./dist/cjs/components/session-connect-to/index.js"
|
|
64
68
|
},
|
|
65
|
-
"./
|
|
66
|
-
"import": "./es/components/space-card/index.js",
|
|
67
|
-
"require": "./
|
|
69
|
+
"./components/space-card": {
|
|
70
|
+
"import": "./dist/es/components/space-card/index.js",
|
|
71
|
+
"require": "./dist/cjs/components/space-card/index.js"
|
|
68
72
|
},
|
|
69
|
-
"./
|
|
70
|
-
"import": "./es/icons/index.js",
|
|
71
|
-
"require": "./
|
|
73
|
+
"./icons": {
|
|
74
|
+
"import": "./dist/es/icons/index.js",
|
|
75
|
+
"require": "./dist/cjs/icons/index.js"
|
|
72
76
|
},
|
|
73
|
-
"./
|
|
74
|
-
"import": "./es/locales/index.js",
|
|
75
|
-
"require": "./
|
|
77
|
+
"./locales": {
|
|
78
|
+
"import": "./dist/es/locales/index.js",
|
|
79
|
+
"require": "./dist/cjs/locales/index.js"
|
|
76
80
|
},
|
|
77
|
-
"./
|
|
78
|
-
"import": "./es/types/index.js",
|
|
79
|
-
"require": "./
|
|
81
|
+
"./types": {
|
|
82
|
+
"import": "./dist/es/types/index.js",
|
|
83
|
+
"require": "./dist/cjs/types/index.js"
|
|
80
84
|
}
|
|
81
85
|
},
|
|
82
86
|
"dependencies": {
|
|
@@ -141,5 +145,5 @@
|
|
|
141
145
|
"vite-plugin-node-polyfills": "^0.22.0",
|
|
142
146
|
"vitest": "^2.1.4"
|
|
143
147
|
},
|
|
144
|
-
"gitHead": "
|
|
148
|
+
"gitHead": "af553c5e349d53fd87ac5368cc6c88bda69bd378"
|
|
145
149
|
}
|
package/.turbo/turbo-build.log
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
> @blocklet/did-space-react@0.5.59 build /home/runner/work/did-spaces/did-spaces/packages/react
|
|
3
|
-
> unbuild && node tools/auto-exports.js && npm run cpfiles && node tools/build-types.js
|
|
4
|
-
|
|
5
|
-
[info] Building did-space-react
|
|
6
|
-
[info] Cleaning dist directory: `./lib`
|
|
7
|
-
[success] Build succeeded for did-space-react
|
|
8
|
-
[log] dist/index.js (total size: 2.72 kB, chunk size: 2.72 kB, exports: AuthConnectTo, BaseConnectTo, EmptySpacesNFTIcon, GatewayAuth, PreviewSpaceNft, ReConnect, SessionConnectTo, SpaceCard, SpaceConnectErrorIcon, SpaceDisconnectedIcon, SpaceStatus, SpacesConnectedIcon, WalletAuth, api, classNames, decryptSpaceGateway, extraDIDSpacesCoreUrl, getDIDSpaceDidFromEndpoint, getDIDSpaceUrlFromEndpoint, getSpaceDidFromEndpoint, getSpaceDidFromGatewayUrl, getSpaceGatewayUrl, getSpaceGatewayUrlFromEndpoint, getSpaceNftDisplayUrlFromEndpoint, isValidSpaceGatewayUrl, translations, useLocale, useMobile, useSpaceInfo)
|
|
9
|
-
└─ dist/libs/api.js
|
|
10
|
-
└─ dist/hooks/use-mobile.js
|
|
11
|
-
└─ dist/hooks/use-space-info.js
|
|
12
|
-
└─ dist/hooks/use-locale.js
|
|
13
|
-
└─ dist/components/space-card/index.js
|
|
14
|
-
└─ dist/components/preview-space-nft/index.js
|
|
15
|
-
└─ dist/components/base-connect-to/index.js
|
|
16
|
-
└─ dist/components/auth-connect-to/index.js
|
|
17
|
-
└─ dist/components/session-connect-to/index.js
|
|
18
|
-
└─ dist/libs/util.js
|
|
19
|
-
└─ dist/libs/gateway.js
|
|
20
|
-
└─ dist/locales/index.js
|
|
21
|
-
└─ dist/types/index.js
|
|
22
|
-
└─ dist/icons/index.js
|
|
23
|
-
└─ dist/icons/empty-space-nft.svg.js
|
|
24
|
-
└─ dist/icons/space-connected.svg.js
|
|
25
|
-
└─ dist/icons/space-disconnect.svg.js
|
|
26
|
-
└─ dist/icons/space-connect-error.svg.js
|
|
27
|
-
└─ dist/components/auth-connect-to/base-auth.js
|
|
28
|
-
└─ dist/components/auth-connect-to/gateway-auth.js
|
|
29
|
-
└─ dist/components/session-connect-to/re-connect.js
|
|
30
|
-
|
|
31
|
-
Σ Total dist size (byte size): 2.72 kB
|
|
32
|
-
[log]
|
|
33
|
-
[warn] Build is done with some warnings:
|
|
34
|
-
|
|
35
|
-
- Potential missing package.json files: es/index.js, es/hooks, es/libs, es/components/auth-connect-to/index.js, es/components/base-connect-to/index.js, es/components/preview-space-nft/index.js, es/components/session-connect-to/index.js, es/components/space-card/index.js, es/icons/index.js, es/locales/index.js, es/types/index.js
|
|
36
|
-
[info] Building did-space-react
|
|
37
|
-
[info] Cleaning dist directory: `./es`
|
|
38
|
-
[success] Build succeeded for did-space-react
|
|
39
|
-
[log] dist/index.js (total size: 1.63 kB, chunk size: 1.63 kB, exports: AuthConnectTo, BaseConnectTo, EmptySpacesNFTIcon, GatewayAuth, PreviewSpaceNft, ReConnect, SessionConnectTo, SpaceCard, SpaceConnectErrorIcon, SpaceDisconnectedIcon, SpaceStatus, SpacesConnectedIcon, WalletAuth, api, classNames, decryptSpaceGateway, extraDIDSpacesCoreUrl, getDIDSpaceDidFromEndpoint, getDIDSpaceUrlFromEndpoint, getSpaceDidFromEndpoint, getSpaceDidFromGatewayUrl, getSpaceGatewayUrl, getSpaceGatewayUrlFromEndpoint, getSpaceNftDisplayUrlFromEndpoint, isValidSpaceGatewayUrl, translations, useLocale, useMobile, useSpaceInfo)
|
|
40
|
-
└─ dist/libs/api.js
|
|
41
|
-
└─ dist/hooks/use-mobile.js
|
|
42
|
-
└─ dist/hooks/use-space-info.js
|
|
43
|
-
└─ dist/hooks/use-locale.js
|
|
44
|
-
└─ dist/components/space-card/index.js
|
|
45
|
-
└─ dist/components/preview-space-nft/index.js
|
|
46
|
-
└─ dist/components/base-connect-to/index.js
|
|
47
|
-
└─ dist/components/auth-connect-to/index.js
|
|
48
|
-
└─ dist/components/session-connect-to/index.js
|
|
49
|
-
└─ dist/libs/util.js
|
|
50
|
-
└─ dist/libs/gateway.js
|
|
51
|
-
└─ dist/locales/index.js
|
|
52
|
-
└─ dist/types/index.js
|
|
53
|
-
└─ dist/icons/index.js
|
|
54
|
-
└─ dist/icons/empty-space-nft.svg.js
|
|
55
|
-
└─ dist/icons/space-connected.svg.js
|
|
56
|
-
└─ dist/icons/space-disconnect.svg.js
|
|
57
|
-
└─ dist/icons/space-connect-error.svg.js
|
|
58
|
-
└─ dist/components/auth-connect-to/base-auth.js
|
|
59
|
-
└─ dist/components/auth-connect-to/gateway-auth.js
|
|
60
|
-
└─ dist/components/session-connect-to/re-connect.js
|
|
61
|
-
|
|
62
|
-
Σ Total dist size (byte size): 1.63 kB
|
|
63
|
-
[log]
|
|
64
|
-
|
|
65
|
-
> @blocklet/did-space-react@0.5.59 cpfiles
|
|
66
|
-
> copyfiles -u 1 './src/**/*.css' lib/ && copyfiles -u 1 './src/**/*.css' es/
|
|
67
|
-
|
|
68
|
-
tsc --declaration --emitDeclarationOnly --outDir lib --rootDir /home/runner/work/did-spaces/did-spaces/packages/react/src
|
|
69
|
-
tsc --declaration --emitDeclarationOnly --outDir es --rootDir /home/runner/work/did-spaces/did-spaces/packages/react/src
|
package/build.config.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { defineBuildConfig } from 'unbuild';
|
|
2
|
-
import svgr from '@svgr/rollup';
|
|
3
|
-
import type { BuildConfig } from 'unbuild';
|
|
4
|
-
|
|
5
|
-
const createConfig = (format: 'cjs' | 'esm'): BuildConfig => ({
|
|
6
|
-
failOnWarn: false,
|
|
7
|
-
entries: [
|
|
8
|
-
{
|
|
9
|
-
builder: 'rollup',
|
|
10
|
-
input: './src/index',
|
|
11
|
-
outDir: format === 'cjs' ? './lib' : './es',
|
|
12
|
-
},
|
|
13
|
-
],
|
|
14
|
-
clean: true,
|
|
15
|
-
externals: ['@abtnode/client'],
|
|
16
|
-
rollup: {
|
|
17
|
-
esbuild: {
|
|
18
|
-
jsx: 'automatic',
|
|
19
|
-
},
|
|
20
|
-
output: {
|
|
21
|
-
dir: format === 'cjs' ? './lib' : './es',
|
|
22
|
-
preserveModules: true,
|
|
23
|
-
preserveModulesRoot: 'src',
|
|
24
|
-
entryFileNames: '[name].js',
|
|
25
|
-
format,
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
hooks: {
|
|
29
|
-
'rollup:options'(_ctx, options) {
|
|
30
|
-
// @ts-ignore
|
|
31
|
-
options.plugins.push(
|
|
32
|
-
svgr({
|
|
33
|
-
svgoConfig: {
|
|
34
|
-
plugins: [
|
|
35
|
-
{
|
|
36
|
-
name: 'removeViewBox',
|
|
37
|
-
active: false,
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
},
|
|
41
|
-
})
|
|
42
|
-
);
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
export default defineBuildConfig([createConfig('cjs'), createConfig('esm')]);
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { Typography } from '@mui/material';
|
|
2
|
-
import DidConnect from '@arcblock/did-connect/lib/Connect';
|
|
3
|
-
import { RELAY_SOCKET_PREFIX } from '@arcblock/ux/lib/Util/constant';
|
|
4
|
-
import { joinURL } from 'ufo';
|
|
5
|
-
import { createAxios } from '@blocklet/js-sdk';
|
|
6
|
-
import useLocale from '../../hooks/use-locale';
|
|
7
|
-
import { AUTHORIZE } from '../../libs/constants';
|
|
8
|
-
import type { BaseAuthOptions } from '../../types';
|
|
9
|
-
|
|
10
|
-
export interface BaseAuthProps extends BaseAuthOptions, Record<string, any> {
|
|
11
|
-
open: boolean;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function BaseAuth({ open, extraParams, onSuccess, onClose, ...rest }: BaseAuthProps) {
|
|
15
|
-
const { t, locale } = useLocale();
|
|
16
|
-
|
|
17
|
-
const finalExtraParams = {
|
|
18
|
-
appPid: window.blocklet?.appPid,
|
|
19
|
-
appDid: window.blocklet?.appId,
|
|
20
|
-
appName: window.blocklet?.appName,
|
|
21
|
-
appDescription: window.blocklet?.appDescription,
|
|
22
|
-
appUrl: window.blocklet?.appUrl,
|
|
23
|
-
referrer: window.location.href,
|
|
24
|
-
scopes: AUTHORIZE.DEFAULT_SCOPE,
|
|
25
|
-
...extraParams,
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const {
|
|
29
|
-
action = 'connect-to-did-spaces',
|
|
30
|
-
prefix = '/api/did',
|
|
31
|
-
baseUrl = joinURL(window.location.origin, RELAY_SOCKET_PREFIX),
|
|
32
|
-
checkFn = createAxios({ baseURL: joinURL(window.location.origin, RELAY_SOCKET_PREFIX) }).get,
|
|
33
|
-
webWalletUrl = window.blocklet?.webWalletUrl,
|
|
34
|
-
checkTimeout = 1e3 * 300,
|
|
35
|
-
messages = {
|
|
36
|
-
title: t('storage.spaces.provideNFT.title', { appName: finalExtraParams.appName }),
|
|
37
|
-
scan: t('storage.spaces.provideNFT.scan', { appName: finalExtraParams.appName }),
|
|
38
|
-
confirm: '',
|
|
39
|
-
success: <Typography gutterBottom>{t('storage.spaces.provideNFT.success')}</Typography>,
|
|
40
|
-
},
|
|
41
|
-
...restOptions
|
|
42
|
-
} = rest;
|
|
43
|
-
|
|
44
|
-
return (
|
|
45
|
-
<DidConnect
|
|
46
|
-
{...restOptions}
|
|
47
|
-
open={open}
|
|
48
|
-
action={action}
|
|
49
|
-
prefix={prefix}
|
|
50
|
-
baseUrl={baseUrl}
|
|
51
|
-
checkFn={checkFn}
|
|
52
|
-
webWalletUrl={webWalletUrl}
|
|
53
|
-
messages={messages}
|
|
54
|
-
checkTimeout={checkTimeout}
|
|
55
|
-
extraParams={finalExtraParams}
|
|
56
|
-
forceConnected={false}
|
|
57
|
-
saveConnect={false}
|
|
58
|
-
popup
|
|
59
|
-
locale={locale}
|
|
60
|
-
onSuccess={onSuccess}
|
|
61
|
-
onClose={onClose}
|
|
62
|
-
/>
|
|
63
|
-
);
|
|
64
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { joinURL } from 'ufo';
|
|
2
|
-
import { createAxios } from '@blocklet/js-sdk';
|
|
3
|
-
import { Typography } from '@mui/material';
|
|
4
|
-
import useLocale from '../../hooks/use-locale';
|
|
5
|
-
import type { GatewayAuthOptions } from '../../types';
|
|
6
|
-
import { BaseAuth } from './base-auth';
|
|
7
|
-
|
|
8
|
-
export interface GatewayAuthProps extends GatewayAuthOptions {
|
|
9
|
-
open: boolean;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function GatewayAuth({
|
|
13
|
-
open,
|
|
14
|
-
spaceDid,
|
|
15
|
-
spaceGatewayUrl,
|
|
16
|
-
extraParams = {},
|
|
17
|
-
onSuccess,
|
|
18
|
-
onClose,
|
|
19
|
-
}: GatewayAuthProps) {
|
|
20
|
-
const { t } = useLocale();
|
|
21
|
-
|
|
22
|
-
if (!spaceGatewayUrl || !spaceDid) {
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const { appName = window.blocklet?.appName } = extraParams;
|
|
27
|
-
const prefix = joinURL(spaceGatewayUrl, 'space/api/did');
|
|
28
|
-
const baseUrl = new URL(spaceGatewayUrl).origin;
|
|
29
|
-
const checkFn = createAxios({ baseURL: joinURL(spaceGatewayUrl, 'space') }).get;
|
|
30
|
-
const messages = {
|
|
31
|
-
title: t('storage.spaces.authorize.title', { appName }),
|
|
32
|
-
scan: t('storage.spaces.authorize.scan', { appName }),
|
|
33
|
-
confirm: '',
|
|
34
|
-
success: <Typography gutterBottom>{t('storage.spaces.authorize.success')}</Typography>,
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<BaseAuth
|
|
39
|
-
open={open}
|
|
40
|
-
action="one-click-authorization"
|
|
41
|
-
prefix={prefix}
|
|
42
|
-
baseUrl={baseUrl}
|
|
43
|
-
checkFn={checkFn}
|
|
44
|
-
messages={messages}
|
|
45
|
-
extraParams={{
|
|
46
|
-
...extraParams,
|
|
47
|
-
spaceDid,
|
|
48
|
-
}}
|
|
49
|
-
onSuccess={onSuccess}
|
|
50
|
-
onClose={onClose}
|
|
51
|
-
/>
|
|
52
|
-
);
|
|
53
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
import { BaseConnectTo, type BaseConnectToProps } from '../base-connect-to';
|
|
3
|
-
import { GatewayAuth, type GatewayAuthProps } from './gateway-auth';
|
|
4
|
-
import { BaseAuth, type BaseAuthProps } from './base-auth';
|
|
5
|
-
import { BaseAuthOptions } from '../../types';
|
|
6
|
-
|
|
7
|
-
export interface Options extends BaseAuthOptions, Record<string, any> {}
|
|
8
|
-
|
|
9
|
-
export interface AuthConnectToProps extends BaseConnectToProps {
|
|
10
|
-
options?: Options;
|
|
11
|
-
onSuccess?: (response: Record<string, string>, decrypt: Function) => Promise<void>;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/** Space 连接组件, 内置 Auth 验证流程 */
|
|
15
|
-
export function AuthConnectTo({ options, onSuccess, ...rest }: AuthConnectToProps) {
|
|
16
|
-
const [walletOptions, setWalletOptions] = useState({
|
|
17
|
-
open: false,
|
|
18
|
-
});
|
|
19
|
-
const [gatewayOptions, setGatewayOptions] = useState({
|
|
20
|
-
open: false,
|
|
21
|
-
spaceDid: '',
|
|
22
|
-
spaceGatewayUrl: '',
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
const onWalletClick = () => setWalletOptions((pre) => ({ ...pre, open: true }));
|
|
26
|
-
|
|
27
|
-
const onGatewayConfirm = ({ spaceDid, spaceGatewayUrl }: { spaceDid: string; spaceGatewayUrl: string }) => {
|
|
28
|
-
setGatewayOptions((pre) => ({
|
|
29
|
-
...pre,
|
|
30
|
-
open: true,
|
|
31
|
-
spaceDid,
|
|
32
|
-
spaceGatewayUrl,
|
|
33
|
-
}));
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const handleSuccess = async (response: Record<string, string>, decrypt: Function) => {
|
|
37
|
-
await onSuccess?.(response, decrypt);
|
|
38
|
-
setWalletOptions((pre) => ({
|
|
39
|
-
...pre,
|
|
40
|
-
open: false,
|
|
41
|
-
}));
|
|
42
|
-
setGatewayOptions((pre) => ({
|
|
43
|
-
...pre,
|
|
44
|
-
open: false,
|
|
45
|
-
}));
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
<>
|
|
50
|
-
<BaseConnectTo {...rest} onWalletClick={onWalletClick} onGatewayConfirm={onGatewayConfirm} />
|
|
51
|
-
<BaseAuth
|
|
52
|
-
{...options}
|
|
53
|
-
{...walletOptions}
|
|
54
|
-
onSuccess={handleSuccess}
|
|
55
|
-
onClose={() => setWalletOptions((pre) => ({ ...pre, open: false }))}
|
|
56
|
-
/>
|
|
57
|
-
<GatewayAuth
|
|
58
|
-
{...options}
|
|
59
|
-
{...gatewayOptions}
|
|
60
|
-
onSuccess={handleSuccess}
|
|
61
|
-
onClose={() => setGatewayOptions((pre) => ({ ...pre, open: false }))}
|
|
62
|
-
/>
|
|
63
|
-
</>
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
AuthConnectTo.WalletAuth = BaseAuth;
|
|
68
|
-
AuthConnectTo.GatewayAuth = GatewayAuth;
|
|
69
|
-
|
|
70
|
-
export { BaseAuth as WalletAuth, type BaseAuthProps as WalletAuthProps };
|
|
71
|
-
export { GatewayAuth, type GatewayAuthProps };
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
import { isValid as isValidDid } from '@arcblock/did';
|
|
3
|
-
import { CircularProgress, DialogContentText, Link, TextField, Tooltip, Typography } from '@mui/material';
|
|
4
|
-
import HelpOutlineIcon from '@mui/icons-material/HelpOutline';
|
|
5
|
-
import Button from '@arcblock/ux/lib/Button';
|
|
6
|
-
import SplitButton, { SplitButtonProps } from '@arcblock/ux/lib/SplitButton';
|
|
7
|
-
import Dialog from '@arcblock/ux/lib/Dialog';
|
|
8
|
-
|
|
9
|
-
import { withQuery } from 'ufo';
|
|
10
|
-
import { copyGatewayPageUrl } from '../../libs/constants';
|
|
11
|
-
import { extraDIDSpacesCoreUrl, getSpaceDidFromGatewayUrl } from '../../libs/util';
|
|
12
|
-
import { getSpaceGatewayUrl, isValidSpaceGatewayUrl } from '../../libs/gateway';
|
|
13
|
-
import useLocale from '../../hooks/use-locale';
|
|
14
|
-
|
|
15
|
-
export interface BaseConnectToProps extends Omit<SplitButtonProps, 'menu' | 'onClick'> {
|
|
16
|
-
onWalletClick?: () => void;
|
|
17
|
-
onGatewayConfirm?: (params: { spaceDid: string; spaceGatewayUrl: string }) => void;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/** 基础连接按钮组件,只负责前端 ux */
|
|
21
|
-
export function BaseConnectTo({ style, onWalletClick, onGatewayConfirm, ...rest }: BaseConnectToProps) {
|
|
22
|
-
const { t, locale } = useLocale();
|
|
23
|
-
const [url, setUrl] = useState('');
|
|
24
|
-
const [loading, setLoading] = useState(false);
|
|
25
|
-
const [open, setOpen] = useState(false);
|
|
26
|
-
const [errorMessage, setErrorMessage] = useState('');
|
|
27
|
-
|
|
28
|
-
const onGatewayChange = async () => {
|
|
29
|
-
try {
|
|
30
|
-
setLoading(true);
|
|
31
|
-
|
|
32
|
-
const spaceGatewayUrl = await getSpaceGatewayUrl(url);
|
|
33
|
-
const didSpacesCoreUrl = extraDIDSpacesCoreUrl(spaceGatewayUrl);
|
|
34
|
-
const spaceDid = getSpaceDidFromGatewayUrl(url);
|
|
35
|
-
|
|
36
|
-
if (!isValidDid(spaceDid!) || !(await isValidSpaceGatewayUrl(didSpacesCoreUrl))) {
|
|
37
|
-
throw new Error(t('storage.spaces.gateway.add.invalidUrl'));
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
onGatewayConfirm?.({
|
|
41
|
-
spaceDid: spaceDid!,
|
|
42
|
-
spaceGatewayUrl: didSpacesCoreUrl,
|
|
43
|
-
});
|
|
44
|
-
setOpen(false);
|
|
45
|
-
} catch (err) {
|
|
46
|
-
console.error(err);
|
|
47
|
-
setErrorMessage((err as Error).message);
|
|
48
|
-
} finally {
|
|
49
|
-
setLoading(false);
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
const onGatewayClick = () => {
|
|
54
|
-
setErrorMessage('');
|
|
55
|
-
setUrl('');
|
|
56
|
-
setOpen(true);
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
return (
|
|
60
|
-
<>
|
|
61
|
-
<SplitButton
|
|
62
|
-
menu={[
|
|
63
|
-
// @ts-expect-error
|
|
64
|
-
<SplitButton.Item
|
|
65
|
-
sx={{
|
|
66
|
-
textTransform: 'none',
|
|
67
|
-
}}
|
|
68
|
-
key="1"
|
|
69
|
-
size="small"
|
|
70
|
-
onClick={onGatewayClick}
|
|
71
|
-
>
|
|
72
|
-
{t('storage.spaces.connect.useSpaceGateway')}
|
|
73
|
-
</SplitButton.Item>,
|
|
74
|
-
]}
|
|
75
|
-
color="primary"
|
|
76
|
-
// @ts-expect-error
|
|
77
|
-
style={{ textTransform: 'none !important', fontSize: '1rem', ...style }}
|
|
78
|
-
size="small"
|
|
79
|
-
{...rest}
|
|
80
|
-
onClick={onWalletClick}
|
|
81
|
-
>
|
|
82
|
-
<Typography sx={{ fontWeight: 'bold', textTransform: 'none' }}>
|
|
83
|
-
{t('storage.spaces.connect.useWallet')}
|
|
84
|
-
</Typography>
|
|
85
|
-
</SplitButton>
|
|
86
|
-
<Dialog
|
|
87
|
-
title={t('storage.spaces.gateway.add.title')}
|
|
88
|
-
fullWidth
|
|
89
|
-
maxWidth="md"
|
|
90
|
-
open={open}
|
|
91
|
-
onClose={() => setOpen(false)}
|
|
92
|
-
PaperProps={{ style: { minHeight: 'auto' } }}
|
|
93
|
-
actions={
|
|
94
|
-
<>
|
|
95
|
-
<Button
|
|
96
|
-
variant="outlined"
|
|
97
|
-
onClick={(e) => {
|
|
98
|
-
e.stopPropagation();
|
|
99
|
-
setOpen(false);
|
|
100
|
-
}}
|
|
101
|
-
color="inherit"
|
|
102
|
-
>
|
|
103
|
-
{t('common.cancel')}
|
|
104
|
-
</Button>
|
|
105
|
-
<Button onClick={onGatewayChange} color="primary" disabled={loading || !url} variant="contained" autoFocus>
|
|
106
|
-
{loading && <CircularProgress size={16} />}
|
|
107
|
-
{t('common.confirm')}
|
|
108
|
-
</Button>
|
|
109
|
-
</>
|
|
110
|
-
}
|
|
111
|
-
>
|
|
112
|
-
<div style={{ paddingTop: 12, overflowY: 'hidden' }}>
|
|
113
|
-
<DialogContentText component="div">
|
|
114
|
-
<Typography component="div">
|
|
115
|
-
<TextField
|
|
116
|
-
label={t('storage.spaces.gateway.add.label')}
|
|
117
|
-
autoComplete="off"
|
|
118
|
-
variant="outlined"
|
|
119
|
-
name="url"
|
|
120
|
-
fullWidth
|
|
121
|
-
value={url}
|
|
122
|
-
onChange={(e) => {
|
|
123
|
-
setErrorMessage('');
|
|
124
|
-
setUrl(e.target.value);
|
|
125
|
-
}}
|
|
126
|
-
disabled={loading}
|
|
127
|
-
error={Boolean(errorMessage)}
|
|
128
|
-
helperText={errorMessage}
|
|
129
|
-
onKeyDown={async (e) => {
|
|
130
|
-
if (e.key === 'Enter') {
|
|
131
|
-
await onGatewayChange();
|
|
132
|
-
}
|
|
133
|
-
}}
|
|
134
|
-
autoFocus
|
|
135
|
-
InputProps={{
|
|
136
|
-
endAdornment: (
|
|
137
|
-
<Tooltip title={t('storage.spaces.connect.howToGetGatewayUrl')} placement="top">
|
|
138
|
-
{/* 打开如何复制网关地址 */}
|
|
139
|
-
<Link href={withQuery(copyGatewayPageUrl, { locale })} target="_blank">
|
|
140
|
-
<HelpOutlineIcon
|
|
141
|
-
sx={{
|
|
142
|
-
ml: 0.5,
|
|
143
|
-
color: 'text.secondary',
|
|
144
|
-
cursor: 'pointer',
|
|
145
|
-
fontSize: '18px',
|
|
146
|
-
verticalAlign: '-2px',
|
|
147
|
-
}}
|
|
148
|
-
/>
|
|
149
|
-
</Link>
|
|
150
|
-
</Tooltip>
|
|
151
|
-
),
|
|
152
|
-
}}
|
|
153
|
-
/>
|
|
154
|
-
</Typography>
|
|
155
|
-
</DialogContentText>
|
|
156
|
-
</div>
|
|
157
|
-
</Dialog>
|
|
158
|
-
</>
|
|
159
|
-
);
|
|
160
|
-
}
|