@blocklet/did-space-react 1.0.64 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/auth-connect-to/index.d.ts +2 -2
- package/dist/cjs/components/auth-connect-to/index.js +13 -6
- package/dist/cjs/components/base-connect-to/index.js +20 -13
- package/dist/cjs/components/space-card/index.js +90 -43
- package/dist/cjs/libs/util.js +7 -4
- package/dist/cjs/package.json.js +1 -1
- package/dist/es/components/auth-connect-to/index.d.ts +2 -2
- package/dist/es/components/auth-connect-to/index.js +13 -6
- package/dist/es/components/base-connect-to/index.js +20 -13
- package/dist/es/components/space-card/index.js +90 -43
- package/dist/es/libs/util.js +7 -4
- package/dist/es/package.json.js +1 -1
- package/package.json +23 -23
|
@@ -31,7 +31,7 @@ export { BaseAuth as WalletAuth, type BaseAuthProps as WalletAuthProps };
|
|
|
31
31
|
export { GatewayAuth, type GatewayAuthProps };
|
|
32
32
|
export type Options = DIDSpaceConnectOptions;
|
|
33
33
|
export type AuthConnectToProps = DIDSpaceConnectProps;
|
|
34
|
-
export declare function AuthConnectTo(props: Omit<AuthConnectToProps, 'onSuccess'> & {
|
|
34
|
+
export declare function AuthConnectTo({ ...props }: Omit<AuthConnectToProps, 'onSuccess'> & {
|
|
35
35
|
onSuccess?: (response: Record<string, string>, decrypt: Function) => Promise<void>;
|
|
36
36
|
}): import("react/jsx-runtime").JSX.Element;
|
|
37
37
|
export interface ReConnectProps extends Omit<ButtonProps, 'onClick' | 'onError'> {
|
|
@@ -43,7 +43,7 @@ export interface ReConnectProps extends Omit<ButtonProps, 'onClick' | 'onError'>
|
|
|
43
43
|
onConnected?: (spaceGateway: DIDSpaceGateway) => Promise<void>;
|
|
44
44
|
onError?: (error: Error) => void;
|
|
45
45
|
}
|
|
46
|
-
export declare function ReConnect(props: ReConnectProps): import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
export declare function ReConnect({ ...props }: ReConnectProps): import("react/jsx-runtime").JSX.Element;
|
|
47
47
|
export interface SessionConnectToProps extends Omit<BaseConnectToProps, 'onError'> {
|
|
48
48
|
session: {
|
|
49
49
|
refresh: Function;
|
|
@@ -12,14 +12,14 @@ const popupAuth = require('./popup-auth.js');
|
|
|
12
12
|
const useLocale = require('../../hooks/use-locale.js');
|
|
13
13
|
|
|
14
14
|
function DIDSpaceConnect({
|
|
15
|
-
session,
|
|
15
|
+
session = void 0,
|
|
16
16
|
reconnect = false,
|
|
17
17
|
spaceDid = "",
|
|
18
18
|
spaceGatewayUrl = "",
|
|
19
19
|
options = {},
|
|
20
20
|
connectScope = "user",
|
|
21
|
-
onSuccess,
|
|
22
|
-
onError,
|
|
21
|
+
onSuccess = void 0,
|
|
22
|
+
onError = void 0,
|
|
23
23
|
...rest
|
|
24
24
|
}) {
|
|
25
25
|
const { t } = useLocale();
|
|
@@ -120,11 +120,13 @@ function DIDSpaceConnect({
|
|
|
120
120
|
}
|
|
121
121
|
DIDSpaceConnect.WalletAuth = baseAuth.BaseAuth;
|
|
122
122
|
DIDSpaceConnect.GatewayAuth = gatewayAuth.GatewayAuth;
|
|
123
|
-
function AuthConnectTo(
|
|
123
|
+
function AuthConnectTo({
|
|
124
|
+
...props
|
|
125
|
+
}) {
|
|
124
126
|
const { onSuccess, ...rest } = props;
|
|
125
127
|
return /* @__PURE__ */ jsxRuntime.jsx(DIDSpaceConnect, { ...rest, onSuccess: async ({ response, decrypt }) => await onSuccess?.(response, decrypt) });
|
|
126
128
|
}
|
|
127
|
-
function ReConnect(props) {
|
|
129
|
+
function ReConnect({ ...props }) {
|
|
128
130
|
const { session, spaceDid, spaceGatewayUrl, onConnected, onError, ...rest } = props;
|
|
129
131
|
return (
|
|
130
132
|
// @ts-ignore
|
|
@@ -142,7 +144,12 @@ function ReConnect(props) {
|
|
|
142
144
|
)
|
|
143
145
|
);
|
|
144
146
|
}
|
|
145
|
-
function SessionConnectTo({
|
|
147
|
+
function SessionConnectTo({
|
|
148
|
+
session,
|
|
149
|
+
onConnected = void 0,
|
|
150
|
+
onError = void 0,
|
|
151
|
+
...rest
|
|
152
|
+
}) {
|
|
146
153
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
147
154
|
DIDSpaceConnect,
|
|
148
155
|
{
|
|
@@ -14,7 +14,12 @@ const util = require('../../libs/util.js');
|
|
|
14
14
|
const gateway = require('../../libs/gateway.js');
|
|
15
15
|
const useLocale = require('../../hooks/use-locale.js');
|
|
16
16
|
|
|
17
|
-
function BaseConnectTo({
|
|
17
|
+
function BaseConnectTo({
|
|
18
|
+
sx,
|
|
19
|
+
onWalletClick = void 0,
|
|
20
|
+
onGatewayConfirm = void 0,
|
|
21
|
+
...rest
|
|
22
|
+
}) {
|
|
18
23
|
const { t, locale } = useLocale();
|
|
19
24
|
const [url, setUrl] = React.useState("");
|
|
20
25
|
const [loading, setLoading] = React.useState(false);
|
|
@@ -127,19 +132,21 @@ function BaseConnectTo({ sx, onWalletClick, onGatewayConfirm, ...rest }) {
|
|
|
127
132
|
}
|
|
128
133
|
},
|
|
129
134
|
autoFocus: true,
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
135
|
+
slotProps: {
|
|
136
|
+
input: {
|
|
137
|
+
endAdornment: /* @__PURE__ */ jsxRuntime.jsx(material.Tooltip, { title: t("storage.spaces.connect.howToGetGatewayUrl"), placement: "top", children: /* @__PURE__ */ jsxRuntime.jsx(material.Link, { href: ufo.withQuery(constants.copyGatewayPageUrl, { locale }), target: "_blank", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
138
|
+
HelpOutlineIcon,
|
|
139
|
+
{
|
|
140
|
+
sx: {
|
|
141
|
+
ml: 0.5,
|
|
142
|
+
color: "text.secondary",
|
|
143
|
+
cursor: "pointer",
|
|
144
|
+
fontSize: "18px",
|
|
145
|
+
verticalAlign: "-2px"
|
|
146
|
+
}
|
|
140
147
|
}
|
|
141
|
-
}
|
|
142
|
-
|
|
148
|
+
) }) })
|
|
149
|
+
}
|
|
143
150
|
}
|
|
144
151
|
}
|
|
145
152
|
) }),
|
|
@@ -204,8 +204,8 @@ function ErrorLink({ title = "", description, url }) {
|
|
|
204
204
|
function DIDSpaceConnection({
|
|
205
205
|
endpoint,
|
|
206
206
|
selected = false,
|
|
207
|
-
compat,
|
|
208
|
-
action,
|
|
207
|
+
compat = void 0,
|
|
208
|
+
action = null,
|
|
209
209
|
footer = false,
|
|
210
210
|
className,
|
|
211
211
|
deps = [],
|
|
@@ -306,28 +306,16 @@ function DIDSpaceConnection({
|
|
|
306
306
|
}),
|
|
307
307
|
...rest,
|
|
308
308
|
children: [
|
|
309
|
-
isCompact && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
{
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
sx: { ml: "4px" }
|
|
320
|
-
}
|
|
321
|
-
),
|
|
322
|
-
/* @__PURE__ */ jsxRuntime.jsx(material.Box, { flex: 1 }),
|
|
323
|
-
renderAction()
|
|
324
|
-
] }),
|
|
325
|
-
/* @__PURE__ */ jsxRuntime.jsxs(material.Box, { display: "flex", alignItems: "center", children: [
|
|
326
|
-
/* @__PURE__ */ jsxRuntime.jsx(index$1.DIDSpaceNFTPreview, { src: util.getSpaceNftDisplayUrlFromEndpoint(endpoint), width: "72px", height: "72px" }),
|
|
327
|
-
/* @__PURE__ */ jsxRuntime.jsxs(material.Stack, { ml: 2, flex: 1, spacing: 1, minWidth: 0, children: [
|
|
328
|
-
/* @__PURE__ */ jsxRuntime.jsxs(material.Box, { display: "flex", alignItems: "center", sx: { whiteSpace: "nowrap" }, children: [
|
|
329
|
-
spaceName && /* @__PURE__ */ jsxRuntime.jsx(material.Box, { className: "space-name", children: spaceName }),
|
|
330
|
-
!isCompact && selected && /* @__PURE__ */ jsxRuntime.jsx(
|
|
309
|
+
isCompact && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
310
|
+
material.Box,
|
|
311
|
+
{
|
|
312
|
+
sx: {
|
|
313
|
+
display: "flex",
|
|
314
|
+
alignItems: "center",
|
|
315
|
+
marginBottom: 1
|
|
316
|
+
},
|
|
317
|
+
children: [
|
|
318
|
+
selected && /* @__PURE__ */ jsxRuntime.jsx(
|
|
331
319
|
Status,
|
|
332
320
|
{
|
|
333
321
|
spaceUrl,
|
|
@@ -335,28 +323,87 @@ function DIDSpaceConnection({
|
|
|
335
323
|
errorCode,
|
|
336
324
|
refresh,
|
|
337
325
|
spaceInfo,
|
|
338
|
-
|
|
326
|
+
flexShrink: 0,
|
|
327
|
+
sx: { ml: "4px" }
|
|
339
328
|
}
|
|
340
|
-
)
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
size: 14,
|
|
347
|
-
compact: true,
|
|
348
|
-
responsive: false,
|
|
349
|
-
did: spaceDid,
|
|
350
|
-
sx: {
|
|
351
|
-
".did-address-text": {
|
|
352
|
-
color: "text.secondary"
|
|
329
|
+
),
|
|
330
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
331
|
+
material.Box,
|
|
332
|
+
{
|
|
333
|
+
sx: {
|
|
334
|
+
flex: 1
|
|
353
335
|
}
|
|
354
336
|
}
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
337
|
+
),
|
|
338
|
+
renderAction()
|
|
339
|
+
]
|
|
340
|
+
}
|
|
341
|
+
),
|
|
342
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
343
|
+
material.Box,
|
|
344
|
+
{
|
|
345
|
+
sx: {
|
|
346
|
+
display: "flex",
|
|
347
|
+
alignItems: "center"
|
|
348
|
+
},
|
|
349
|
+
children: [
|
|
350
|
+
/* @__PURE__ */ jsxRuntime.jsx(index$1.DIDSpaceNFTPreview, { src: util.getSpaceNftDisplayUrlFromEndpoint(endpoint), width: "72px", height: "72px" }),
|
|
351
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
352
|
+
material.Stack,
|
|
353
|
+
{
|
|
354
|
+
spacing: 1,
|
|
355
|
+
sx: {
|
|
356
|
+
ml: 2,
|
|
357
|
+
flex: 1,
|
|
358
|
+
minWidth: 0
|
|
359
|
+
},
|
|
360
|
+
children: [
|
|
361
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
362
|
+
material.Box,
|
|
363
|
+
{
|
|
364
|
+
sx: {
|
|
365
|
+
display: "flex",
|
|
366
|
+
alignItems: "center",
|
|
367
|
+
whiteSpace: "nowrap"
|
|
368
|
+
},
|
|
369
|
+
children: [
|
|
370
|
+
spaceName && /* @__PURE__ */ jsxRuntime.jsx(material.Box, { className: "space-name", children: spaceName }),
|
|
371
|
+
!isCompact && selected && /* @__PURE__ */ jsxRuntime.jsx(
|
|
372
|
+
Status,
|
|
373
|
+
{
|
|
374
|
+
spaceUrl,
|
|
375
|
+
status: spaceStatus.current,
|
|
376
|
+
errorCode,
|
|
377
|
+
refresh,
|
|
378
|
+
spaceInfo,
|
|
379
|
+
sx: { mr: 1 }
|
|
380
|
+
}
|
|
381
|
+
)
|
|
382
|
+
]
|
|
383
|
+
}
|
|
384
|
+
),
|
|
385
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
386
|
+
DidAddress,
|
|
387
|
+
{
|
|
388
|
+
copyable: false,
|
|
389
|
+
size: 14,
|
|
390
|
+
compact: true,
|
|
391
|
+
responsive: false,
|
|
392
|
+
did: spaceDid,
|
|
393
|
+
sx: {
|
|
394
|
+
".did-address-text": {
|
|
395
|
+
color: "text.secondary"
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
)
|
|
400
|
+
]
|
|
401
|
+
}
|
|
402
|
+
),
|
|
403
|
+
!isCompact && renderAction()
|
|
404
|
+
]
|
|
405
|
+
}
|
|
406
|
+
),
|
|
360
407
|
renderFooter()
|
|
361
408
|
]
|
|
362
409
|
}
|
package/dist/cjs/libs/util.js
CHANGED
|
@@ -78,10 +78,13 @@ function decryptSpaceGateway(response, decrypt) {
|
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
80
|
function isCorsBlockedError(error) {
|
|
81
|
-
return
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
81
|
+
return (
|
|
82
|
+
// 无响应
|
|
83
|
+
!error.response && // 是网络错误
|
|
84
|
+
error.message === "Network Error" && // 非超时引起
|
|
85
|
+
error.code !== "ECONNABORTED" && // 跨域了
|
|
86
|
+
new URL(error.config.url).origin !== window.location.origin
|
|
87
|
+
);
|
|
85
88
|
}
|
|
86
89
|
function t(key, localeOrData, data = {}) {
|
|
87
90
|
const locale = typeof localeOrData === "string" ? localeOrData : "en";
|
package/dist/cjs/package.json.js
CHANGED
|
@@ -31,7 +31,7 @@ export { BaseAuth as WalletAuth, type BaseAuthProps as WalletAuthProps };
|
|
|
31
31
|
export { GatewayAuth, type GatewayAuthProps };
|
|
32
32
|
export type Options = DIDSpaceConnectOptions;
|
|
33
33
|
export type AuthConnectToProps = DIDSpaceConnectProps;
|
|
34
|
-
export declare function AuthConnectTo(props: Omit<AuthConnectToProps, 'onSuccess'> & {
|
|
34
|
+
export declare function AuthConnectTo({ ...props }: Omit<AuthConnectToProps, 'onSuccess'> & {
|
|
35
35
|
onSuccess?: (response: Record<string, string>, decrypt: Function) => Promise<void>;
|
|
36
36
|
}): import("react/jsx-runtime").JSX.Element;
|
|
37
37
|
export interface ReConnectProps extends Omit<ButtonProps, 'onClick' | 'onError'> {
|
|
@@ -43,7 +43,7 @@ export interface ReConnectProps extends Omit<ButtonProps, 'onClick' | 'onError'>
|
|
|
43
43
|
onConnected?: (spaceGateway: DIDSpaceGateway) => Promise<void>;
|
|
44
44
|
onError?: (error: Error) => void;
|
|
45
45
|
}
|
|
46
|
-
export declare function ReConnect(props: ReConnectProps): import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
export declare function ReConnect({ ...props }: ReConnectProps): import("react/jsx-runtime").JSX.Element;
|
|
47
47
|
export interface SessionConnectToProps extends Omit<BaseConnectToProps, 'onError'> {
|
|
48
48
|
session: {
|
|
49
49
|
refresh: Function;
|
|
@@ -10,14 +10,14 @@ import { PopupAuth } from './popup-auth.js';
|
|
|
10
10
|
import useLocale from '../../hooks/use-locale.js';
|
|
11
11
|
|
|
12
12
|
function DIDSpaceConnect({
|
|
13
|
-
session,
|
|
13
|
+
session = void 0,
|
|
14
14
|
reconnect = false,
|
|
15
15
|
spaceDid = "",
|
|
16
16
|
spaceGatewayUrl = "",
|
|
17
17
|
options = {},
|
|
18
18
|
connectScope = "user",
|
|
19
|
-
onSuccess,
|
|
20
|
-
onError,
|
|
19
|
+
onSuccess = void 0,
|
|
20
|
+
onError = void 0,
|
|
21
21
|
...rest
|
|
22
22
|
}) {
|
|
23
23
|
const { t } = useLocale();
|
|
@@ -118,11 +118,13 @@ function DIDSpaceConnect({
|
|
|
118
118
|
}
|
|
119
119
|
DIDSpaceConnect.WalletAuth = BaseAuth;
|
|
120
120
|
DIDSpaceConnect.GatewayAuth = GatewayAuth;
|
|
121
|
-
function AuthConnectTo(
|
|
121
|
+
function AuthConnectTo({
|
|
122
|
+
...props
|
|
123
|
+
}) {
|
|
122
124
|
const { onSuccess, ...rest } = props;
|
|
123
125
|
return /* @__PURE__ */ jsx(DIDSpaceConnect, { ...rest, onSuccess: async ({ response, decrypt }) => await onSuccess?.(response, decrypt) });
|
|
124
126
|
}
|
|
125
|
-
function ReConnect(props) {
|
|
127
|
+
function ReConnect({ ...props }) {
|
|
126
128
|
const { session, spaceDid, spaceGatewayUrl, onConnected, onError, ...rest } = props;
|
|
127
129
|
return (
|
|
128
130
|
// @ts-ignore
|
|
@@ -140,7 +142,12 @@ function ReConnect(props) {
|
|
|
140
142
|
)
|
|
141
143
|
);
|
|
142
144
|
}
|
|
143
|
-
function SessionConnectTo({
|
|
145
|
+
function SessionConnectTo({
|
|
146
|
+
session,
|
|
147
|
+
onConnected = void 0,
|
|
148
|
+
onError = void 0,
|
|
149
|
+
...rest
|
|
150
|
+
}) {
|
|
144
151
|
return /* @__PURE__ */ jsx(
|
|
145
152
|
DIDSpaceConnect,
|
|
146
153
|
{
|
|
@@ -12,7 +12,12 @@ import { extraDIDSpacesCoreUrl, getSpaceDidFromSpaceUrl, isCorsBlockedError } fr
|
|
|
12
12
|
import { getSpaceGatewayUrl, verifySpaceUrl } from '../../libs/gateway.js';
|
|
13
13
|
import useLocale from '../../hooks/use-locale.js';
|
|
14
14
|
|
|
15
|
-
function BaseConnectTo({
|
|
15
|
+
function BaseConnectTo({
|
|
16
|
+
sx,
|
|
17
|
+
onWalletClick = void 0,
|
|
18
|
+
onGatewayConfirm = void 0,
|
|
19
|
+
...rest
|
|
20
|
+
}) {
|
|
16
21
|
const { t, locale } = useLocale();
|
|
17
22
|
const [url, setUrl] = useState("");
|
|
18
23
|
const [loading, setLoading] = useState(false);
|
|
@@ -125,19 +130,21 @@ function BaseConnectTo({ sx, onWalletClick, onGatewayConfirm, ...rest }) {
|
|
|
125
130
|
}
|
|
126
131
|
},
|
|
127
132
|
autoFocus: true,
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
133
|
+
slotProps: {
|
|
134
|
+
input: {
|
|
135
|
+
endAdornment: /* @__PURE__ */ jsx(Tooltip, { title: t("storage.spaces.connect.howToGetGatewayUrl"), placement: "top", children: /* @__PURE__ */ jsx(Link, { href: withQuery(copyGatewayPageUrl, { locale }), target: "_blank", children: /* @__PURE__ */ jsx(
|
|
136
|
+
HelpOutlineIcon,
|
|
137
|
+
{
|
|
138
|
+
sx: {
|
|
139
|
+
ml: 0.5,
|
|
140
|
+
color: "text.secondary",
|
|
141
|
+
cursor: "pointer",
|
|
142
|
+
fontSize: "18px",
|
|
143
|
+
verticalAlign: "-2px"
|
|
144
|
+
}
|
|
138
145
|
}
|
|
139
|
-
}
|
|
140
|
-
|
|
146
|
+
) }) })
|
|
147
|
+
}
|
|
141
148
|
}
|
|
142
149
|
}
|
|
143
150
|
) }),
|
|
@@ -202,8 +202,8 @@ function ErrorLink({ title = "", description, url }) {
|
|
|
202
202
|
function DIDSpaceConnection({
|
|
203
203
|
endpoint,
|
|
204
204
|
selected = false,
|
|
205
|
-
compat,
|
|
206
|
-
action,
|
|
205
|
+
compat = void 0,
|
|
206
|
+
action = null,
|
|
207
207
|
footer = false,
|
|
208
208
|
className,
|
|
209
209
|
deps = [],
|
|
@@ -304,28 +304,16 @@ function DIDSpaceConnection({
|
|
|
304
304
|
}),
|
|
305
305
|
...rest,
|
|
306
306
|
children: [
|
|
307
|
-
isCompact && /* @__PURE__ */ jsxs(
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
{
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
sx: { ml: "4px" }
|
|
318
|
-
}
|
|
319
|
-
),
|
|
320
|
-
/* @__PURE__ */ jsx(Box, { flex: 1 }),
|
|
321
|
-
renderAction()
|
|
322
|
-
] }),
|
|
323
|
-
/* @__PURE__ */ jsxs(Box, { display: "flex", alignItems: "center", children: [
|
|
324
|
-
/* @__PURE__ */ jsx(DIDSpaceNFTPreview, { src: getSpaceNftDisplayUrlFromEndpoint(endpoint), width: "72px", height: "72px" }),
|
|
325
|
-
/* @__PURE__ */ jsxs(Stack, { ml: 2, flex: 1, spacing: 1, minWidth: 0, children: [
|
|
326
|
-
/* @__PURE__ */ jsxs(Box, { display: "flex", alignItems: "center", sx: { whiteSpace: "nowrap" }, children: [
|
|
327
|
-
spaceName && /* @__PURE__ */ jsx(Box, { className: "space-name", children: spaceName }),
|
|
328
|
-
!isCompact && selected && /* @__PURE__ */ jsx(
|
|
307
|
+
isCompact && /* @__PURE__ */ jsxs(
|
|
308
|
+
Box,
|
|
309
|
+
{
|
|
310
|
+
sx: {
|
|
311
|
+
display: "flex",
|
|
312
|
+
alignItems: "center",
|
|
313
|
+
marginBottom: 1
|
|
314
|
+
},
|
|
315
|
+
children: [
|
|
316
|
+
selected && /* @__PURE__ */ jsx(
|
|
329
317
|
Status,
|
|
330
318
|
{
|
|
331
319
|
spaceUrl,
|
|
@@ -333,28 +321,87 @@ function DIDSpaceConnection({
|
|
|
333
321
|
errorCode,
|
|
334
322
|
refresh,
|
|
335
323
|
spaceInfo,
|
|
336
|
-
|
|
324
|
+
flexShrink: 0,
|
|
325
|
+
sx: { ml: "4px" }
|
|
337
326
|
}
|
|
338
|
-
)
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
size: 14,
|
|
345
|
-
compact: true,
|
|
346
|
-
responsive: false,
|
|
347
|
-
did: spaceDid,
|
|
348
|
-
sx: {
|
|
349
|
-
".did-address-text": {
|
|
350
|
-
color: "text.secondary"
|
|
327
|
+
),
|
|
328
|
+
/* @__PURE__ */ jsx(
|
|
329
|
+
Box,
|
|
330
|
+
{
|
|
331
|
+
sx: {
|
|
332
|
+
flex: 1
|
|
351
333
|
}
|
|
352
334
|
}
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
335
|
+
),
|
|
336
|
+
renderAction()
|
|
337
|
+
]
|
|
338
|
+
}
|
|
339
|
+
),
|
|
340
|
+
/* @__PURE__ */ jsxs(
|
|
341
|
+
Box,
|
|
342
|
+
{
|
|
343
|
+
sx: {
|
|
344
|
+
display: "flex",
|
|
345
|
+
alignItems: "center"
|
|
346
|
+
},
|
|
347
|
+
children: [
|
|
348
|
+
/* @__PURE__ */ jsx(DIDSpaceNFTPreview, { src: getSpaceNftDisplayUrlFromEndpoint(endpoint), width: "72px", height: "72px" }),
|
|
349
|
+
/* @__PURE__ */ jsxs(
|
|
350
|
+
Stack,
|
|
351
|
+
{
|
|
352
|
+
spacing: 1,
|
|
353
|
+
sx: {
|
|
354
|
+
ml: 2,
|
|
355
|
+
flex: 1,
|
|
356
|
+
minWidth: 0
|
|
357
|
+
},
|
|
358
|
+
children: [
|
|
359
|
+
/* @__PURE__ */ jsxs(
|
|
360
|
+
Box,
|
|
361
|
+
{
|
|
362
|
+
sx: {
|
|
363
|
+
display: "flex",
|
|
364
|
+
alignItems: "center",
|
|
365
|
+
whiteSpace: "nowrap"
|
|
366
|
+
},
|
|
367
|
+
children: [
|
|
368
|
+
spaceName && /* @__PURE__ */ jsx(Box, { className: "space-name", children: spaceName }),
|
|
369
|
+
!isCompact && selected && /* @__PURE__ */ jsx(
|
|
370
|
+
Status,
|
|
371
|
+
{
|
|
372
|
+
spaceUrl,
|
|
373
|
+
status: spaceStatus.current,
|
|
374
|
+
errorCode,
|
|
375
|
+
refresh,
|
|
376
|
+
spaceInfo,
|
|
377
|
+
sx: { mr: 1 }
|
|
378
|
+
}
|
|
379
|
+
)
|
|
380
|
+
]
|
|
381
|
+
}
|
|
382
|
+
),
|
|
383
|
+
/* @__PURE__ */ jsx(
|
|
384
|
+
DidAddress,
|
|
385
|
+
{
|
|
386
|
+
copyable: false,
|
|
387
|
+
size: 14,
|
|
388
|
+
compact: true,
|
|
389
|
+
responsive: false,
|
|
390
|
+
did: spaceDid,
|
|
391
|
+
sx: {
|
|
392
|
+
".did-address-text": {
|
|
393
|
+
color: "text.secondary"
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
)
|
|
398
|
+
]
|
|
399
|
+
}
|
|
400
|
+
),
|
|
401
|
+
!isCompact && renderAction()
|
|
402
|
+
]
|
|
403
|
+
}
|
|
404
|
+
),
|
|
358
405
|
renderFooter()
|
|
359
406
|
]
|
|
360
407
|
}
|
package/dist/es/libs/util.js
CHANGED
|
@@ -76,10 +76,13 @@ function decryptSpaceGateway(response, decrypt) {
|
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
78
|
function isCorsBlockedError(error) {
|
|
79
|
-
return
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
return (
|
|
80
|
+
// 无响应
|
|
81
|
+
!error.response && // 是网络错误
|
|
82
|
+
error.message === "Network Error" && // 非超时引起
|
|
83
|
+
error.code !== "ECONNABORTED" && // 跨域了
|
|
84
|
+
new URL(error.config.url).origin !== window.location.origin
|
|
85
|
+
);
|
|
83
86
|
}
|
|
84
87
|
function t(key, localeOrData, data = {}) {
|
|
85
88
|
const locale = typeof localeOrData === "string" ? localeOrData : "en";
|
package/dist/es/package.json.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/did-space-react",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Reusable react components for did space",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -80,12 +80,12 @@
|
|
|
80
80
|
}
|
|
81
81
|
},
|
|
82
82
|
"dependencies": {
|
|
83
|
-
"@arcblock/did": "^1.20.
|
|
84
|
-
"@did-space/constants": "^1.0
|
|
85
|
-
"@mui/icons-material": "^
|
|
86
|
-
"@mui/lab": "^
|
|
87
|
-
"@mui/material": "^
|
|
88
|
-
"@mui/system": "^
|
|
83
|
+
"@arcblock/did": "^1.20.15",
|
|
84
|
+
"@did-space/constants": "^1.1.0",
|
|
85
|
+
"@mui/icons-material": "^7.1.2",
|
|
86
|
+
"@mui/lab": "^7.0.0-beta.14",
|
|
87
|
+
"@mui/material": "^7.1.2",
|
|
88
|
+
"@mui/system": "^7.1.1",
|
|
89
89
|
"ahooks": "^3.8.5",
|
|
90
90
|
"axios": "^1.10.0",
|
|
91
91
|
"flat": "^5.0.2",
|
|
@@ -99,27 +99,27 @@
|
|
|
99
99
|
"xbytes": "^1.9.1"
|
|
100
100
|
},
|
|
101
101
|
"peerDependencies": {
|
|
102
|
-
"@arcblock/did-connect": "^
|
|
103
|
-
"@arcblock/ux": "^
|
|
102
|
+
"@arcblock/did-connect": "^3.0.8",
|
|
103
|
+
"@arcblock/ux": "^3.0.8",
|
|
104
104
|
"@blocklet/js-sdk": "^1.16.44",
|
|
105
105
|
"@blocklet/sdk": "^1.16.44",
|
|
106
|
-
"react": "^
|
|
106
|
+
"react": "^19.1.0"
|
|
107
107
|
},
|
|
108
108
|
"publishConfig": {
|
|
109
109
|
"access": "public"
|
|
110
110
|
},
|
|
111
111
|
"devDependencies": {
|
|
112
|
-
"@arcblock/did-connect": "^
|
|
112
|
+
"@arcblock/did-connect": "^3.0.8",
|
|
113
113
|
"@arcblock/eslint-config-ts": "^0.3.3",
|
|
114
|
-
"@arcblock/ux": "^
|
|
114
|
+
"@arcblock/ux": "^3.0.8",
|
|
115
115
|
"@babel/cli": "^7.27.2",
|
|
116
|
-
"@babel/core": "^7.27.
|
|
116
|
+
"@babel/core": "^7.27.7",
|
|
117
117
|
"@babel/preset-env": "^7.27.2",
|
|
118
118
|
"@babel/preset-react": "^7.27.1",
|
|
119
119
|
"@babel/preset-typescript": "^7.27.1",
|
|
120
120
|
"@blocklet/js-sdk": "^1.16.44",
|
|
121
121
|
"@blocklet/sdk": "^1.16.44",
|
|
122
|
-
"@did-space/core": "^1.0
|
|
122
|
+
"@did-space/core": "^1.1.0",
|
|
123
123
|
"@storybook/addon-essentials": "^7.6.20",
|
|
124
124
|
"@storybook/addon-interactions": "^7.6.20",
|
|
125
125
|
"@storybook/addon-links": "^7.6.20",
|
|
@@ -131,25 +131,25 @@
|
|
|
131
131
|
"@svgr/rollup": "^8.1.0",
|
|
132
132
|
"@types/react": "^18.3.23",
|
|
133
133
|
"@types/react-dom": "^18.3.7",
|
|
134
|
-
"@vitejs/plugin-legacy": "^
|
|
135
|
-
"@vitest/coverage-v8": "^3.2.
|
|
134
|
+
"@vitejs/plugin-legacy": "^7.0.0",
|
|
135
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
136
136
|
"babel-plugin-inline-react-svg": "^2.0.2",
|
|
137
137
|
"copyfiles": "^2.4.1",
|
|
138
138
|
"eslint": "^8.57.1",
|
|
139
139
|
"glob": "^10.4.5",
|
|
140
140
|
"nodemon": "^3.1.10",
|
|
141
141
|
"prettier": "^2.8.8",
|
|
142
|
-
"react": "^
|
|
143
|
-
"react-dom": "^
|
|
142
|
+
"react": "^19.1.0",
|
|
143
|
+
"react-dom": "^19.1.0",
|
|
144
144
|
"rollup-plugin-node-builtins": "^2.1.2",
|
|
145
145
|
"storybook": "^7.6.20",
|
|
146
146
|
"type-fest": "^4.41.0",
|
|
147
147
|
"typescript": "~5.5.4",
|
|
148
148
|
"unbuild": "^2.0.0",
|
|
149
|
-
"vite": "^
|
|
150
|
-
"vite-plugin-babel": "^1.3.
|
|
151
|
-
"vite-plugin-node-polyfills": "^0.
|
|
152
|
-
"vitest": "^3.2.
|
|
149
|
+
"vite": "^7.0.0",
|
|
150
|
+
"vite-plugin-babel": "^1.3.2",
|
|
151
|
+
"vite-plugin-node-polyfills": "^0.23.0",
|
|
152
|
+
"vitest": "^3.2.4"
|
|
153
153
|
},
|
|
154
|
-
"gitHead": "
|
|
154
|
+
"gitHead": "5b93f14e6011e4d81663549078127e4b927c5f12"
|
|
155
155
|
}
|