@abtnode/ux 1.16.22-beta-079a9053 → 1.16.22-beta-87e027a7

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.
@@ -1,5 +1,7 @@
1
+ import { getDidDomainServiceURL } from '@abtnode/util/lib/did-domain';
1
2
  import Connect from '@arcblock/did-connect/lib/Connect';
2
3
  import Button from '@arcblock/ux/lib/Button';
4
+ import Center from '@arcblock/ux/lib/Center';
3
5
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
4
6
  import Toast from '@arcblock/ux/lib/Toast';
5
7
  import IconInfo from '@mui/icons-material/InfoOutlined';
@@ -12,7 +14,8 @@ import noop from 'lodash/noop';
12
14
  import trim from 'lodash/trim';
13
15
  import PropTypes from 'prop-types';
14
16
  import useSetState from 'react-use/lib/useSetState';
15
- import joinURL from 'url-join';
17
+ import useAsync from 'react-use/lib/useAsync';
18
+ import { CircularProgress } from '@mui/material';
16
19
  import { useDomainContext } from '../../contexts/domain';
17
20
  import { useNodeContext } from '../../contexts/node';
18
21
  import { sleep, validateDomain } from '../../util';
@@ -53,9 +56,24 @@ export default function AddDomain({
53
56
  showNFTDomainAuth: false,
54
57
  showDnsTip: false
55
58
  });
56
- let nftDomainURL = '';
57
- if (info.nftDomainUrl) {
58
- nftDomainURL = joinURL(info.nftDomainUrl, '/api');
59
+ const nftDomainURLState = useAsync(() => getDidDomainServiceURL(info?.nftDomainUrl));
60
+ if (info?.nftDomainUrl && nftDomainURLState.loading) {
61
+ return /*#__PURE__*/_jsx(Box, {
62
+ ...props,
63
+ children: /*#__PURE__*/_jsx(Center, {
64
+ relative: "parent",
65
+ children: /*#__PURE__*/_jsx(CircularProgress, {})
66
+ })
67
+ });
68
+ }
69
+ if (nftDomainURLState.error) {
70
+ return /*#__PURE__*/_jsx(Box, {
71
+ ...props,
72
+ children: /*#__PURE__*/_jsx(Center, {
73
+ relative: "parent",
74
+ children: nftDomainURLState.error.message
75
+ })
76
+ });
59
77
  }
60
78
  const handleAuthSuccess = async ({
61
79
  domain,
@@ -97,6 +115,7 @@ export default function AddDomain({
97
115
  };
98
116
  const error = domainContext.error || state.error; // TODO: state error 可能不需要了
99
117
 
118
+ const nftDomainService = nftDomainURLState.value;
100
119
  const domainTypes = {
101
120
  inputDomain: {
102
121
  name: t('router.domainAlias.inputDomain'),
@@ -164,7 +183,7 @@ export default function AddDomain({
164
183
  })
165
184
  }
166
185
  };
167
- if (info?.nftDomainUrl) {
186
+ if (info?.nftDomainUrl && nftDomainService) {
168
187
  domainTypes.nftDomain = {
169
188
  name: t('router.domainAlias.nftDomain'),
170
189
  component: /*#__PURE__*/_jsxs(_Fragment, {
@@ -178,7 +197,7 @@ export default function AddDomain({
178
197
  children: t('router.domainAlias.addDomainNFT.tips')
179
198
  }), /*#__PURE__*/_jsxs("div", {
180
199
  children: [t('router.domainAlias.addDomainNFT.buyTip'), /*#__PURE__*/_jsxs(Link, {
181
- href: info.nftDomainUrl,
200
+ href: nftDomainService.base,
182
201
  sx: {
183
202
  fontSize: '14px',
184
203
  display: 'inline-flex',
@@ -207,9 +226,9 @@ export default function AddDomain({
207
226
  popup: true,
208
227
  useSocket: false,
209
228
  action: "authorize",
210
- baseUrl: nftDomainURL,
229
+ baseUrl: nftDomainService.api,
211
230
  checkFn: axios.create({
212
- baseURL: nftDomainURL
231
+ baseURL: nftDomainService.api
213
232
  }).get,
214
233
  extraParams: {
215
234
  delegatee: appId,
@@ -4,8 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = AddDomain;
7
+ var _didDomain = require("@abtnode/util/lib/did-domain");
7
8
  var _Connect = _interopRequireDefault(require("@arcblock/did-connect/lib/Connect"));
8
9
  var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
10
+ var _Center = _interopRequireDefault(require("@arcblock/ux/lib/Center"));
9
11
  var _context = require("@arcblock/ux/lib/Locale/context");
10
12
  var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
11
13
  var _InfoOutlined = _interopRequireDefault(require("@mui/icons-material/InfoOutlined"));
@@ -18,7 +20,8 @@ var _noop = _interopRequireDefault(require("lodash/noop"));
18
20
  var _trim = _interopRequireDefault(require("lodash/trim"));
19
21
  var _propTypes = _interopRequireDefault(require("prop-types"));
20
22
  var _useSetState = _interopRequireDefault(require("react-use/lib/useSetState"));
21
- var _urlJoin = _interopRequireDefault(require("url-join"));
23
+ var _useAsync = _interopRequireDefault(require("react-use/lib/useAsync"));
24
+ var _material = require("@mui/material");
22
25
  var _domain = require("../../contexts/domain");
23
26
  var _node = require("../../contexts/node");
24
27
  var _util = require("../../util");
@@ -67,9 +70,22 @@ function AddDomain(_ref) {
67
70
  showNFTDomainAuth: false,
68
71
  showDnsTip: false
69
72
  });
70
- let nftDomainURL = '';
71
- if (info.nftDomainUrl) {
72
- nftDomainURL = (0, _urlJoin.default)(info.nftDomainUrl, '/api');
73
+ const nftDomainURLState = (0, _useAsync.default)(() => (0, _didDomain.getDidDomainServiceURL)(info === null || info === void 0 ? void 0 : info.nftDomainUrl));
74
+ if (info !== null && info !== void 0 && info.nftDomainUrl && nftDomainURLState.loading) {
75
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, _objectSpread(_objectSpread({}, props), {}, {
76
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Center.default, {
77
+ relative: "parent",
78
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.CircularProgress, {})
79
+ })
80
+ }));
81
+ }
82
+ if (nftDomainURLState.error) {
83
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, _objectSpread(_objectSpread({}, props), {}, {
84
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Center.default, {
85
+ relative: "parent",
86
+ children: nftDomainURLState.error.message
87
+ })
88
+ }));
73
89
  }
74
90
  const handleAuthSuccess = async _ref2 => {
75
91
  let {
@@ -112,6 +128,7 @@ function AddDomain(_ref) {
112
128
  };
113
129
  const error = domainContext.error || state.error; // TODO: state error 可能不需要了
114
130
 
131
+ const nftDomainService = nftDomainURLState.value;
115
132
  const domainTypes = {
116
133
  inputDomain: {
117
134
  name: t('router.domainAlias.inputDomain'),
@@ -180,7 +197,7 @@ function AddDomain(_ref) {
180
197
  })
181
198
  }
182
199
  };
183
- if (info !== null && info !== void 0 && info.nftDomainUrl) {
200
+ if (info !== null && info !== void 0 && info.nftDomainUrl && nftDomainService) {
184
201
  domainTypes.nftDomain = {
185
202
  name: t('router.domainAlias.nftDomain'),
186
203
  component: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
@@ -194,7 +211,7 @@ function AddDomain(_ref) {
194
211
  children: t('router.domainAlias.addDomainNFT.tips')
195
212
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
196
213
  children: [t('router.domainAlias.addDomainNFT.buyTip'), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Link.default, {
197
- href: info.nftDomainUrl,
214
+ href: nftDomainService.base,
198
215
  sx: {
199
216
  fontSize: '14px',
200
217
  display: 'inline-flex',
@@ -223,9 +240,9 @@ function AddDomain(_ref) {
223
240
  popup: true,
224
241
  useSocket: false,
225
242
  action: "authorize",
226
- baseUrl: nftDomainURL,
243
+ baseUrl: nftDomainService.api,
227
244
  checkFn: _api.axios.create({
228
- baseURL: nftDomainURL
245
+ baseURL: nftDomainService.api
229
246
  }).get,
230
247
  extraParams: {
231
248
  delegatee: appId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abtnode/ux",
3
- "version": "1.16.22-beta-079a9053",
3
+ "version": "1.16.22-beta-87e027a7",
4
4
  "description": "UX components shared across abtnode packages",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -27,23 +27,23 @@
27
27
  "author": "linchen <linchen1987@foxmail.com> (http://github.com/linchen1987)",
28
28
  "license": "Apache-2.0",
29
29
  "dependencies": {
30
- "@abtnode/auth": "1.16.22-beta-079a9053",
31
- "@abtnode/constant": "1.16.22-beta-079a9053",
32
- "@abtnode/util": "1.16.22-beta-079a9053",
30
+ "@abtnode/auth": "1.16.22-beta-87e027a7",
31
+ "@abtnode/constant": "1.16.22-beta-87e027a7",
32
+ "@abtnode/util": "1.16.22-beta-87e027a7",
33
33
  "@ahooksjs/use-url-state": "^3.5.1",
34
34
  "@arcblock/did": "^1.18.108",
35
- "@arcblock/did-connect": "^2.9.7",
35
+ "@arcblock/did-connect": "^2.9.13",
36
36
  "@arcblock/did-motif": "^1.1.13",
37
- "@arcblock/icons": "^2.9.7",
38
- "@arcblock/nft-display": "2.9.7",
39
- "@arcblock/react-hooks": "^2.9.7",
40
- "@arcblock/terminal": "^2.9.7",
41
- "@arcblock/ux": "^2.9.7",
42
- "@blocklet/constant": "1.16.22-beta-079a9053",
37
+ "@arcblock/icons": "^2.9.13",
38
+ "@arcblock/nft-display": "2.9.13",
39
+ "@arcblock/react-hooks": "^2.9.13",
40
+ "@arcblock/terminal": "^2.9.13",
41
+ "@arcblock/ux": "^2.9.13",
42
+ "@blocklet/constant": "1.16.22-beta-87e027a7",
43
43
  "@blocklet/launcher-layout": "2.2.51",
44
- "@blocklet/list": "^0.12.63",
45
- "@blocklet/meta": "1.16.22-beta-079a9053",
46
- "@blocklet/ui-react": "^2.9.7",
44
+ "@blocklet/list": "^0.12.65",
45
+ "@blocklet/meta": "1.16.22-beta-87e027a7",
46
+ "@blocklet/ui-react": "^2.9.13",
47
47
  "@blocklet/uploader": "^0.0.64",
48
48
  "@emotion/react": "^11.10.4",
49
49
  "@emotion/styled": "^11.10.4",
@@ -102,7 +102,7 @@
102
102
  "babel-plugin-inline-react-svg": "^1.1.2",
103
103
  "glob": "^10.3.3"
104
104
  },
105
- "gitHead": "012ceb3aa8270b79d3a6935e6f1de2f5b9a50348",
105
+ "gitHead": "c1b0c1d0b1d2504d4738cd5981e6e52872e4e1ce",
106
106
  "exports": {
107
107
  ".": {
108
108
  "import": "./es/index.js",