@abtnode/ux 1.16.20-beta-cf6dfce1 → 1.16.20-beta-9c254d14
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/es/blocklet/add-cert.js +24 -10
- package/es/blocklet/component/domain-list.js +5 -0
- package/es/blocklet/router/add-domain.js +14 -7
- package/lib/blocklet/add-cert.js +26 -12
- package/lib/blocklet/component/domain-list.js +70 -62
- package/lib/blocklet/router/add-domain.js +16 -9
- package/package.json +7 -7
package/es/blocklet/add-cert.js
CHANGED
|
@@ -5,9 +5,9 @@ import useAsyncRetry from 'react-use/lib/useAsyncRetry';
|
|
|
5
5
|
import Tooltip from '@mui/material/Tooltip';
|
|
6
6
|
import CircularProgress from '@mui/material/CircularProgress';
|
|
7
7
|
import Alert from '@arcblock/ux/lib/Alert';
|
|
8
|
+
import Toast from '@arcblock/ux/lib/Toast';
|
|
8
9
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
9
10
|
import { BlockletEvents } from '@blocklet/constant';
|
|
10
|
-
import Toast from '@arcblock/ux/lib/Toast';
|
|
11
11
|
import Confirm from '../confirm';
|
|
12
12
|
import { useNodeContext } from '../contexts/node';
|
|
13
13
|
import { useBlockletContext } from '../contexts/blocklet';
|
|
@@ -21,21 +21,26 @@ function Add(props) {
|
|
|
21
21
|
t
|
|
22
22
|
} = useLocaleContext();
|
|
23
23
|
const [loading, setLoading] = useState(false);
|
|
24
|
+
const {
|
|
25
|
+
inService
|
|
26
|
+
} = useNodeContext();
|
|
24
27
|
const [confirmSetting, setConfirmSetting] = useState(null);
|
|
25
28
|
const {
|
|
29
|
+
siteId,
|
|
26
30
|
domain,
|
|
27
31
|
onAdd,
|
|
28
32
|
children,
|
|
29
33
|
did
|
|
30
34
|
} = props;
|
|
35
|
+
const [issuing, setIssuing] = useState(false);
|
|
31
36
|
const {
|
|
32
37
|
api,
|
|
33
38
|
ws: {
|
|
34
39
|
useSubscription
|
|
35
40
|
}
|
|
36
41
|
} = useNodeContext();
|
|
37
|
-
const [issuing, setIssuing] = useState(false);
|
|
38
42
|
const {
|
|
43
|
+
mode,
|
|
39
44
|
actions: {
|
|
40
45
|
refreshDomainStatus
|
|
41
46
|
}
|
|
@@ -54,18 +59,24 @@ function Add(props) {
|
|
|
54
59
|
const handleIssueComplete = (cert, type) => {
|
|
55
60
|
if (cert.domain === domain) {
|
|
56
61
|
setIssuing(false);
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
setLoading(false);
|
|
63
|
+
|
|
64
|
+
// Setup 模式下有全局通知,所以这里不需要通知
|
|
65
|
+
if (inService && mode !== 'setup') {
|
|
66
|
+
if (type === 'success') {
|
|
67
|
+
Toast.success(`The ${cert.domain} certificate is issued successfully`);
|
|
68
|
+
} else if (type === 'error') {
|
|
69
|
+
Toast.error(`Failed to issue certificate for ${cert.domain}`);
|
|
70
|
+
}
|
|
61
71
|
}
|
|
62
72
|
}
|
|
63
73
|
};
|
|
64
74
|
useEffect(() => {
|
|
65
|
-
if (
|
|
66
|
-
|
|
75
|
+
if (certState.loading) {
|
|
76
|
+
return;
|
|
67
77
|
}
|
|
68
|
-
|
|
78
|
+
setIssuing(isCertInProgress(certState.value?.status));
|
|
79
|
+
}, [certState.loading, certState.value?.status]);
|
|
69
80
|
useSubscription(BlockletEvents.certError, cert => handleIssueComplete(cert, 'error'));
|
|
70
81
|
useSubscription(BlockletEvents.certIssued, cert => {
|
|
71
82
|
certState.retry();
|
|
@@ -89,8 +100,10 @@ function Add(props) {
|
|
|
89
100
|
try {
|
|
90
101
|
await api.issueLetsEncryptCert({
|
|
91
102
|
input: {
|
|
103
|
+
siteId,
|
|
92
104
|
domain,
|
|
93
|
-
did
|
|
105
|
+
did,
|
|
106
|
+
inBlockletSetup: mode === 'setup'
|
|
94
107
|
}
|
|
95
108
|
});
|
|
96
109
|
onAdd();
|
|
@@ -142,6 +155,7 @@ function Add(props) {
|
|
|
142
155
|
Add.propTypes = {
|
|
143
156
|
domain: PropTypes.string.isRequired,
|
|
144
157
|
did: PropTypes.string.isRequired,
|
|
158
|
+
siteId: PropTypes.string.isRequired,
|
|
145
159
|
onAdd: PropTypes.func,
|
|
146
160
|
children: PropTypes.any
|
|
147
161
|
};
|
|
@@ -177,6 +177,7 @@ function DomainList({
|
|
|
177
177
|
domain: domain,
|
|
178
178
|
filters: ['domain']
|
|
179
179
|
}, `${domain.value}-domain`), /*#__PURE__*/_jsx(InnerAddDomain, {
|
|
180
|
+
siteId: blocklet.site?.id,
|
|
180
181
|
domain: domain,
|
|
181
182
|
blocklet: blocklet,
|
|
182
183
|
hasMutatePermission: hasMutatePermission
|
|
@@ -217,6 +218,7 @@ function DomainList({
|
|
|
217
218
|
children: domain.value
|
|
218
219
|
})
|
|
219
220
|
}), /*#__PURE__*/_jsx(InnerAddDomain, {
|
|
221
|
+
siteId: blocklet.site?.id,
|
|
220
222
|
domain: domain,
|
|
221
223
|
blocklet: blocklet,
|
|
222
224
|
hasMutatePermission: hasMutatePermission
|
|
@@ -374,6 +376,7 @@ InnerAction.propTypes = {
|
|
|
374
376
|
blocklet: PropTypes.object.isRequired
|
|
375
377
|
};
|
|
376
378
|
function InnerAddDomain({
|
|
379
|
+
siteId,
|
|
377
380
|
domain,
|
|
378
381
|
blocklet,
|
|
379
382
|
hasMutatePermission
|
|
@@ -486,6 +489,7 @@ function InnerAddDomain({
|
|
|
486
489
|
domain: domain,
|
|
487
490
|
filters: ['http']
|
|
488
491
|
}, `${domain.value}-http`), hasMutatePermission && /*#__PURE__*/_jsx(AddCert, {
|
|
492
|
+
siteId: siteId,
|
|
489
493
|
domain: domain.value,
|
|
490
494
|
domainStatus: domain.domainStatus,
|
|
491
495
|
did: blocklet.meta.did,
|
|
@@ -503,6 +507,7 @@ function InnerAddDomain({
|
|
|
503
507
|
});
|
|
504
508
|
}
|
|
505
509
|
InnerAddDomain.propTypes = {
|
|
510
|
+
siteId: PropTypes.string.isRequired,
|
|
506
511
|
domain: DomainType.isRequired,
|
|
507
512
|
blocklet: PropTypes.object.isRequired,
|
|
508
513
|
hasMutatePermission: PropTypes.bool.isRequired
|
|
@@ -30,6 +30,7 @@ export default function AddDomain({
|
|
|
30
30
|
onSuccess,
|
|
31
31
|
disabled,
|
|
32
32
|
autoFocus,
|
|
33
|
+
inBlockletSetup,
|
|
33
34
|
...props
|
|
34
35
|
}) {
|
|
35
36
|
const {
|
|
@@ -56,14 +57,16 @@ export default function AddDomain({
|
|
|
56
57
|
chainHost
|
|
57
58
|
}) => {
|
|
58
59
|
try {
|
|
60
|
+
const tmpDomain = parseDomainFromURL(domain);
|
|
59
61
|
await api.addDomainAlias({
|
|
60
62
|
input: {
|
|
61
63
|
id: siteId,
|
|
62
64
|
type: 'nft-domain',
|
|
63
|
-
domainAlias:
|
|
65
|
+
domainAlias: tmpDomain,
|
|
64
66
|
nftDid,
|
|
65
67
|
chainHost,
|
|
66
|
-
teamDid
|
|
68
|
+
teamDid,
|
|
69
|
+
inBlockletSetup
|
|
67
70
|
}
|
|
68
71
|
});
|
|
69
72
|
await sleep(2000);
|
|
@@ -72,8 +75,10 @@ export default function AddDomain({
|
|
|
72
75
|
showNFTDomainAuth: false
|
|
73
76
|
});
|
|
74
77
|
onSuccess({
|
|
75
|
-
domain,
|
|
76
|
-
type: state.type
|
|
78
|
+
domain: tmpDomain,
|
|
79
|
+
type: state.type,
|
|
80
|
+
nftDid,
|
|
81
|
+
chainHost
|
|
77
82
|
});
|
|
78
83
|
} finally {
|
|
79
84
|
setState({
|
|
@@ -215,7 +220,7 @@ export default function AddDomain({
|
|
|
215
220
|
gap: '1em'
|
|
216
221
|
},
|
|
217
222
|
children: inputDomainTypes.map((type, index) => /*#__PURE__*/_jsxs(Box, {
|
|
218
|
-
children: [/*#__PURE__*/_jsx(Box, {
|
|
223
|
+
children: [inputDomainTypes.length > 1 && /*#__PURE__*/_jsx(Box, {
|
|
219
224
|
children: `${t(`optionsOrder.${index + 1}`)}: ${domainTypes[type]?.name}`
|
|
220
225
|
}), /*#__PURE__*/_jsx(Box, {
|
|
221
226
|
sx: {
|
|
@@ -237,7 +242,8 @@ AddDomain.propTypes = {
|
|
|
237
242
|
appId: PropTypes.string,
|
|
238
243
|
appPk: PropTypes.string,
|
|
239
244
|
disabled: PropTypes.bool,
|
|
240
|
-
autoFocus: PropTypes.bool
|
|
245
|
+
autoFocus: PropTypes.bool,
|
|
246
|
+
inBlockletSetup: PropTypes.bool
|
|
241
247
|
};
|
|
242
248
|
AddDomain.defaultProps = {
|
|
243
249
|
defaultCustomDomain: '',
|
|
@@ -246,5 +252,6 @@ AddDomain.defaultProps = {
|
|
|
246
252
|
appId: '',
|
|
247
253
|
appPk: '',
|
|
248
254
|
disabled: false,
|
|
249
|
-
autoFocus: true
|
|
255
|
+
autoFocus: true,
|
|
256
|
+
inBlockletSetup: false
|
|
250
257
|
};
|
package/lib/blocklet/add-cert.js
CHANGED
|
@@ -10,9 +10,9 @@ var _useAsyncRetry = _interopRequireDefault(require("react-use/lib/useAsyncRetry
|
|
|
10
10
|
var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
|
|
11
11
|
var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
|
|
12
12
|
var _Alert = _interopRequireDefault(require("@arcblock/ux/lib/Alert"));
|
|
13
|
+
var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
|
|
13
14
|
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
14
15
|
var _constant = require("@blocklet/constant");
|
|
15
|
-
var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
|
|
16
16
|
var _confirm = _interopRequireDefault(require("../confirm"));
|
|
17
17
|
var _node = require("../contexts/node");
|
|
18
18
|
var _blocklet = require("../contexts/blocklet");
|
|
@@ -30,26 +30,31 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
30
30
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
31
31
|
const isCertInProgress = status => ['waiting', 'creating', 'renewaling'].includes(status);
|
|
32
32
|
function Add(props) {
|
|
33
|
-
var _certState$value2;
|
|
33
|
+
var _certState$value2, _certState$value3;
|
|
34
34
|
const {
|
|
35
35
|
t
|
|
36
36
|
} = (0, _context.useLocaleContext)();
|
|
37
37
|
const [loading, setLoading] = (0, _react.useState)(false);
|
|
38
|
+
const {
|
|
39
|
+
inService
|
|
40
|
+
} = (0, _node.useNodeContext)();
|
|
38
41
|
const [confirmSetting, setConfirmSetting] = (0, _react.useState)(null);
|
|
39
42
|
const {
|
|
43
|
+
siteId,
|
|
40
44
|
domain,
|
|
41
45
|
onAdd,
|
|
42
46
|
children,
|
|
43
47
|
did
|
|
44
48
|
} = props;
|
|
49
|
+
const [issuing, setIssuing] = (0, _react.useState)(false);
|
|
45
50
|
const {
|
|
46
51
|
api,
|
|
47
52
|
ws: {
|
|
48
53
|
useSubscription
|
|
49
54
|
}
|
|
50
55
|
} = (0, _node.useNodeContext)();
|
|
51
|
-
const [issuing, setIssuing] = (0, _react.useState)(false);
|
|
52
56
|
const {
|
|
57
|
+
mode,
|
|
53
58
|
actions: {
|
|
54
59
|
refreshDomainStatus
|
|
55
60
|
}
|
|
@@ -68,19 +73,25 @@ function Add(props) {
|
|
|
68
73
|
const handleIssueComplete = (cert, type) => {
|
|
69
74
|
if (cert.domain === domain) {
|
|
70
75
|
setIssuing(false);
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
76
|
+
setLoading(false);
|
|
77
|
+
|
|
78
|
+
// Setup 模式下有全局通知,所以这里不需要通知
|
|
79
|
+
if (inService && mode !== 'setup') {
|
|
80
|
+
if (type === 'success') {
|
|
81
|
+
_Toast.default.success("The ".concat(cert.domain, " certificate is issued successfully"));
|
|
82
|
+
} else if (type === 'error') {
|
|
83
|
+
_Toast.default.error("Failed to issue certificate for ".concat(cert.domain));
|
|
84
|
+
}
|
|
75
85
|
}
|
|
76
86
|
}
|
|
77
87
|
};
|
|
78
88
|
(0, _react.useEffect)(() => {
|
|
79
89
|
var _certState$value;
|
|
80
|
-
if (
|
|
81
|
-
|
|
90
|
+
if (certState.loading) {
|
|
91
|
+
return;
|
|
82
92
|
}
|
|
83
|
-
|
|
93
|
+
setIssuing(isCertInProgress((_certState$value = certState.value) === null || _certState$value === void 0 ? void 0 : _certState$value.status));
|
|
94
|
+
}, [certState.loading, (_certState$value2 = certState.value) === null || _certState$value2 === void 0 ? void 0 : _certState$value2.status]);
|
|
84
95
|
useSubscription(_constant.BlockletEvents.certError, cert => handleIssueComplete(cert, 'error'));
|
|
85
96
|
useSubscription(_constant.BlockletEvents.certIssued, cert => {
|
|
86
97
|
certState.retry();
|
|
@@ -91,7 +102,7 @@ function Add(props) {
|
|
|
91
102
|
return ''; // 如果正在加载证书的状态,则不渲染任何元素
|
|
92
103
|
}
|
|
93
104
|
|
|
94
|
-
if (((_certState$
|
|
105
|
+
if (((_certState$value3 = certState.value) === null || _certState$value3 === void 0 ? void 0 : _certState$value3.status) === 'normal') {
|
|
95
106
|
return ''; // 如果证书已经生成,则不渲染任何元素
|
|
96
107
|
}
|
|
97
108
|
|
|
@@ -104,8 +115,10 @@ function Add(props) {
|
|
|
104
115
|
try {
|
|
105
116
|
await api.issueLetsEncryptCert({
|
|
106
117
|
input: {
|
|
118
|
+
siteId,
|
|
107
119
|
domain,
|
|
108
|
-
did
|
|
120
|
+
did,
|
|
121
|
+
inBlockletSetup: mode === 'setup'
|
|
109
122
|
}
|
|
110
123
|
});
|
|
111
124
|
onAdd();
|
|
@@ -157,6 +170,7 @@ function Add(props) {
|
|
|
157
170
|
Add.propTypes = {
|
|
158
171
|
domain: _propTypes.default.string.isRequired,
|
|
159
172
|
did: _propTypes.default.string.isRequired,
|
|
173
|
+
siteId: _propTypes.default.string.isRequired,
|
|
160
174
|
onAdd: _propTypes.default.func,
|
|
161
175
|
children: _propTypes.default.any
|
|
162
176
|
};
|
|
@@ -173,34 +173,78 @@ function DomainList(_ref) {
|
|
|
173
173
|
flexDirection: 'column',
|
|
174
174
|
gap: 1
|
|
175
175
|
},
|
|
176
|
-
children: (showAllDomains ? domains : displayDomains).map(domain =>
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
176
|
+
children: (showAllDomains ? domains : displayDomains).map(domain => {
|
|
177
|
+
var _blocklet$site3, _blocklet$site4;
|
|
178
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
179
|
+
children: [isMobile && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
181
180
|
display: "flex",
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
children:
|
|
188
|
-
|
|
189
|
-
|
|
181
|
+
flexDirection: "column",
|
|
182
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
183
|
+
display: "flex",
|
|
184
|
+
alignItems: "center",
|
|
185
|
+
justifyContent: "flex-start",
|
|
186
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(DomainLink, {
|
|
187
|
+
domain: domain,
|
|
188
|
+
target: "_blank",
|
|
189
|
+
children: domain.value
|
|
190
|
+
})
|
|
191
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
192
|
+
display: "flex",
|
|
193
|
+
alignItems: "center",
|
|
194
|
+
justifyContent: "space-between",
|
|
195
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
196
|
+
sx: {
|
|
197
|
+
display: 'flex',
|
|
198
|
+
alignItems: 'center',
|
|
199
|
+
justifyContent: 'flex-start',
|
|
200
|
+
gap: 1
|
|
201
|
+
},
|
|
202
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_domainStatus.default, {
|
|
203
|
+
domain: domain,
|
|
204
|
+
filters: ['domain']
|
|
205
|
+
}, "".concat(domain.value, "-domain")), /*#__PURE__*/(0, _jsxRuntime.jsx)(InnerAddDomain, {
|
|
206
|
+
siteId: (_blocklet$site3 = blocklet.site) === null || _blocklet$site3 === void 0 ? void 0 : _blocklet$site3.id,
|
|
207
|
+
domain: domain,
|
|
208
|
+
blocklet: blocklet,
|
|
209
|
+
hasMutatePermission: hasMutatePermission
|
|
210
|
+
})]
|
|
211
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
212
|
+
sx: {
|
|
213
|
+
button: {
|
|
214
|
+
padding: 0
|
|
215
|
+
}
|
|
216
|
+
},
|
|
217
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(InnerAction, {
|
|
218
|
+
hasMutatePermission: hasMutatePermission,
|
|
219
|
+
site: site,
|
|
220
|
+
domain: domain,
|
|
221
|
+
blocklet: blocklet
|
|
222
|
+
})
|
|
223
|
+
})]
|
|
224
|
+
})]
|
|
225
|
+
}, domain.value), !isMobile && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
190
226
|
display: "flex",
|
|
191
227
|
alignItems: "center",
|
|
192
228
|
justifyContent: "space-between",
|
|
193
229
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
justifyContent: 'flex-start',
|
|
198
|
-
gap: 1
|
|
199
|
-
},
|
|
230
|
+
display: "flex",
|
|
231
|
+
alignItems: "center",
|
|
232
|
+
justifyContent: "flex-start",
|
|
200
233
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_domainStatus.default, {
|
|
201
234
|
domain: domain,
|
|
202
235
|
filters: ['domain']
|
|
203
|
-
}, "".concat(domain.value, "-domain")), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
236
|
+
}, "".concat(domain.value, "-domain")), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
237
|
+
sx: {
|
|
238
|
+
ml: 2,
|
|
239
|
+
mr: 0.5
|
|
240
|
+
},
|
|
241
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(DomainLink, {
|
|
242
|
+
domain: domain,
|
|
243
|
+
target: "_blank",
|
|
244
|
+
children: domain.value
|
|
245
|
+
})
|
|
246
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(InnerAddDomain, {
|
|
247
|
+
siteId: (_blocklet$site4 = blocklet.site) === null || _blocklet$site4 === void 0 ? void 0 : _blocklet$site4.id,
|
|
204
248
|
domain: domain,
|
|
205
249
|
blocklet: blocklet,
|
|
206
250
|
hasMutatePermission: hasMutatePermission
|
|
@@ -218,48 +262,9 @@ function DomainList(_ref) {
|
|
|
218
262
|
blocklet: blocklet
|
|
219
263
|
})
|
|
220
264
|
})]
|
|
221
|
-
})]
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
alignItems: "center",
|
|
225
|
-
justifyContent: "space-between",
|
|
226
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
227
|
-
display: "flex",
|
|
228
|
-
alignItems: "center",
|
|
229
|
-
justifyContent: "flex-start",
|
|
230
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_domainStatus.default, {
|
|
231
|
-
domain: domain,
|
|
232
|
-
filters: ['domain']
|
|
233
|
-
}, "".concat(domain.value, "-domain")), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
234
|
-
sx: {
|
|
235
|
-
ml: 2,
|
|
236
|
-
mr: 0.5
|
|
237
|
-
},
|
|
238
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(DomainLink, {
|
|
239
|
-
domain: domain,
|
|
240
|
-
target: "_blank",
|
|
241
|
-
children: domain.value
|
|
242
|
-
})
|
|
243
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(InnerAddDomain, {
|
|
244
|
-
domain: domain,
|
|
245
|
-
blocklet: blocklet,
|
|
246
|
-
hasMutatePermission: hasMutatePermission
|
|
247
|
-
})]
|
|
248
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
249
|
-
sx: {
|
|
250
|
-
button: {
|
|
251
|
-
padding: 0
|
|
252
|
-
}
|
|
253
|
-
},
|
|
254
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(InnerAction, {
|
|
255
|
-
hasMutatePermission: hasMutatePermission,
|
|
256
|
-
site: site,
|
|
257
|
-
domain: domain,
|
|
258
|
-
blocklet: blocklet
|
|
259
|
-
})
|
|
260
|
-
})]
|
|
261
|
-
}, domain.value)]
|
|
262
|
-
}))
|
|
265
|
+
}, domain.value)]
|
|
266
|
+
});
|
|
267
|
+
})
|
|
263
268
|
}), hiddenDomains.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
264
269
|
style: {
|
|
265
270
|
marginLeft: '20px',
|
|
@@ -387,6 +392,7 @@ InnerAction.propTypes = {
|
|
|
387
392
|
};
|
|
388
393
|
function InnerAddDomain(_ref5) {
|
|
389
394
|
let {
|
|
395
|
+
siteId,
|
|
390
396
|
domain,
|
|
391
397
|
blocklet,
|
|
392
398
|
hasMutatePermission
|
|
@@ -499,6 +505,7 @@ function InnerAddDomain(_ref5) {
|
|
|
499
505
|
domain: domain,
|
|
500
506
|
filters: ['http']
|
|
501
507
|
}, "".concat(domain.value, "-http")), hasMutatePermission && /*#__PURE__*/(0, _jsxRuntime.jsx)(_addCert.default, {
|
|
508
|
+
siteId: siteId,
|
|
502
509
|
domain: domain.value,
|
|
503
510
|
domainStatus: domain.domainStatus,
|
|
504
511
|
did: blocklet.meta.did,
|
|
@@ -519,6 +526,7 @@ function InnerAddDomain(_ref5) {
|
|
|
519
526
|
});
|
|
520
527
|
}
|
|
521
528
|
InnerAddDomain.propTypes = {
|
|
529
|
+
siteId: _propTypes.default.string.isRequired,
|
|
522
530
|
domain: _types.DomainType.isRequired,
|
|
523
531
|
blocklet: _propTypes.default.object.isRequired,
|
|
524
532
|
hasMutatePermission: _propTypes.default.bool.isRequired
|
|
@@ -23,7 +23,7 @@ var _api = require("../../util/api");
|
|
|
23
23
|
var _dnsTip = _interopRequireDefault(require("./dns-tip"));
|
|
24
24
|
var _util3 = require("./util");
|
|
25
25
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
26
|
-
const _excluded = ["siteId", "teamDid", "cnameDomain", "defaultCustomDomain", "onInputDomain", "appId", "appPk", "onSuccess", "disabled", "autoFocus"];
|
|
26
|
+
const _excluded = ["siteId", "teamDid", "cnameDomain", "defaultCustomDomain", "onInputDomain", "appId", "appPk", "onSuccess", "disabled", "autoFocus", "inBlockletSetup"];
|
|
27
27
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
28
28
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
29
29
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -43,7 +43,8 @@ function AddDomain(_ref) {
|
|
|
43
43
|
appPk,
|
|
44
44
|
onSuccess,
|
|
45
45
|
disabled,
|
|
46
|
-
autoFocus
|
|
46
|
+
autoFocus,
|
|
47
|
+
inBlockletSetup
|
|
47
48
|
} = _ref,
|
|
48
49
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
49
50
|
const {
|
|
@@ -71,14 +72,16 @@ function AddDomain(_ref) {
|
|
|
71
72
|
chainHost
|
|
72
73
|
} = _ref2;
|
|
73
74
|
try {
|
|
75
|
+
const tmpDomain = (0, _util3.parseDomainFromURL)(domain);
|
|
74
76
|
await api.addDomainAlias({
|
|
75
77
|
input: {
|
|
76
78
|
id: siteId,
|
|
77
79
|
type: 'nft-domain',
|
|
78
|
-
domainAlias:
|
|
80
|
+
domainAlias: tmpDomain,
|
|
79
81
|
nftDid,
|
|
80
82
|
chainHost,
|
|
81
|
-
teamDid
|
|
83
|
+
teamDid,
|
|
84
|
+
inBlockletSetup
|
|
82
85
|
}
|
|
83
86
|
});
|
|
84
87
|
await (0, _util2.sleep)(2000);
|
|
@@ -87,8 +90,10 @@ function AddDomain(_ref) {
|
|
|
87
90
|
showNFTDomainAuth: false
|
|
88
91
|
});
|
|
89
92
|
onSuccess({
|
|
90
|
-
domain,
|
|
91
|
-
type: state.type
|
|
93
|
+
domain: tmpDomain,
|
|
94
|
+
type: state.type,
|
|
95
|
+
nftDid,
|
|
96
|
+
chainHost
|
|
92
97
|
});
|
|
93
98
|
} finally {
|
|
94
99
|
setState({
|
|
@@ -232,7 +237,7 @@ function AddDomain(_ref) {
|
|
|
232
237
|
children: inputDomainTypes.map((type, index) => {
|
|
233
238
|
var _domainTypes$type, _domainTypes$type2;
|
|
234
239
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
235
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
240
|
+
children: [inputDomainTypes.length > 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
236
241
|
children: "".concat(t("optionsOrder.".concat(index + 1)), ": ").concat((_domainTypes$type = domainTypes[type]) === null || _domainTypes$type === void 0 ? void 0 : _domainTypes$type.name)
|
|
237
242
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
238
243
|
sx: {
|
|
@@ -255,7 +260,8 @@ AddDomain.propTypes = {
|
|
|
255
260
|
appId: _propTypes.default.string,
|
|
256
261
|
appPk: _propTypes.default.string,
|
|
257
262
|
disabled: _propTypes.default.bool,
|
|
258
|
-
autoFocus: _propTypes.default.bool
|
|
263
|
+
autoFocus: _propTypes.default.bool,
|
|
264
|
+
inBlockletSetup: _propTypes.default.bool
|
|
259
265
|
};
|
|
260
266
|
AddDomain.defaultProps = {
|
|
261
267
|
defaultCustomDomain: '',
|
|
@@ -264,5 +270,6 @@ AddDomain.defaultProps = {
|
|
|
264
270
|
appId: '',
|
|
265
271
|
appPk: '',
|
|
266
272
|
disabled: false,
|
|
267
|
-
autoFocus: true
|
|
273
|
+
autoFocus: true,
|
|
274
|
+
inBlockletSetup: false
|
|
268
275
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abtnode/ux",
|
|
3
|
-
"version": "1.16.20-beta-
|
|
3
|
+
"version": "1.16.20-beta-9c254d14",
|
|
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.20-beta-
|
|
31
|
-
"@abtnode/constant": "1.16.20-beta-
|
|
32
|
-
"@abtnode/util": "1.16.20-beta-
|
|
30
|
+
"@abtnode/auth": "1.16.20-beta-9c254d14",
|
|
31
|
+
"@abtnode/constant": "1.16.20-beta-9c254d14",
|
|
32
|
+
"@abtnode/util": "1.16.20-beta-9c254d14",
|
|
33
33
|
"@ahooksjs/use-url-state": "^3.5.1",
|
|
34
34
|
"@arcblock/did": "^1.18.103",
|
|
35
35
|
"@arcblock/did-connect": "^2.8.20",
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
"@arcblock/react-hooks": "^2.8.20",
|
|
40
40
|
"@arcblock/terminal": "^2.8.20",
|
|
41
41
|
"@arcblock/ux": "^2.8.20",
|
|
42
|
-
"@blocklet/constant": "1.16.20-beta-
|
|
42
|
+
"@blocklet/constant": "1.16.20-beta-9c254d14",
|
|
43
43
|
"@blocklet/launcher-layout": "2.2.46",
|
|
44
44
|
"@blocklet/list": "^0.12.56",
|
|
45
|
-
"@blocklet/meta": "1.16.20-beta-
|
|
45
|
+
"@blocklet/meta": "1.16.20-beta-9c254d14",
|
|
46
46
|
"@blocklet/ui-react": "^2.8.20",
|
|
47
47
|
"@blocklet/uploader": "^0.0.52",
|
|
48
48
|
"@emotion/react": "^11.10.4",
|
|
@@ -100,7 +100,7 @@
|
|
|
100
100
|
"babel-plugin-inline-react-svg": "^1.1.2",
|
|
101
101
|
"glob": "^10.3.3"
|
|
102
102
|
},
|
|
103
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "2f74601e9a8f2e07e872a629b6abc8d4bc1fd371",
|
|
104
104
|
"exports": {
|
|
105
105
|
".": {
|
|
106
106
|
"import": "./es/index.js",
|