@abtnode/ux 1.16.27-beta-426c1690 → 1.16.27-beta-d27e19fa
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/lib/blocklet/component/add-component/add-component-core.js +4 -5
- package/lib/blocklet/component/add-component/step-connect.js +8 -0
- package/lib/blocklet/publish/{select-components.js → create-release/blocklets.js} +41 -20
- package/lib/blocklet/publish/create-release/branding.js +410 -0
- package/lib/blocklet/publish/{connect-store-list.js → create-release/connect-store-list.js} +2 -2
- package/lib/blocklet/publish/create-release/header.js +407 -0
- package/lib/blocklet/publish/create-release/index.js +576 -0
- package/lib/blocklet/publish/create-release/introduction-preview.js +28 -0
- package/lib/blocklet/publish/create-release/introduction.js +109 -0
- package/lib/blocklet/publish/create-release/release-stepper.js +161 -0
- package/lib/blocklet/publish/{resource.js → create-release/resources.js} +37 -21
- package/lib/blocklet/publish/create-release/step-icon.js +63 -0
- package/lib/blocklet/publish/{stop-box.js → create-release/stop-box.js} +13 -6
- package/lib/blocklet/publish/{tree.js → create-release/tree.js} +1 -1
- package/lib/blocklet/publish/create-release/version.js +93 -0
- package/lib/blocklet/publish/index.js +1 -1
- package/lib/blocklet/publish/project-list.js +3 -3
- package/lib/blocklet/publish/release-list.js +2 -2
- package/lib/blocklet/publish/utils/validate-params.js +92 -0
- package/lib/blocklet/router/action/add-domain-alias.js +2 -46
- package/lib/blocklet/router/add-domain.js +203 -67
- package/lib/contexts/domain.js +1 -22
- package/lib/hooks/use-bundle-logo.js +3 -2
- package/lib/layout/addon.js +3 -17
- package/lib/locales/ar.js +18 -2
- package/lib/locales/de.js +18 -2
- package/lib/locales/en.js +14 -1
- package/lib/locales/es.js +18 -2
- package/lib/locales/fr.js +18 -2
- package/lib/locales/hi.js +18 -2
- package/lib/locales/i18n.db +0 -0
- package/lib/locales/id.js +18 -2
- package/lib/locales/ja.js +18 -2
- package/lib/locales/ko.js +18 -2
- package/lib/locales/pt.js +18 -2
- package/lib/locales/ru.js +18 -2
- package/lib/locales/th.js +18 -2
- package/lib/locales/vi.js +18 -2
- package/lib/locales/zh-tw.js +18 -2
- package/lib/locales/zh.js +18 -2
- package/lib/util/index.js +7 -5
- package/package.json +19 -18
- package/lib/blocklet/publish/create-release.js +0 -1207
- /package/lib/blocklet/publish/{connect-store-button.js → create-release/connect-store-button.js} +0 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { PROJECT } from '@blocklet/constant';
|
|
2
|
+
import { UNOWNED_DID } from '@abtnode/constant';
|
|
3
|
+
import semver from 'semver';
|
|
4
|
+
export const validateParams = ({
|
|
5
|
+
params,
|
|
6
|
+
isSelectedResources,
|
|
7
|
+
projectId,
|
|
8
|
+
status,
|
|
9
|
+
t
|
|
10
|
+
}) => {
|
|
11
|
+
const errors = [];
|
|
12
|
+
if (!params.blockletTitle) {
|
|
13
|
+
errors.push({
|
|
14
|
+
param: 'blockletTitle',
|
|
15
|
+
message: t('blocklet.publish.errorTip.noTitle')
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
if (!projectId || projectId === UNOWNED_DID) {
|
|
19
|
+
errors.push({
|
|
20
|
+
param: 'projectId',
|
|
21
|
+
message: t('blocklet.publish.errorTip.noDid')
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
if (!isSelectedResources) {
|
|
25
|
+
errors.push({
|
|
26
|
+
param: 'blockletResources',
|
|
27
|
+
message: t('blocklet.publish.errorTip.noResource')
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
if (!params.blockletVersion) {
|
|
31
|
+
errors.push({
|
|
32
|
+
param: 'blockletVersion',
|
|
33
|
+
message: t('blocklet.publish.errorTip.noVersion')
|
|
34
|
+
});
|
|
35
|
+
} else if (!semver.valid(params.blockletVersion)) {
|
|
36
|
+
errors.push({
|
|
37
|
+
param: 'blockletVersion',
|
|
38
|
+
message: t('blocklet.publish.errorTip.inValidVersion')
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
if (status === PROJECT.RELEASE_STATUS.published) {
|
|
42
|
+
if (!params.blockletDescription) {
|
|
43
|
+
errors.push({
|
|
44
|
+
param: 'blockletDescription',
|
|
45
|
+
message: t('blocklet.publish.errorTip.noDescription')
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
if (!params.note) {
|
|
49
|
+
errors.push({
|
|
50
|
+
param: 'note',
|
|
51
|
+
message: t('blocklet.publish.errorTip.noNote')
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return errors.length ? errors : null;
|
|
56
|
+
};
|
|
57
|
+
export const validateParamsStep = ({
|
|
58
|
+
params,
|
|
59
|
+
isSelectedResources,
|
|
60
|
+
step,
|
|
61
|
+
t,
|
|
62
|
+
projectId
|
|
63
|
+
}) => {
|
|
64
|
+
if (step === 0) {
|
|
65
|
+
if (!params.blockletTitle) {
|
|
66
|
+
return t('blocklet.publish.errorTip.noTitle');
|
|
67
|
+
}
|
|
68
|
+
if (!projectId || projectId === UNOWNED_DID) {
|
|
69
|
+
return t('blocklet.publish.errorTip.noDid');
|
|
70
|
+
}
|
|
71
|
+
if (!params.blockletDescription) {
|
|
72
|
+
return t('blocklet.publish.errorTip.noDescription');
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (step === 2) {
|
|
76
|
+
if (!isSelectedResources) {
|
|
77
|
+
return t('blocklet.publish.errorTip.noResource');
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (step >= 4) {
|
|
81
|
+
if (!params.blockletVersion) {
|
|
82
|
+
return t('blocklet.publish.errorTip.noVersion');
|
|
83
|
+
}
|
|
84
|
+
if (!semver.valid(params.blockletVersion)) {
|
|
85
|
+
return t('blocklet.publish.errorTip.inValidVersion');
|
|
86
|
+
}
|
|
87
|
+
if (!params.note) {
|
|
88
|
+
return t('blocklet.publish.errorTip.noNote');
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return '';
|
|
92
|
+
};
|
|
@@ -6,11 +6,8 @@ import MenuItem from '@mui/material/MenuItem';
|
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import useSetState from 'react-use/lib/useSetState';
|
|
8
8
|
import Confirm from '../../../confirm';
|
|
9
|
-
import { DomainProvider
|
|
10
|
-
import { useNodeContext } from '../../../contexts/node';
|
|
11
|
-
import { sleep } from '../../../util';
|
|
9
|
+
import { DomainProvider } from '../../../contexts/domain';
|
|
12
10
|
import AddDomain from '../add-domain';
|
|
13
|
-
import { parseDomainFromURL } from '../util';
|
|
14
11
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
15
12
|
function AddDomainAliasComponent({
|
|
16
13
|
id,
|
|
@@ -24,56 +21,17 @@ function AddDomainAliasComponent({
|
|
|
24
21
|
const {
|
|
25
22
|
t
|
|
26
23
|
} = useLocaleContext();
|
|
27
|
-
const {
|
|
28
|
-
api
|
|
29
|
-
} = useNodeContext();
|
|
30
24
|
const [state, setState] = useSetState({
|
|
31
25
|
loading: false,
|
|
32
26
|
confirmSetting: null
|
|
33
27
|
});
|
|
34
28
|
const cnameDomain = systemDomains.find(item => isDidDomain(item));
|
|
35
|
-
const domainContext = useDomainContext();
|
|
36
29
|
const onCancel = () => {
|
|
37
30
|
setState({
|
|
38
31
|
loading: false,
|
|
39
32
|
confirmSetting: null
|
|
40
33
|
});
|
|
41
34
|
};
|
|
42
|
-
const onConfirm = async params => {
|
|
43
|
-
if (state.loading) {
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
setState({
|
|
47
|
-
loading: true
|
|
48
|
-
});
|
|
49
|
-
try {
|
|
50
|
-
const domain = parseDomainFromURL(params.domain);
|
|
51
|
-
const validateResult = await domainContext.validateDomain(domain, params.type);
|
|
52
|
-
if (!validateResult) {
|
|
53
|
-
// eslint-disable-next-line consistent-return
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
await api.addDomainAlias({
|
|
57
|
-
input: {
|
|
58
|
-
id,
|
|
59
|
-
domainAlias: domain,
|
|
60
|
-
teamDid
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
await sleep(2000);
|
|
64
|
-
setState({
|
|
65
|
-
confirmSetting: null
|
|
66
|
-
});
|
|
67
|
-
} catch (error) {
|
|
68
|
-
domainContext.setError(error.message);
|
|
69
|
-
// eslint-disable-next-line consistent-return
|
|
70
|
-
return false; // 防止 Dialog 关闭
|
|
71
|
-
} finally {
|
|
72
|
-
setState({
|
|
73
|
-
loading: false
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
35
|
const setting = {
|
|
78
36
|
title: title || t('router.domainAlias.add.title'),
|
|
79
37
|
// eslint-disable-next-line react/no-unstable-nested-components
|
|
@@ -108,7 +66,6 @@ function AddDomainAliasComponent({
|
|
|
108
66
|
domain: '',
|
|
109
67
|
__disableConfirm: true
|
|
110
68
|
},
|
|
111
|
-
onConfirm,
|
|
112
69
|
onCancel
|
|
113
70
|
};
|
|
114
71
|
const onMenuItemClick = e => {
|
|
@@ -139,14 +96,13 @@ function AddDomainAliasComponent({
|
|
|
139
96
|
confirm: state.confirmSetting.confirm,
|
|
140
97
|
cancel: state.confirmSetting.cancel,
|
|
141
98
|
params: state.confirmSetting.params,
|
|
142
|
-
onConfirm: state.confirmSetting.onConfirm,
|
|
143
99
|
onCancel: state.confirmSetting.onCancel,
|
|
144
100
|
showConfirm: false,
|
|
145
101
|
showCancel: true,
|
|
146
102
|
displayError: false,
|
|
147
103
|
color: "primary",
|
|
148
104
|
loading: state.loading,
|
|
149
|
-
maxWidth: "
|
|
105
|
+
maxWidth: "sm"
|
|
150
106
|
})]
|
|
151
107
|
});
|
|
152
108
|
}
|
|
@@ -15,15 +15,17 @@ import Typography from '@mui/material/Typography';
|
|
|
15
15
|
import useTheme from '@mui/material/styles/useTheme';
|
|
16
16
|
import noop from 'lodash/noop';
|
|
17
17
|
import trim from 'lodash/trim';
|
|
18
|
+
import pRetry from 'p-retry';
|
|
18
19
|
import PropTypes from 'prop-types';
|
|
19
20
|
import useAsync from 'react-use/lib/useAsync';
|
|
20
21
|
import useSetState from 'react-use/lib/useSetState';
|
|
21
22
|
import { useDomainContext } from '../../contexts/domain';
|
|
22
23
|
import { useNodeContext } from '../../contexts/node';
|
|
23
|
-
import {
|
|
24
|
+
import { validateDomain } from '../../util';
|
|
24
25
|
import { axios } from '../../util/api';
|
|
25
26
|
import DNSTip from './dns-tip';
|
|
26
27
|
import { parseDomainFromURL } from './util';
|
|
28
|
+
import ConfirmDialog from '../../../lib/confirm';
|
|
27
29
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
28
30
|
export default function AddDomain({
|
|
29
31
|
siteId,
|
|
@@ -34,9 +36,14 @@ export default function AddDomain({
|
|
|
34
36
|
appId,
|
|
35
37
|
appPk,
|
|
36
38
|
onSuccess,
|
|
39
|
+
onError,
|
|
37
40
|
disabled,
|
|
38
41
|
autoFocus,
|
|
39
42
|
inBlockletSetup,
|
|
43
|
+
shouldCheckDomain,
|
|
44
|
+
onStateChange,
|
|
45
|
+
currentIp,
|
|
46
|
+
resolveDomain,
|
|
40
47
|
...props
|
|
41
48
|
}) {
|
|
42
49
|
const {
|
|
@@ -53,7 +60,7 @@ export default function AddDomain({
|
|
|
53
60
|
key: 'sm'
|
|
54
61
|
});
|
|
55
62
|
const [state, setState] = useSetState({
|
|
56
|
-
|
|
63
|
+
submittingDomain: false,
|
|
57
64
|
domain: defaultCustomDomain,
|
|
58
65
|
error: null,
|
|
59
66
|
type: info?.nftDomainUrl ? 'nftDomain' : 'inputDomain',
|
|
@@ -80,6 +87,151 @@ export default function AddDomain({
|
|
|
80
87
|
});
|
|
81
88
|
}
|
|
82
89
|
const nftDomainService = nftDomainURLState.value;
|
|
90
|
+
const resetState = () => {
|
|
91
|
+
setState({
|
|
92
|
+
invalidDNSDomain: null
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
const addDomain = async domain => {
|
|
96
|
+
onStateChange(t('setup.domain.addingDomain'));
|
|
97
|
+
await api.addDomainAlias({
|
|
98
|
+
input: {
|
|
99
|
+
id: siteId,
|
|
100
|
+
domainAlias: domain,
|
|
101
|
+
teamDid,
|
|
102
|
+
inBlockletSetup: true
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
setState({
|
|
106
|
+
submittingDomain: false
|
|
107
|
+
});
|
|
108
|
+
onSuccess({
|
|
109
|
+
domain,
|
|
110
|
+
type: 'inputDomain'
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
const submitDomain = async ({
|
|
114
|
+
domain,
|
|
115
|
+
type,
|
|
116
|
+
nftDid,
|
|
117
|
+
chainHost
|
|
118
|
+
}) => {
|
|
119
|
+
try {
|
|
120
|
+
if (!shouldCheckDomain) {
|
|
121
|
+
if (type === 'inputDomain') {
|
|
122
|
+
await addDomain(domain);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
onSuccess({
|
|
126
|
+
domain,
|
|
127
|
+
type,
|
|
128
|
+
nftDid,
|
|
129
|
+
chainHost
|
|
130
|
+
});
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
onStateChange({
|
|
134
|
+
text: t('setup.domain.checkingResolvable')
|
|
135
|
+
});
|
|
136
|
+
let counter = 30;
|
|
137
|
+
const timeout = 3000;
|
|
138
|
+
const retries = import.meta.env?.PROD || process?.env?.NODE_ENV === 'production' ? counter * 1000 / timeout : 0; // 重试 10 * 3000 = 30s 左右
|
|
139
|
+
|
|
140
|
+
const timer = setInterval(() => {
|
|
141
|
+
if (counter <= 0) {
|
|
142
|
+
clearInterval(timer);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
onStateChange({
|
|
146
|
+
text: `${t('setup.domain.checkingResolvable')} (${counter--}s)`
|
|
147
|
+
});
|
|
148
|
+
}, 1000);
|
|
149
|
+
const address = await pRetry(async () => {
|
|
150
|
+
const {
|
|
151
|
+
data
|
|
152
|
+
} = await resolveDomain(domain);
|
|
153
|
+
if (!data.address) {
|
|
154
|
+
throw new Error('Cannot resolve domain');
|
|
155
|
+
}
|
|
156
|
+
return data.address;
|
|
157
|
+
}, {
|
|
158
|
+
retries,
|
|
159
|
+
minTimeout: timeout,
|
|
160
|
+
maxTimeout: timeout,
|
|
161
|
+
onFailedAttempt: console.error
|
|
162
|
+
}).catch(console.error);
|
|
163
|
+
clearInterval(timer);
|
|
164
|
+
if (!address) {
|
|
165
|
+
const err = t('setup.domain.cannotResolve', {
|
|
166
|
+
domain
|
|
167
|
+
});
|
|
168
|
+
if (type === 'nftDomain') {
|
|
169
|
+
Toast.error(err);
|
|
170
|
+
onSuccess({
|
|
171
|
+
domain,
|
|
172
|
+
type: 'nftDomain'
|
|
173
|
+
});
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
onStateChange({
|
|
177
|
+
text: ''
|
|
178
|
+
});
|
|
179
|
+
setState({
|
|
180
|
+
invalidDNSDomain: {
|
|
181
|
+
domain,
|
|
182
|
+
error: err
|
|
183
|
+
},
|
|
184
|
+
domain,
|
|
185
|
+
type,
|
|
186
|
+
submittingDomain: false
|
|
187
|
+
});
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
if (address !== currentIp) {
|
|
191
|
+
const err = t('setup.domain.resolvedAddressError', {
|
|
192
|
+
domain,
|
|
193
|
+
curDomain: window.location.hostname
|
|
194
|
+
});
|
|
195
|
+
if (type === 'nftDomain') {
|
|
196
|
+
Toast.error(err);
|
|
197
|
+
onSuccess({
|
|
198
|
+
domain,
|
|
199
|
+
type: 'nftDomain'
|
|
200
|
+
});
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
onStateChange({
|
|
204
|
+
text: ''
|
|
205
|
+
});
|
|
206
|
+
setState({
|
|
207
|
+
invalidDNSDomain: {
|
|
208
|
+
domain,
|
|
209
|
+
error: err
|
|
210
|
+
},
|
|
211
|
+
domain,
|
|
212
|
+
type,
|
|
213
|
+
submittingDomain: false
|
|
214
|
+
});
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
if (type === 'nftDomain') {
|
|
218
|
+
onSuccess({
|
|
219
|
+
domain,
|
|
220
|
+
type: 'nftDomain'
|
|
221
|
+
});
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
await addDomain(domain);
|
|
225
|
+
} catch (err) {
|
|
226
|
+
Toast.error(err.message);
|
|
227
|
+
onStateChange({
|
|
228
|
+
text: ''
|
|
229
|
+
});
|
|
230
|
+
setState({
|
|
231
|
+
submittingDomain: false
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
};
|
|
83
235
|
const handleAuthSuccess = async ({
|
|
84
236
|
domain,
|
|
85
237
|
nftDid,
|
|
@@ -87,6 +239,9 @@ export default function AddDomain({
|
|
|
87
239
|
}) => {
|
|
88
240
|
try {
|
|
89
241
|
const tmpDomain = parseDomainFromURL(domain);
|
|
242
|
+
setState({
|
|
243
|
+
submittingDomain: true
|
|
244
|
+
});
|
|
90
245
|
await api.addDomainAlias({
|
|
91
246
|
input: {
|
|
92
247
|
id: siteId,
|
|
@@ -98,14 +253,14 @@ export default function AddDomain({
|
|
|
98
253
|
inBlockletSetup
|
|
99
254
|
}
|
|
100
255
|
});
|
|
101
|
-
|
|
256
|
+
const type = 'nftDomain';
|
|
102
257
|
setState({
|
|
103
258
|
showNFTDomainAuth: false,
|
|
104
|
-
type
|
|
259
|
+
type
|
|
105
260
|
});
|
|
106
|
-
|
|
261
|
+
await submitDomain({
|
|
107
262
|
domain: tmpDomain,
|
|
108
|
-
type
|
|
263
|
+
type,
|
|
109
264
|
nftDid,
|
|
110
265
|
chainHost
|
|
111
266
|
});
|
|
@@ -113,14 +268,15 @@ export default function AddDomain({
|
|
|
113
268
|
Toast.error(error.message);
|
|
114
269
|
} finally {
|
|
115
270
|
setState({
|
|
116
|
-
showNFTDomainAuth: false
|
|
271
|
+
showNFTDomainAuth: false,
|
|
272
|
+
submittingDomain: false
|
|
117
273
|
});
|
|
118
274
|
}
|
|
119
275
|
};
|
|
120
276
|
const handleAdd = async () => {
|
|
121
277
|
try {
|
|
122
278
|
setState({
|
|
123
|
-
|
|
279
|
+
submittingDomain: true
|
|
124
280
|
});
|
|
125
281
|
const domain = parseDomainFromURL(state.domain);
|
|
126
282
|
if (info.nftDomainUrl && nftDomainService) {
|
|
@@ -136,35 +292,29 @@ export default function AddDomain({
|
|
|
136
292
|
return;
|
|
137
293
|
}
|
|
138
294
|
}
|
|
139
|
-
await
|
|
140
|
-
input: {
|
|
141
|
-
id: siteId,
|
|
142
|
-
domainAlias: domain,
|
|
143
|
-
teamDid
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
await sleep(2000);
|
|
147
|
-
setState({
|
|
148
|
-
loading: false,
|
|
149
|
-
domain: ''
|
|
150
|
-
});
|
|
151
|
-
onSuccess({
|
|
295
|
+
await submitDomain({
|
|
152
296
|
domain,
|
|
153
297
|
type: state.type
|
|
154
298
|
});
|
|
155
299
|
} catch (error) {
|
|
156
|
-
domainContext.setError(error.message);
|
|
157
300
|
setState({
|
|
158
|
-
|
|
301
|
+
submittingDomain: false
|
|
159
302
|
});
|
|
303
|
+
domainContext.setError(error.message);
|
|
160
304
|
}
|
|
161
305
|
};
|
|
162
306
|
const error = domainContext.error || state.error; // TODO: state error 可能不需要了
|
|
163
307
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
308
|
+
return /*#__PURE__*/_jsx(Box, {
|
|
309
|
+
...props,
|
|
310
|
+
children: /*#__PURE__*/_jsxs(Box, {
|
|
311
|
+
sx: {
|
|
312
|
+
display: 'flex',
|
|
313
|
+
flexDirection: 'column',
|
|
314
|
+
justifyContent: 'flex-start',
|
|
315
|
+
gap: '1em'
|
|
316
|
+
},
|
|
317
|
+
children: [/*#__PURE__*/_jsxs(Box, {
|
|
168
318
|
sx: {
|
|
169
319
|
display: 'flex',
|
|
170
320
|
flexDirection: 'column',
|
|
@@ -172,7 +322,6 @@ export default function AddDomain({
|
|
|
172
322
|
},
|
|
173
323
|
children: [info.nftDomainUrl && nftDomainService && /*#__PURE__*/_jsxs(Box, {
|
|
174
324
|
sx: {
|
|
175
|
-
maxWidth: '640px',
|
|
176
325
|
color: theme.palette.text.primary
|
|
177
326
|
},
|
|
178
327
|
children: [/*#__PURE__*/_jsx(Typography, {
|
|
@@ -195,7 +344,8 @@ export default function AddDomain({
|
|
|
195
344
|
})]
|
|
196
345
|
}), /*#__PURE__*/_jsx(TextField, {
|
|
197
346
|
sx: {
|
|
198
|
-
display: 'block'
|
|
347
|
+
display: 'block',
|
|
348
|
+
marginTop: '8px'
|
|
199
349
|
},
|
|
200
350
|
label: t('router.domainAlias.add.domainDescription'),
|
|
201
351
|
helperText: state.type === 'inputDomain' && error || t('router.domainAlias.add.helperText'),
|
|
@@ -242,7 +392,7 @@ export default function AddDomain({
|
|
|
242
392
|
"data-cy": "confirm-add-domain",
|
|
243
393
|
fullWidth: isMobile,
|
|
244
394
|
variant: "contained",
|
|
245
|
-
loading: state.
|
|
395
|
+
loading: state.submittingDomain,
|
|
246
396
|
onClick: handleAdd,
|
|
247
397
|
children: t('common.add')
|
|
248
398
|
})
|
|
@@ -269,40 +419,16 @@ export default function AddDomain({
|
|
|
269
419
|
marginTop: '4px'
|
|
270
420
|
}
|
|
271
421
|
})]
|
|
272
|
-
})
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
});
|
|
283
|
-
return /*#__PURE__*/_jsx(Box, {
|
|
284
|
-
...props,
|
|
285
|
-
children: /*#__PURE__*/_jsxs(Box, {
|
|
286
|
-
sx: {
|
|
287
|
-
display: 'flex',
|
|
288
|
-
flexDirection: 'column',
|
|
289
|
-
justifyContent: 'flex-start',
|
|
290
|
-
gap: '1em'
|
|
291
|
-
},
|
|
292
|
-
children: [inputDomainTypes.map((type, index) => /*#__PURE__*/_jsxs(Box, {
|
|
293
|
-
children: [inputDomainTypes.length > 1 && /*#__PURE__*/_jsx(Box, {
|
|
294
|
-
sx: {
|
|
295
|
-
fontWeight: 700,
|
|
296
|
-
color: theme.palette.text.primary
|
|
297
|
-
},
|
|
298
|
-
children: `${t(`optionsOrder.${index + 1}`)}: ${domainTypes[type]?.name}`
|
|
299
|
-
}), /*#__PURE__*/_jsx(Box, {
|
|
300
|
-
sx: {
|
|
301
|
-
marginTop: '8px'
|
|
302
|
-
},
|
|
303
|
-
children: domainTypes[type]?.component
|
|
304
|
-
})]
|
|
305
|
-
}, type)), nftDomainService && /*#__PURE__*/_jsx(Connect, {
|
|
422
|
+
}), state.invalidDNSDomain && /*#__PURE__*/_jsx(ConfirmDialog, {
|
|
423
|
+
title: t('common.reminder'),
|
|
424
|
+
description: t('setup.domain.invalidDNSReminder', {
|
|
425
|
+
error: state.invalidDNSDomain.error
|
|
426
|
+
}),
|
|
427
|
+
color: "primary",
|
|
428
|
+
confirm: t('setup.domain.continueAdd'),
|
|
429
|
+
onConfirm: () => addDomain(state.invalidDNSDomain.domain, state.type),
|
|
430
|
+
onCancel: resetState
|
|
431
|
+
}), nftDomainService && /*#__PURE__*/_jsx(Connect, {
|
|
306
432
|
open: state.showNFTDomainAuth,
|
|
307
433
|
popup: true,
|
|
308
434
|
useSocket: false,
|
|
@@ -319,7 +445,7 @@ export default function AddDomain({
|
|
|
319
445
|
onSuccess: handleAuthSuccess,
|
|
320
446
|
onClose: () => setState({
|
|
321
447
|
showNFTDomainAuth: false,
|
|
322
|
-
|
|
448
|
+
submittingDomain: false
|
|
323
449
|
}),
|
|
324
450
|
checkTimeout: 60 * 5000,
|
|
325
451
|
showDownload: false,
|
|
@@ -335,6 +461,7 @@ export default function AddDomain({
|
|
|
335
461
|
}
|
|
336
462
|
AddDomain.propTypes = {
|
|
337
463
|
siteId: PropTypes.string.isRequired,
|
|
464
|
+
currentIp: PropTypes.string,
|
|
338
465
|
teamDid: PropTypes.string.isRequired,
|
|
339
466
|
cnameDomain: PropTypes.string.isRequired,
|
|
340
467
|
defaultCustomDomain: PropTypes.string,
|
|
@@ -344,15 +471,24 @@ AddDomain.propTypes = {
|
|
|
344
471
|
appPk: PropTypes.string,
|
|
345
472
|
disabled: PropTypes.bool,
|
|
346
473
|
autoFocus: PropTypes.bool,
|
|
347
|
-
inBlockletSetup: PropTypes.bool
|
|
474
|
+
inBlockletSetup: PropTypes.bool,
|
|
475
|
+
shouldCheckDomain: PropTypes.bool,
|
|
476
|
+
onStateChange: PropTypes.func,
|
|
477
|
+
resolveDomain: PropTypes.func,
|
|
478
|
+
onError: PropTypes.func
|
|
348
479
|
};
|
|
349
480
|
AddDomain.defaultProps = {
|
|
350
481
|
defaultCustomDomain: '',
|
|
482
|
+
currentIp: '',
|
|
351
483
|
onInputDomain: noop,
|
|
352
484
|
onSuccess: noop,
|
|
353
485
|
appId: '',
|
|
354
486
|
appPk: '',
|
|
355
487
|
disabled: false,
|
|
356
488
|
autoFocus: true,
|
|
357
|
-
inBlockletSetup: false
|
|
489
|
+
inBlockletSetup: false,
|
|
490
|
+
shouldCheckDomain: false,
|
|
491
|
+
onStateChange: () => {},
|
|
492
|
+
resolveDomain: () => {},
|
|
493
|
+
onError: () => {}
|
|
358
494
|
};
|
package/lib/contexts/domain.js
CHANGED
|
@@ -3,7 +3,6 @@ import trim from 'lodash/trim';
|
|
|
3
3
|
import { createContext, useContext } from 'react';
|
|
4
4
|
import useSetState from 'react-use/lib/useSetState';
|
|
5
5
|
import { validateDomain } from '../util';
|
|
6
|
-
import { useNodeContext } from './node';
|
|
7
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
7
|
const DomainContext = /*#__PURE__*/createContext({});
|
|
9
8
|
const {
|
|
@@ -20,12 +19,8 @@ function DomainProvider({
|
|
|
20
19
|
error: null
|
|
21
20
|
});
|
|
22
21
|
const {
|
|
23
|
-
locale
|
|
24
|
-
t
|
|
22
|
+
locale
|
|
25
23
|
} = useLocaleContext();
|
|
26
|
-
const {
|
|
27
|
-
api
|
|
28
|
-
} = useNodeContext();
|
|
29
24
|
const value = {
|
|
30
25
|
error: state.error,
|
|
31
26
|
domain: state.domain,
|
|
@@ -41,22 +36,6 @@ function DomainProvider({
|
|
|
41
36
|
domain: tmpDomain,
|
|
42
37
|
error: errMessage
|
|
43
38
|
});
|
|
44
|
-
},
|
|
45
|
-
validateDomain: async (domain, type) => {
|
|
46
|
-
if (!state.error && type && type !== 'nftDomain') {
|
|
47
|
-
const result = await api.isDidDomain({
|
|
48
|
-
input: {
|
|
49
|
-
domain
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
if (result.value === true) {
|
|
53
|
-
setState({
|
|
54
|
-
error: t('router.domainAlias.add.isDidDomainError')
|
|
55
|
-
});
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return true;
|
|
60
39
|
}
|
|
61
40
|
};
|
|
62
41
|
return /*#__PURE__*/_jsx(Provider, {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import joinUrl from 'url-join';
|
|
2
2
|
import { WELLKNOWN_SERVICE_PATH_PREFIX } from '@abtnode/constant';
|
|
3
3
|
import { useNodeContext } from '../contexts/node';
|
|
4
|
-
import { formatRegistryLogoPath, APP_PREFIX, isDownloading } from '../util';
|
|
4
|
+
import { formatRegistryLogoPath, APP_PREFIX, isDownloading, isExtracting } from '../util';
|
|
5
5
|
export default function useAvatar({
|
|
6
6
|
blocklet,
|
|
7
7
|
ancestors = []
|
|
@@ -10,7 +10,8 @@ export default function useAvatar({
|
|
|
10
10
|
const {
|
|
11
11
|
inService
|
|
12
12
|
} = node;
|
|
13
|
-
const
|
|
13
|
+
const pending = isDownloading(blocklet?.status) || isExtracting(blocklet?.status);
|
|
14
|
+
const search = `?v=${blocklet?.meta?.version}${pending ? '~' : ''}`;
|
|
14
15
|
let logoUrl = inService ? joinUrl(APP_PREFIX, WELLKNOWN_SERVICE_PATH_PREFIX, '/blocklet/logo-bundle', search) : joinUrl(node.imgPrefix, 'blocklet.png');
|
|
15
16
|
if (blocklet.source === 'registry' && blocklet.deployedFrom && blocklet.meta.logo) {
|
|
16
17
|
logoUrl = joinUrl(blocklet.deployedFrom, formatRegistryLogoPath(blocklet.meta.bundleDid, blocklet.meta.logo), search);
|
package/lib/layout/addon.js
CHANGED
|
@@ -25,27 +25,13 @@ export default function HeaderAddon({
|
|
|
25
25
|
locale
|
|
26
26
|
} = useContext(LocaleContext);
|
|
27
27
|
const location = useLocation();
|
|
28
|
-
const defaultEndpoint = 'https://developer.blocklet.io/docs';
|
|
29
|
-
const docMap = {
|
|
30
|
-
'/store': {
|
|
31
|
-
endpoint: 'https://store.blocklet.io'
|
|
32
|
-
},
|
|
33
|
-
'/dashboard': {
|
|
34
|
-
path: '/conceptual/overview'
|
|
35
|
-
},
|
|
36
|
-
'/settings/router': {
|
|
37
|
-
path: '/conceptual/server-architecture'
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
28
|
const onHelpClick = () => {
|
|
41
29
|
const pathName = location.pathname;
|
|
42
|
-
let doc = {};
|
|
43
30
|
if (pathName.indexOf('/store') > -1) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
doc = docMap[pathName];
|
|
31
|
+
window.open('https://www.arcblock.io/content/docs/createblocklet', '_blank');
|
|
32
|
+
return;
|
|
47
33
|
}
|
|
48
|
-
window.open(
|
|
34
|
+
window.open('https://www.arcblock.io/content/docs/blocklet-developer', '_blank');
|
|
49
35
|
};
|
|
50
36
|
return /*#__PURE__*/_jsxs(Div, {
|
|
51
37
|
children: [extraItems.map((x, index) => /*#__PURE__*/cloneElement(x, {
|