@blocklet/did-space-react 0.5.81 → 0.5.83

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.
@@ -37,11 +37,11 @@ function AuthConnectTo({ options, onSuccess, ...rest }) {
37
37
  }));
38
38
  };
39
39
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
40
- options ?? JSON.stringify(options),
41
40
  /* @__PURE__ */ jsxRuntime.jsx(index.BaseConnectTo, { ...rest, onWalletClick, onGatewayConfirm }),
42
41
  /* @__PURE__ */ jsxRuntime.jsx(
43
42
  popupAuth.PopupAuth,
44
43
  {
44
+ ...options,
45
45
  ...walletOptions,
46
46
  onSuccess: handleSuccess,
47
47
  onClose: () => setWalletOptions((pre) => ({ ...pre, open: false }))
@@ -10,7 +10,7 @@ const Theme = require('@arcblock/ux/lib/Theme');
10
10
  const React = require('react');
11
11
  const axios = require('axios');
12
12
  const ahooks = require('ahooks');
13
- const compareVersions = require('compare-versions');
13
+ const semver = require('semver');
14
14
  const _package = require('../../package.json.js');
15
15
  const constants = require('../../libs/constants.js');
16
16
  const useMobile = require('../../hooks/use-mobile.js');
@@ -24,13 +24,14 @@ const spaceConnected = require('../../icons/space-connected.svg.js');
24
24
  const spaceDisconnect = require('../../icons/space-disconnect.svg.js');
25
25
  const spaceConnectError = require('../../icons/space-connect-error.svg.js');
26
26
 
27
- const expectVersion = `^${_package.version}`;
27
+ const expectVersion = `${_package.version}`;
28
28
  function Status({
29
29
  spaceUrl,
30
30
  status,
31
31
  errorCode,
32
32
  refresh,
33
33
  sx,
34
+ spaceInfo,
34
35
  ...rest
35
36
  }) {
36
37
  const { t, locale } = useLocale();
@@ -56,6 +57,7 @@ function Status({
56
57
  }),
57
58
  [locale]
58
59
  );
60
+ const spaceVersion = React.useMemo(() => spaceInfo?.version, [spaceInfo]);
59
61
  const errorStatusConfig = ahooks.useCreation(
60
62
  () => ({
61
63
  // 未知的网络错误(如超时)
@@ -94,13 +96,16 @@ function Status({
94
96
  text: /* @__PURE__ */ jsxRuntime.jsx(
95
97
  ErrorLink,
96
98
  {
97
- title: t("storage.spaces.error.incompatible"),
99
+ title: t("storage.spaces.error.incompatible", {
100
+ spaceVersion,
101
+ expectVersion
102
+ }),
98
103
  url: ufo.joinURL(new URL(spaceUrl).origin, ".well-known/service/admin/components")
99
104
  }
100
105
  )
101
106
  }
102
107
  }),
103
- [locale]
108
+ [locale, spaceVersion]
104
109
  );
105
110
  const { icon, text } = status === index.SpaceStatus.UNAVAILABLE ? errorStatusConfig[errorCode] : statusConfig[status];
106
111
  React.useEffect(() => {
@@ -177,7 +182,7 @@ function SpaceCard({ endpoint, selected = false, compat, action, className, deps
177
182
  } else if (spaceInfo) {
178
183
  spaceName = spaceInfo.name;
179
184
  const spaceVersion = spaceInfo.version;
180
- const isIncompatible = !spaceVersion || !compareVersions.satisfies(spaceVersion, expectVersion);
185
+ const isIncompatible = !spaceVersion || semver.major(expectVersion) !== semver.major(spaceVersion);
181
186
  if (isIncompatible) {
182
187
  spaceStatus.current = index.SpaceStatus.UNAVAILABLE;
183
188
  errorCode = constants.SPACE_CONNECT_ERROR_CODE.INCOMPATIBLE;
@@ -241,6 +246,7 @@ function SpaceCard({ endpoint, selected = false, compat, action, className, deps
241
246
  status: spaceStatus.current,
242
247
  errorCode,
243
248
  refresh,
249
+ spaceInfo,
244
250
  sx: { mr: 1 }
245
251
  }
246
252
  )
@@ -271,6 +277,7 @@ function SpaceCard({ endpoint, selected = false, compat, action, className, deps
271
277
  status: spaceStatus.current,
272
278
  errorCode,
273
279
  refresh,
280
+ spaceInfo,
274
281
  flexShrink: 0
275
282
  }
276
283
  ),
@@ -1,4 +1,4 @@
1
- type SpaceInfo = {
1
+ export type SpaceInfo = {
2
2
  version: string;
3
3
  name: string;
4
4
  subscriptionId: string;
@@ -10,4 +10,3 @@ export default function useSpaceInfo({ endpoint, deps }: {
10
10
  endpoint: string;
11
11
  deps?: any[];
12
12
  }): import("ahooks/lib/useRequest/src/types").Result<SpaceInfo | undefined, any[]>;
13
- export {};
@@ -42,7 +42,7 @@ const en = flat.flatten({
42
42
  unitLimit: "DID Spaces free quota has been used up, click this link to pay for the upgrade",
43
43
  corsBlocked: "The connection request may fail due to CORS restrictions:\n1. Please contact the DID Space administrator to verify the relevant configuration.\n2. If you are the administrator, click the link below to view the detailed setup guide and resolve the issue.",
44
44
  networkError: "Network error",
45
- incompatible: "The current DID Spaces version is incompatible. Please contact your administrator to make adjustments. \nIf you are the administrator, click the link below to proceed."
45
+ incompatible: "The current connection of DID Spaces version ({spaceVersion}) is not compatible with the component version ({expectVersion}). Please contact the administrator for adjustments.\nIf you are the administrator, you can click the link below to take action."
46
46
  },
47
47
  gateway: {
48
48
  add: {
@@ -42,7 +42,7 @@ const zh = flat.flatten({
42
42
  unitLimit: "DID Spaces \u514D\u8D39\u989D\u5EA6\u5DF2\u7528\u5B8C\uFF0C\u70B9\u51FB\u6B64\u94FE\u63A5\u4ED8\u8D39\u5347\u7EA7",
43
43
  corsBlocked: "\u8FDE\u63A5\u8BF7\u6C42\u53EF\u80FD\u56E0 CORS \u9650\u5236\u800C\u5931\u8D25\uFF1A\n1. \u8BF7\u8054\u7CFB DID Space \u7BA1\u7406\u5458\u786E\u8BA4\u76F8\u5173\u914D\u7F6E\u662F\u5426\u6B63\u786E\u3002\n2. \u5982\u679C\u60A8\u662F\u7BA1\u7406\u5458\uFF0C\u53EF\u4EE5\u70B9\u51FB\u4E0B\u65B9\u94FE\u63A5\uFF0C\u67E5\u770B\u8BE6\u7EC6\u7684\u914D\u7F6E\u6307\u5357\u5E76\u89E3\u51B3\u95EE\u9898\u3002",
44
44
  networkError: "\u7F51\u7EDC\u9519\u8BEF",
45
- incompatible: "\u5F53\u524D DID Spaces \u7248\u672C\u4E0D\u517C\u5BB9\u3002\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u8FDB\u884C\u8C03\u6574\u3002\n\u5982\u679C\u60A8\u662F\u7BA1\u7406\u5458\uFF0C\u53EF\u4EE5\u5355\u51FB\u4E0B\u9762\u7684\u94FE\u63A5\u8FDB\u884C\u64CD\u4F5C\u3002"
45
+ incompatible: "\u5F53\u524D\u8FDE\u63A5\u7684 DID Spaces \u7248\u672C({spaceVersion}) \u4E0E\u7EC4\u4EF6\u7248\u672C({expectVersion})\u4E0D\u517C\u5BB9\u3002\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u8FDB\u884C\u8C03\u6574\u3002\n\u5982\u679C\u60A8\u662F\u7BA1\u7406\u5458\uFF0C\u53EF\u4EE5\u5355\u51FB\u4E0B\u9762\u7684\u94FE\u63A5\u8FDB\u884C\u64CD\u4F5C\u3002"
46
46
  },
47
47
  gateway: {
48
48
  add: {
@@ -1,5 +1,5 @@
1
1
  'use strict';
2
2
 
3
- const version = "0.5.81";
3
+ const version = "0.5.83";
4
4
 
5
5
  exports.version = version;
@@ -35,11 +35,11 @@ function AuthConnectTo({ options, onSuccess, ...rest }) {
35
35
  }));
36
36
  };
37
37
  return /* @__PURE__ */ jsxs(Fragment, { children: [
38
- options ?? JSON.stringify(options),
39
38
  /* @__PURE__ */ jsx(BaseConnectTo, { ...rest, onWalletClick, onGatewayConfirm }),
40
39
  /* @__PURE__ */ jsx(
41
40
  PopupAuth,
42
41
  {
42
+ ...options,
43
43
  ...walletOptions,
44
44
  onSuccess: handleSuccess,
45
45
  onClose: () => setWalletOptions((pre) => ({ ...pre, open: false }))
@@ -5,10 +5,10 @@ import { Box, Stack, Tooltip, Link, Skeleton } from '@mui/material';
5
5
  import OpenInNewIcon from '@mui/icons-material/OpenInNew';
6
6
  import DidAddress from '@arcblock/ux/lib/DID';
7
7
  import { styled } from '@arcblock/ux/lib/Theme';
8
- import { useState, useRef, useEffect } from 'react';
8
+ import { useState, useRef, useMemo, useEffect } from 'react';
9
9
  import { AxiosError } from 'axios';
10
10
  import { useCreation } from 'ahooks';
11
- import { satisfies } from 'compare-versions';
11
+ import semver from 'semver';
12
12
  import { version } from '../../package.json.js';
13
13
  import { SPACE_CONNECT_ERROR_CODE, fixCorsErrorPageUrl } from '../../libs/constants.js';
14
14
  import useMobile from '../../hooks/use-mobile.js';
@@ -22,13 +22,14 @@ import SvgSpaceConnected from '../../icons/space-connected.svg.js';
22
22
  import SvgSpaceDisconnect from '../../icons/space-disconnect.svg.js';
23
23
  import SvgSpaceConnectError from '../../icons/space-connect-error.svg.js';
24
24
 
25
- const expectVersion = `^${version}`;
25
+ const expectVersion = `${version}`;
26
26
  function Status({
27
27
  spaceUrl,
28
28
  status,
29
29
  errorCode,
30
30
  refresh,
31
31
  sx,
32
+ spaceInfo,
32
33
  ...rest
33
34
  }) {
34
35
  const { t, locale } = useLocale();
@@ -54,6 +55,7 @@ function Status({
54
55
  }),
55
56
  [locale]
56
57
  );
58
+ const spaceVersion = useMemo(() => spaceInfo?.version, [spaceInfo]);
57
59
  const errorStatusConfig = useCreation(
58
60
  () => ({
59
61
  // 未知的网络错误(如超时)
@@ -92,13 +94,16 @@ function Status({
92
94
  text: /* @__PURE__ */ jsx(
93
95
  ErrorLink,
94
96
  {
95
- title: t("storage.spaces.error.incompatible"),
97
+ title: t("storage.spaces.error.incompatible", {
98
+ spaceVersion,
99
+ expectVersion
100
+ }),
96
101
  url: joinURL(new URL(spaceUrl).origin, ".well-known/service/admin/components")
97
102
  }
98
103
  )
99
104
  }
100
105
  }),
101
- [locale]
106
+ [locale, spaceVersion]
102
107
  );
103
108
  const { icon, text } = status === SpaceStatus.UNAVAILABLE ? errorStatusConfig[errorCode] : statusConfig[status];
104
109
  useEffect(() => {
@@ -175,7 +180,7 @@ function SpaceCard({ endpoint, selected = false, compat, action, className, deps
175
180
  } else if (spaceInfo) {
176
181
  spaceName = spaceInfo.name;
177
182
  const spaceVersion = spaceInfo.version;
178
- const isIncompatible = !spaceVersion || !satisfies(spaceVersion, expectVersion);
183
+ const isIncompatible = !spaceVersion || semver.major(expectVersion) !== semver.major(spaceVersion);
179
184
  if (isIncompatible) {
180
185
  spaceStatus.current = SpaceStatus.UNAVAILABLE;
181
186
  errorCode = SPACE_CONNECT_ERROR_CODE.INCOMPATIBLE;
@@ -239,6 +244,7 @@ function SpaceCard({ endpoint, selected = false, compat, action, className, deps
239
244
  status: spaceStatus.current,
240
245
  errorCode,
241
246
  refresh,
247
+ spaceInfo,
242
248
  sx: { mr: 1 }
243
249
  }
244
250
  )
@@ -269,6 +275,7 @@ function SpaceCard({ endpoint, selected = false, compat, action, className, deps
269
275
  status: spaceStatus.current,
270
276
  errorCode,
271
277
  refresh,
278
+ spaceInfo,
272
279
  flexShrink: 0
273
280
  }
274
281
  ),
@@ -1,4 +1,4 @@
1
- type SpaceInfo = {
1
+ export type SpaceInfo = {
2
2
  version: string;
3
3
  name: string;
4
4
  subscriptionId: string;
@@ -10,4 +10,3 @@ export default function useSpaceInfo({ endpoint, deps }: {
10
10
  endpoint: string;
11
11
  deps?: any[];
12
12
  }): import("ahooks/lib/useRequest/src/types").Result<SpaceInfo | undefined, any[]>;
13
- export {};
@@ -40,7 +40,7 @@ const en = flatten({
40
40
  unitLimit: "DID Spaces free quota has been used up, click this link to pay for the upgrade",
41
41
  corsBlocked: "The connection request may fail due to CORS restrictions:\n1. Please contact the DID Space administrator to verify the relevant configuration.\n2. If you are the administrator, click the link below to view the detailed setup guide and resolve the issue.",
42
42
  networkError: "Network error",
43
- incompatible: "The current DID Spaces version is incompatible. Please contact your administrator to make adjustments. \nIf you are the administrator, click the link below to proceed."
43
+ incompatible: "The current connection of DID Spaces version ({spaceVersion}) is not compatible with the component version ({expectVersion}). Please contact the administrator for adjustments.\nIf you are the administrator, you can click the link below to take action."
44
44
  },
45
45
  gateway: {
46
46
  add: {
@@ -40,7 +40,7 @@ const zh = flatten({
40
40
  unitLimit: "DID Spaces \u514D\u8D39\u989D\u5EA6\u5DF2\u7528\u5B8C\uFF0C\u70B9\u51FB\u6B64\u94FE\u63A5\u4ED8\u8D39\u5347\u7EA7",
41
41
  corsBlocked: "\u8FDE\u63A5\u8BF7\u6C42\u53EF\u80FD\u56E0 CORS \u9650\u5236\u800C\u5931\u8D25\uFF1A\n1. \u8BF7\u8054\u7CFB DID Space \u7BA1\u7406\u5458\u786E\u8BA4\u76F8\u5173\u914D\u7F6E\u662F\u5426\u6B63\u786E\u3002\n2. \u5982\u679C\u60A8\u662F\u7BA1\u7406\u5458\uFF0C\u53EF\u4EE5\u70B9\u51FB\u4E0B\u65B9\u94FE\u63A5\uFF0C\u67E5\u770B\u8BE6\u7EC6\u7684\u914D\u7F6E\u6307\u5357\u5E76\u89E3\u51B3\u95EE\u9898\u3002",
42
42
  networkError: "\u7F51\u7EDC\u9519\u8BEF",
43
- incompatible: "\u5F53\u524D DID Spaces \u7248\u672C\u4E0D\u517C\u5BB9\u3002\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u8FDB\u884C\u8C03\u6574\u3002\n\u5982\u679C\u60A8\u662F\u7BA1\u7406\u5458\uFF0C\u53EF\u4EE5\u5355\u51FB\u4E0B\u9762\u7684\u94FE\u63A5\u8FDB\u884C\u64CD\u4F5C\u3002"
43
+ incompatible: "\u5F53\u524D\u8FDE\u63A5\u7684 DID Spaces \u7248\u672C({spaceVersion}) \u4E0E\u7EC4\u4EF6\u7248\u672C({expectVersion})\u4E0D\u517C\u5BB9\u3002\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u8FDB\u884C\u8C03\u6574\u3002\n\u5982\u679C\u60A8\u662F\u7BA1\u7406\u5458\uFF0C\u53EF\u4EE5\u5355\u51FB\u4E0B\u9762\u7684\u94FE\u63A5\u8FDB\u884C\u64CD\u4F5C\u3002"
44
44
  },
45
45
  gateway: {
46
46
  add: {
@@ -1,3 +1,3 @@
1
- const version = "0.5.81";
1
+ const version = "0.5.83";
2
2
 
3
3
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/did-space-react",
3
- "version": "0.5.81",
3
+ "version": "0.5.83",
4
4
  "description": "Reusable react components for did space",
5
5
  "keywords": [
6
6
  "react",
@@ -84,19 +84,19 @@
84
84
  }
85
85
  },
86
86
  "dependencies": {
87
- "@arcblock/did": "^1.18.161",
88
- "@mui/icons-material": "^5.16.11",
89
- "@mui/lab": "^5.0.0-alpha.174",
90
- "@mui/material": "^5.16.11",
91
- "@mui/system": "^5.16.8",
87
+ "@arcblock/did": "^1.18.162",
88
+ "@mui/icons-material": "^5.16.12",
89
+ "@mui/lab": "^5.0.0-alpha.175",
90
+ "@mui/material": "^5.16.12",
91
+ "@mui/system": "^5.16.12",
92
92
  "ahooks": "^3.8.4",
93
93
  "axios": "^1.7.9",
94
- "compare-versions": "^6.1.1",
95
94
  "flat": "^5.0.2",
96
95
  "is-url": "^1.2.4",
97
96
  "lodash": "^4.17.21",
98
97
  "p-wait-for": "3",
99
98
  "react-error-boundary": "^4.1.2",
99
+ "semver": "^7.6.3",
100
100
  "ufo": "^1.5.4"
101
101
  },
102
102
  "peerDependencies": {
@@ -110,16 +110,16 @@
110
110
  "access": "public"
111
111
  },
112
112
  "devDependencies": {
113
- "@arcblock/did-connect": "^2.10.89",
113
+ "@arcblock/did-connect": "^2.11.1",
114
114
  "@arcblock/eslint-config-ts": "^0.3.3",
115
- "@arcblock/ux": "^2.10.89",
115
+ "@arcblock/ux": "^2.11.1",
116
116
  "@babel/cli": "^7.26.4",
117
117
  "@babel/core": "^7.26.0",
118
118
  "@babel/preset-env": "^7.26.0",
119
119
  "@babel/preset-react": "^7.26.3",
120
120
  "@babel/preset-typescript": "^7.26.0",
121
- "@blocklet/js-sdk": "^1.16.34-beta-20241216-230644-e9ec07d8",
122
- "@blocklet/sdk": "^1.16.34-beta-20241216-230644-e9ec07d8",
121
+ "@blocklet/js-sdk": "^1.16.34-beta-20241218-045149-150af879",
122
+ "@blocklet/sdk": "^1.16.34-beta-20241218-045149-150af879",
123
123
  "@storybook/addon-essentials": "^7.6.20",
124
124
  "@storybook/addon-interactions": "^7.6.20",
125
125
  "@storybook/addon-links": "^7.6.20",
@@ -137,6 +137,7 @@
137
137
  "copyfiles": "^2.4.1",
138
138
  "eslint": "^8.57.1",
139
139
  "glob": "^10.4.5",
140
+ "nodemon": "^3.1.9",
140
141
  "prettier": "^2.8.8",
141
142
  "react": "^18.3.1",
142
143
  "react-dom": "^18.3.1",
@@ -150,5 +151,5 @@
150
151
  "vite-plugin-node-polyfills": "^0.22.0",
151
152
  "vitest": "^2.1.8"
152
153
  },
153
- "gitHead": "3999757a4be1054b55354bf94a782b4c4a95ae32"
154
+ "gitHead": "b89be361bbc875a7c9051c9209f327ed6a6dd4b4"
154
155
  }