@abtnode/ux 1.16.21-beta-e828f413 → 1.16.21-beta-7b40ffb4

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.
@@ -50,7 +50,7 @@ function AddDomainAliasComponent({
50
50
  });
51
51
  try {
52
52
  const domain = parseDomainFromURL(params.domain);
53
- const validateResult = await domainContext.validateDomain(domain);
53
+ const validateResult = await domainContext.validateDomain(domain, params.type);
54
54
  if (!validateResult) {
55
55
  // eslint-disable-next-line consistent-return
56
56
  return false;
@@ -89,11 +89,13 @@ function AddDomainAliasComponent({
89
89
  }),
90
90
  onInputDomain: ({
91
91
  domain,
92
+ type,
92
93
  error
93
94
  }) => {
94
95
  setParams({
95
96
  ...params,
96
97
  domain,
98
+ type,
97
99
  __disableConfirm: !!error
98
100
  });
99
101
  setError(error);
@@ -1,6 +1,7 @@
1
1
  import Connect from '@arcblock/did-connect/lib/Connect';
2
2
  import Button from '@arcblock/ux/lib/Button';
3
3
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
4
+ import Toast from '@arcblock/ux/lib/Toast';
4
5
  import IconInfo from '@mui/icons-material/InfoOutlined';
5
6
  import OpenInNewIcon from '@mui/icons-material/OpenInNew';
6
7
  import Box from '@mui/material/Box';
@@ -77,7 +78,8 @@ export default function AddDomain({
77
78
  await sleep(2000);
78
79
  setState({
79
80
  confirmSetting: null,
80
- showNFTDomainAuth: false
81
+ showNFTDomainAuth: false,
82
+ type: 'nftDomain'
81
83
  });
82
84
  onSuccess({
83
85
  domain: tmpDomain,
@@ -85,13 +87,15 @@ export default function AddDomain({
85
87
  nftDid,
86
88
  chainHost
87
89
  });
90
+ } catch (error) {
91
+ Toast.error(error.message);
88
92
  } finally {
89
93
  setState({
90
- openAuthNFTDomain: false
94
+ showNFTDomainAuth: false
91
95
  });
92
96
  }
93
97
  };
94
- const error = state.error || domainContext.error; // TODO: state error 可能不需要了
98
+ const error = domainContext.error || state.error; // TODO: state error 可能不需要了
95
99
 
96
100
  const domainTypes = {
97
101
  inputDomain: {
@@ -99,7 +103,7 @@ export default function AddDomain({
99
103
  component: /*#__PURE__*/_jsxs(_Fragment, {
100
104
  children: [/*#__PURE__*/_jsx(TextField, {
101
105
  label: t('router.domainAlias.add.domainDescription'),
102
- helperText: error || t('router.domainAlias.add.helperText'),
106
+ helperText: state.type === 'inputDomain' && error || t('router.domainAlias.add.helperText'),
103
107
  inputProps: {
104
108
  'data-cy': 'domain-name-input'
105
109
  },
@@ -108,18 +112,20 @@ export default function AddDomain({
108
112
  value: state.domain,
109
113
  size: "small",
110
114
  variant: "outlined",
111
- error: !!error,
115
+ error: !!error && state.type === 'inputDomain',
112
116
  onChange: e => {
113
117
  const value = trim(e.target?.value);
114
118
  domainContext.setDomain(value);
115
119
  const errMessage = validateDomain(value, locale);
116
120
  setState({
117
121
  domain: value,
118
- error: errMessage
122
+ error: errMessage,
123
+ type: 'inputDomain'
119
124
  });
120
125
  onInputDomain({
121
126
  domain: value,
122
- error: errMessage
127
+ error: errMessage,
128
+ type: 'inputDomain'
123
129
  });
124
130
  },
125
131
  autoFocus: autoFocus,
@@ -42,8 +42,8 @@ function DomainProvider({
42
42
  error: errMessage
43
43
  });
44
44
  },
45
- validateDomain: async domain => {
46
- if (!state.error) {
45
+ validateDomain: async (domain, type) => {
46
+ if (!state.error && type && type !== 'nftDomain') {
47
47
  const result = await api.isDidDomain({
48
48
  input: {
49
49
  domain
@@ -61,7 +61,7 @@ function AddDomainAliasComponent(_ref) {
61
61
  });
62
62
  try {
63
63
  const domain = (0, _util2.parseDomainFromURL)(params.domain);
64
- const validateResult = await domainContext.validateDomain(domain);
64
+ const validateResult = await domainContext.validateDomain(domain, params.type);
65
65
  if (!validateResult) {
66
66
  // eslint-disable-next-line consistent-return
67
67
  return false;
@@ -101,10 +101,12 @@ function AddDomainAliasComponent(_ref) {
101
101
  onInputDomain: _ref2 => {
102
102
  let {
103
103
  domain,
104
+ type,
104
105
  error
105
106
  } = _ref2;
106
107
  setParams(_objectSpread(_objectSpread({}, params), {}, {
107
108
  domain,
109
+ type,
108
110
  __disableConfirm: !!error
109
111
  }));
110
112
  setError(error);
@@ -7,6 +7,7 @@ exports.default = AddDomain;
7
7
  var _Connect = _interopRequireDefault(require("@arcblock/did-connect/lib/Connect"));
8
8
  var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
9
9
  var _context = require("@arcblock/ux/lib/Locale/context");
10
+ var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
10
11
  var _InfoOutlined = _interopRequireDefault(require("@mui/icons-material/InfoOutlined"));
11
12
  var _OpenInNew = _interopRequireDefault(require("@mui/icons-material/OpenInNew"));
12
13
  var _Box = _interopRequireDefault(require("@mui/material/Box"));
@@ -92,7 +93,8 @@ function AddDomain(_ref) {
92
93
  await (0, _util.sleep)(2000);
93
94
  setState({
94
95
  confirmSetting: null,
95
- showNFTDomainAuth: false
96
+ showNFTDomainAuth: false,
97
+ type: 'nftDomain'
96
98
  });
97
99
  onSuccess({
98
100
  domain: tmpDomain,
@@ -100,13 +102,15 @@ function AddDomain(_ref) {
100
102
  nftDid,
101
103
  chainHost
102
104
  });
105
+ } catch (error) {
106
+ _Toast.default.error(error.message);
103
107
  } finally {
104
108
  setState({
105
- openAuthNFTDomain: false
109
+ showNFTDomainAuth: false
106
110
  });
107
111
  }
108
112
  };
109
- const error = state.error || domainContext.error; // TODO: state error 可能不需要了
113
+ const error = domainContext.error || state.error; // TODO: state error 可能不需要了
110
114
 
111
115
  const domainTypes = {
112
116
  inputDomain: {
@@ -114,7 +118,7 @@ function AddDomain(_ref) {
114
118
  component: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
115
119
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_TextField.default, {
116
120
  label: t('router.domainAlias.add.domainDescription'),
117
- helperText: error || t('router.domainAlias.add.helperText'),
121
+ helperText: state.type === 'inputDomain' && error || t('router.domainAlias.add.helperText'),
118
122
  inputProps: {
119
123
  'data-cy': 'domain-name-input'
120
124
  },
@@ -123,7 +127,7 @@ function AddDomain(_ref) {
123
127
  value: state.domain,
124
128
  size: "small",
125
129
  variant: "outlined",
126
- error: !!error,
130
+ error: !!error && state.type === 'inputDomain',
127
131
  onChange: e => {
128
132
  var _e$target;
129
133
  const value = (0, _trim.default)((_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value);
@@ -131,11 +135,13 @@ function AddDomain(_ref) {
131
135
  const errMessage = (0, _util.validateDomain)(value, locale);
132
136
  setState({
133
137
  domain: value,
134
- error: errMessage
138
+ error: errMessage,
139
+ type: 'inputDomain'
135
140
  });
136
141
  onInputDomain({
137
142
  domain: value,
138
- error: errMessage
143
+ error: errMessage,
144
+ type: 'inputDomain'
139
145
  });
140
146
  },
141
147
  autoFocus: autoFocus,
@@ -53,8 +53,8 @@ function DomainProvider(_ref) {
53
53
  error: errMessage
54
54
  });
55
55
  },
56
- validateDomain: async domain => {
57
- if (!state.error) {
56
+ validateDomain: async (domain, type) => {
57
+ if (!state.error && type && type !== 'nftDomain') {
58
58
  const result = await api.isDidDomain({
59
59
  input: {
60
60
  domain
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abtnode/ux",
3
- "version": "1.16.21-beta-e828f413",
3
+ "version": "1.16.21-beta-7b40ffb4",
4
4
  "description": "UX components shared across abtnode packages",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -27,9 +27,9 @@
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.21-beta-e828f413",
31
- "@abtnode/constant": "1.16.21-beta-e828f413",
32
- "@abtnode/util": "1.16.21-beta-e828f413",
30
+ "@abtnode/auth": "1.16.21-beta-7b40ffb4",
31
+ "@abtnode/constant": "1.16.21-beta-7b40ffb4",
32
+ "@abtnode/util": "1.16.21-beta-7b40ffb4",
33
33
  "@ahooksjs/use-url-state": "^3.5.1",
34
34
  "@arcblock/did": "^1.18.107",
35
35
  "@arcblock/did-connect": "^2.8.23",
@@ -39,10 +39,10 @@
39
39
  "@arcblock/react-hooks": "^2.8.23",
40
40
  "@arcblock/terminal": "^2.8.23",
41
41
  "@arcblock/ux": "^2.8.23",
42
- "@blocklet/constant": "1.16.21-beta-e828f413",
42
+ "@blocklet/constant": "1.16.21-beta-7b40ffb4",
43
43
  "@blocklet/launcher-layout": "2.2.48",
44
44
  "@blocklet/list": "^0.12.60",
45
- "@blocklet/meta": "1.16.21-beta-e828f413",
45
+ "@blocklet/meta": "1.16.21-beta-7b40ffb4",
46
46
  "@blocklet/ui-react": "^2.8.23",
47
47
  "@blocklet/uploader": "^0.0.55",
48
48
  "@emotion/react": "^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": "936af9cb0549f341d3683ea63085b460bf6ddbf0",
105
+ "gitHead": "11d567281247a935e866911ebcf53d37021043b3",
106
106
  "exports": {
107
107
  ".": {
108
108
  "import": "./es/index.js",