@abtnode/ux 1.16.15-beta-58d50c9a → 1.16.15-beta-e143b1cf
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/actions.js +6 -3
- package/es/blocklet/component/domain-list.js +274 -0
- package/es/blocklet/configuration.js +18 -119
- package/es/blocklet/overview.js +6 -147
- package/es/blocklet/router/action/add-domain-alias.js +23 -11
- package/es/blocklet/router/dns-tip.js +101 -0
- package/es/blocklet/router/domain-actions.js +1 -0
- package/es/clear-cache.js +78 -0
- package/es/confirm.js +3 -1
- package/es/locales/en.js +15 -1
- package/es/locales/zh.js +15 -1
- package/es/subscription.js +22 -10
- package/es/util/index.js +13 -12
- package/lib/actions.js +8 -5
- package/lib/blocklet/component/domain-list.js +289 -0
- package/lib/blocklet/configuration.js +16 -123
- package/lib/blocklet/overview.js +7 -140
- package/lib/blocklet/router/action/add-domain-alias.js +23 -11
- package/lib/blocklet/router/dns-tip.js +117 -0
- package/lib/blocklet/router/domain-actions.js +1 -0
- package/lib/clear-cache.js +93 -0
- package/lib/confirm.js +24 -14
- package/lib/locales/en.js +15 -1
- package/lib/locales/zh.js +15 -1
- package/lib/subscription.js +22 -10
- package/lib/util/index.js +14 -12
- package/package.json +7 -7
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
1
|
import PropTypes from 'prop-types';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { isDidDomain, isSlpDomain } from '@abtnode/util/lib/url-evaluation';
|
|
4
|
+
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
3
5
|
import AddIcon from '@mui/icons-material/CallMerge';
|
|
4
6
|
import Spinner from '@mui/material/CircularProgress';
|
|
5
|
-
import Typography from '@mui/material/Typography';
|
|
6
|
-
import TextField from '@mui/material/TextField';
|
|
7
7
|
import MenuItem from '@mui/material/MenuItem';
|
|
8
|
-
import
|
|
8
|
+
import TextField from '@mui/material/TextField';
|
|
9
|
+
import Typography from '@mui/material/Typography';
|
|
9
10
|
import Confirm from '../../../confirm';
|
|
10
|
-
import { formatError, sleep } from '../../../util';
|
|
11
11
|
import { useNodeContext } from '../../../contexts/node';
|
|
12
|
+
import { formatError, sleep } from '../../../util';
|
|
13
|
+
import DNSTip from '../dns-tip';
|
|
12
14
|
import { parseDomainFromURL, validateDomain } from '../util';
|
|
13
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
16
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -17,7 +19,8 @@ export default function AddDomainAlias({
|
|
|
17
19
|
id,
|
|
18
20
|
children,
|
|
19
21
|
title,
|
|
20
|
-
teamDid
|
|
22
|
+
teamDid,
|
|
23
|
+
systemDomains
|
|
21
24
|
}) {
|
|
22
25
|
const {
|
|
23
26
|
t
|
|
@@ -27,6 +30,10 @@ export default function AddDomainAlias({
|
|
|
27
30
|
} = useNodeContext();
|
|
28
31
|
const [loading, setLoading] = useState(false);
|
|
29
32
|
const [confirmSetting, setConfirmSetting] = useState(null);
|
|
33
|
+
let cnameDomain = systemDomains.find(item => isSlpDomain(item));
|
|
34
|
+
if (!cnameDomain) {
|
|
35
|
+
cnameDomain = systemDomains.find(item => isDidDomain(item));
|
|
36
|
+
}
|
|
30
37
|
const onCancel = () => {
|
|
31
38
|
setLoading(false);
|
|
32
39
|
setConfirmSetting(null);
|
|
@@ -62,9 +69,9 @@ export default function AddDomainAlias({
|
|
|
62
69
|
const setting = {
|
|
63
70
|
title: title || t('router.domainAlias.add.title'),
|
|
64
71
|
// eslint-disable-next-line react/no-unstable-nested-components
|
|
65
|
-
description: (params, setParams, setError) => /*#__PURE__*/
|
|
72
|
+
description: (params, setParams, setError) => /*#__PURE__*/_jsxs(Typography, {
|
|
66
73
|
component: "div",
|
|
67
|
-
children: /*#__PURE__*/_jsx(TextField, {
|
|
74
|
+
children: [/*#__PURE__*/_jsx(TextField, {
|
|
68
75
|
label: t('router.domainAlias.add.domainDescription'),
|
|
69
76
|
helperText: t('router.domainAlias.add.helperText'),
|
|
70
77
|
autoComplete: "off",
|
|
@@ -107,7 +114,10 @@ export default function AddDomainAlias({
|
|
|
107
114
|
}
|
|
108
115
|
}
|
|
109
116
|
}
|
|
110
|
-
})
|
|
117
|
+
}), /*#__PURE__*/_jsx(DNSTip, {
|
|
118
|
+
domain: params.domain,
|
|
119
|
+
resolvedTarget: cnameDomain
|
|
120
|
+
})]
|
|
111
121
|
}),
|
|
112
122
|
confirm: t('common.confirm'),
|
|
113
123
|
cancel: t('common.cancel'),
|
|
@@ -148,7 +158,8 @@ export default function AddDomainAlias({
|
|
|
148
158
|
onConfirm: confirmSetting.onConfirm,
|
|
149
159
|
onCancel: confirmSetting.onCancel,
|
|
150
160
|
color: "primary",
|
|
151
|
-
loading: loading
|
|
161
|
+
loading: loading,
|
|
162
|
+
maxWidth: "lg"
|
|
152
163
|
})]
|
|
153
164
|
});
|
|
154
165
|
}
|
|
@@ -156,7 +167,8 @@ AddDomainAlias.propTypes = {
|
|
|
156
167
|
id: PropTypes.string.isRequired,
|
|
157
168
|
children: PropTypes.any,
|
|
158
169
|
title: PropTypes.string,
|
|
159
|
-
teamDid: PropTypes.string
|
|
170
|
+
teamDid: PropTypes.string,
|
|
171
|
+
systemDomains: PropTypes.arrayOf(PropTypes.string).isRequired
|
|
160
172
|
};
|
|
161
173
|
AddDomainAlias.defaultProps = {
|
|
162
174
|
children: null,
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { CopyButton } from '@arcblock/ux/lib/ClickToCopy';
|
|
2
|
+
import InfoRow from '@arcblock/ux/lib/InfoRow';
|
|
3
|
+
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
4
|
+
import { Typography } from '@mui/material';
|
|
5
|
+
import Box from '@mui/material/Box';
|
|
6
|
+
import useTheme from '@mui/material/styles/useTheme';
|
|
7
|
+
import useMediaQuery from '@mui/material/useMediaQuery';
|
|
8
|
+
import PropTypes from 'prop-types';
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
export default function DNSTip({
|
|
12
|
+
domain,
|
|
13
|
+
resolvedTarget,
|
|
14
|
+
...rest
|
|
15
|
+
}) {
|
|
16
|
+
const {
|
|
17
|
+
t,
|
|
18
|
+
locale
|
|
19
|
+
} = useLocaleContext();
|
|
20
|
+
return /*#__PURE__*/_jsxs(Box, {
|
|
21
|
+
sx: {
|
|
22
|
+
backgroundColor: 'rgb(236, 251, 253)',
|
|
23
|
+
borderColor: 'rgb(236, 251, 253)',
|
|
24
|
+
borderRadius: '8px',
|
|
25
|
+
padding: '12px'
|
|
26
|
+
},
|
|
27
|
+
...rest,
|
|
28
|
+
children: [/*#__PURE__*/_jsxs(Box, {
|
|
29
|
+
display: "flex",
|
|
30
|
+
children: [t('router.domain.setup.tipStart'), domain && /*#__PURE__*/_jsx(Box, {
|
|
31
|
+
mx: 0.5,
|
|
32
|
+
color: "primary.main",
|
|
33
|
+
fontWeight: "fontWeightBold",
|
|
34
|
+
children: domain
|
|
35
|
+
}), t('router.domain.setup.tipEnd'), ":"]
|
|
36
|
+
}), /*#__PURE__*/_jsxs(Box, {
|
|
37
|
+
sx: {
|
|
38
|
+
'&>div': {
|
|
39
|
+
mb: 0
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
children: [/*#__PURE__*/_jsx(Tip, {
|
|
43
|
+
label: t('router.domain.setup.recordType'),
|
|
44
|
+
value: "CNAME",
|
|
45
|
+
locale: locale
|
|
46
|
+
}), /*#__PURE__*/_jsx(Tip, {
|
|
47
|
+
label: t('router.domain.setup.recordValue'),
|
|
48
|
+
value: resolvedTarget,
|
|
49
|
+
locale: locale
|
|
50
|
+
})]
|
|
51
|
+
})]
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
DNSTip.propTypes = {
|
|
55
|
+
domain: PropTypes.string,
|
|
56
|
+
resolvedTarget: PropTypes.string.isRequired
|
|
57
|
+
};
|
|
58
|
+
DNSTip.defaultProps = {
|
|
59
|
+
domain: ''
|
|
60
|
+
};
|
|
61
|
+
function Tip({
|
|
62
|
+
locale,
|
|
63
|
+
label,
|
|
64
|
+
value
|
|
65
|
+
}) {
|
|
66
|
+
const isMobile = useMediaQuery(theme => theme.breakpoints.down('md'));
|
|
67
|
+
const theme = useTheme();
|
|
68
|
+
return /*#__PURE__*/_jsx(InfoRow, {
|
|
69
|
+
name: label,
|
|
70
|
+
nameWidth: 120,
|
|
71
|
+
children: /*#__PURE__*/_jsxs(Box, {
|
|
72
|
+
sx: {
|
|
73
|
+
display: 'flex',
|
|
74
|
+
alignItems: 'center',
|
|
75
|
+
lineHeight: 1
|
|
76
|
+
},
|
|
77
|
+
children: [/*#__PURE__*/_jsx(Typography, {
|
|
78
|
+
component: "span",
|
|
79
|
+
color: "primary.main",
|
|
80
|
+
wordWrap: "break-word",
|
|
81
|
+
overflow: "auto",
|
|
82
|
+
sx: isMobile ? {
|
|
83
|
+
maxWidth: '95%'
|
|
84
|
+
} : {},
|
|
85
|
+
children: value
|
|
86
|
+
}), /*#__PURE__*/_jsx(CopyButton, {
|
|
87
|
+
content: value,
|
|
88
|
+
locale: locale,
|
|
89
|
+
style: {
|
|
90
|
+
marginLeft: '4px',
|
|
91
|
+
color: theme.palette.text.secondary
|
|
92
|
+
}
|
|
93
|
+
})]
|
|
94
|
+
})
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
Tip.propTypes = {
|
|
98
|
+
locale: PropTypes.string.isRequired,
|
|
99
|
+
label: PropTypes.string.isRequired,
|
|
100
|
+
value: PropTypes.string.isRequired
|
|
101
|
+
};
|
|
@@ -20,6 +20,7 @@ export default function DomainActions({
|
|
|
20
20
|
const isCurrentDomain = domain.value === window.location.hostname;
|
|
21
21
|
return /*#__PURE__*/_jsx(Actions, {
|
|
22
22
|
"data-cy": "domain-actions",
|
|
23
|
+
size: "large",
|
|
23
24
|
actions: [
|
|
24
25
|
// eslint-disable-next-line react/no-unstable-nested-components
|
|
25
26
|
({
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import Toast from '@arcblock/ux/lib/Toast';
|
|
3
|
+
import Button from '@arcblock/ux/lib/Button';
|
|
4
|
+
import Spinner from '@mui/material/CircularProgress';
|
|
5
|
+
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
6
|
+
import { formatError } from '../lib/util';
|
|
7
|
+
import { useNodeContext } from './contexts/node';
|
|
8
|
+
import Confirm from './confirm';
|
|
9
|
+
|
|
10
|
+
// eslint-disable-next-line react/prop-types
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
export default function ClearCache({
|
|
14
|
+
teamDid,
|
|
15
|
+
size = 'small',
|
|
16
|
+
...rest
|
|
17
|
+
}) {
|
|
18
|
+
const {
|
|
19
|
+
t
|
|
20
|
+
} = useLocaleContext();
|
|
21
|
+
const {
|
|
22
|
+
api
|
|
23
|
+
} = useNodeContext();
|
|
24
|
+
const [loading, setLoading] = useState(false);
|
|
25
|
+
const [confirmSetting, setConfirmSetting] = useState(null);
|
|
26
|
+
const onCancel = () => {
|
|
27
|
+
setLoading(false);
|
|
28
|
+
setConfirmSetting(null);
|
|
29
|
+
};
|
|
30
|
+
const onConfirm = async () => {
|
|
31
|
+
try {
|
|
32
|
+
setLoading(true);
|
|
33
|
+
const result = await api.clearCache({
|
|
34
|
+
input: {
|
|
35
|
+
teamDid
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
Toast.success(t('blocklet.config.clearCache.success', {
|
|
39
|
+
count: result.removed?.length || 0
|
|
40
|
+
}));
|
|
41
|
+
} catch (err) {
|
|
42
|
+
Toast.error(formatError(err));
|
|
43
|
+
} finally {
|
|
44
|
+
setLoading(false);
|
|
45
|
+
setConfirmSetting(null);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const setting = {
|
|
49
|
+
title: t('blocklet.config.clearCache.title'),
|
|
50
|
+
description: t('blocklet.config.clearCache.description'),
|
|
51
|
+
confirm: t('common.confirm'),
|
|
52
|
+
cancel: t('common.cancel'),
|
|
53
|
+
onConfirm,
|
|
54
|
+
onCancel
|
|
55
|
+
};
|
|
56
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
57
|
+
...rest,
|
|
58
|
+
children: [/*#__PURE__*/_jsxs(Button, {
|
|
59
|
+
onClick: () => setConfirmSetting(setting),
|
|
60
|
+
color: "error",
|
|
61
|
+
variant: "outlined",
|
|
62
|
+
size: size,
|
|
63
|
+
children: [loading ? /*#__PURE__*/_jsx(Spinner, {
|
|
64
|
+
size: 16,
|
|
65
|
+
style: {
|
|
66
|
+
marginRight: 5
|
|
67
|
+
}
|
|
68
|
+
}) : null, t('blocklet.config.clearCache.action')]
|
|
69
|
+
}), confirmSetting && /*#__PURE__*/_jsx(Confirm, {
|
|
70
|
+
title: confirmSetting.title,
|
|
71
|
+
description: confirmSetting.description,
|
|
72
|
+
confirm: confirmSetting.confirm,
|
|
73
|
+
cancel: confirmSetting.cancel,
|
|
74
|
+
onConfirm: confirmSetting.onConfirm,
|
|
75
|
+
onCancel: confirmSetting.onCancel
|
|
76
|
+
})]
|
|
77
|
+
});
|
|
78
|
+
}
|
package/es/confirm.js
CHANGED
|
@@ -26,7 +26,8 @@ export default function ConfirmDialog({
|
|
|
26
26
|
params: initialParams,
|
|
27
27
|
onCancel,
|
|
28
28
|
onConfirm,
|
|
29
|
-
loading: inputLoading
|
|
29
|
+
loading: inputLoading,
|
|
30
|
+
...rest
|
|
30
31
|
}) {
|
|
31
32
|
const [params, setParams] = useState(initialParams);
|
|
32
33
|
const [open, setOpen] = useState(true);
|
|
@@ -68,6 +69,7 @@ export default function ConfirmDialog({
|
|
|
68
69
|
style: {
|
|
69
70
|
minWidth
|
|
70
71
|
},
|
|
72
|
+
...rest,
|
|
71
73
|
children: [/*#__PURE__*/_jsx(DialogTitle, {
|
|
72
74
|
children: t
|
|
73
75
|
}), /*#__PURE__*/_jsxs(DialogContent, {
|
package/es/locales/en.js
CHANGED
|
@@ -230,7 +230,7 @@ module.exports = {
|
|
|
230
230
|
protocol: 'Protocol',
|
|
231
231
|
published: 'published',
|
|
232
232
|
purchase: 'Purchase',
|
|
233
|
-
readMore: '
|
|
233
|
+
readMore: 'More',
|
|
234
234
|
redirect: 'Redirect',
|
|
235
235
|
redirectCode: 'Redirect Code',
|
|
236
236
|
redirectPermanently: 'Permanent Redirect',
|
|
@@ -449,6 +449,14 @@ module.exports = {
|
|
|
449
449
|
ttl: 'Login session validity period (user will be asked to login again if they have no activity on this site for {day} days)',
|
|
450
450
|
day: '{day} day',
|
|
451
451
|
days: '{day} days'
|
|
452
|
+
},
|
|
453
|
+
clearCache: {
|
|
454
|
+
name: 'Cache Management',
|
|
455
|
+
purpose: 'Manage files cached in router and blocklet services',
|
|
456
|
+
title: 'Confirm Cache Clear?',
|
|
457
|
+
action: 'Clear Cache',
|
|
458
|
+
success: 'Successfully cleared {count} cache entries',
|
|
459
|
+
description: 'Are you sure you want to clear cached files in router and blocklet service? this operation may cause slight performance downgrade in the short term'
|
|
452
460
|
}
|
|
453
461
|
},
|
|
454
462
|
overview: {
|
|
@@ -849,6 +857,12 @@ module.exports = {
|
|
|
849
857
|
label: 'Site Domain',
|
|
850
858
|
description: 'Please provide a valid site domain'
|
|
851
859
|
},
|
|
860
|
+
setup: {
|
|
861
|
+
tipStart: 'Please ensure that the domain name',
|
|
862
|
+
tipEnd: 'has been correctly resolved',
|
|
863
|
+
recordType: 'Record Type',
|
|
864
|
+
recordValue: 'Record Value'
|
|
865
|
+
},
|
|
852
866
|
verify: {
|
|
853
867
|
ok: 'This site is resolved',
|
|
854
868
|
notResolved: 'This site neither resolved nor accessible, please check your DNS configuration'
|
package/es/locales/zh.js
CHANGED
|
@@ -235,7 +235,7 @@ module.exports = {
|
|
|
235
235
|
protocol: '协议',
|
|
236
236
|
published: '发布于',
|
|
237
237
|
purchase: '购买',
|
|
238
|
-
readMore: '
|
|
238
|
+
readMore: '更多',
|
|
239
239
|
redirect: '重定向',
|
|
240
240
|
redirectCode: '重定向状态码',
|
|
241
241
|
redirectPermanently: '永久重定向',
|
|
@@ -454,6 +454,14 @@ module.exports = {
|
|
|
454
454
|
ttl: '登录会话有效期(如果用户 {day} 天内在此站点没有任何活动,将被要求重新登录)',
|
|
455
455
|
day: '{day} 天',
|
|
456
456
|
days: '{day} 天'
|
|
457
|
+
},
|
|
458
|
+
clearCache: {
|
|
459
|
+
name: '缓存管理',
|
|
460
|
+
purpose: '管理缓存在网关和服务中的文件',
|
|
461
|
+
title: '确认清除缓存?',
|
|
462
|
+
action: '清除缓存',
|
|
463
|
+
success: '成功清除了 {count} 个缓存条目',
|
|
464
|
+
description: '您确定要清除缓存在网关和服务中的文件吗?此操作可能会在短期内导致轻微的性能降低。'
|
|
457
465
|
}
|
|
458
466
|
},
|
|
459
467
|
overview: {
|
|
@@ -852,6 +860,12 @@ module.exports = {
|
|
|
852
860
|
label: '站点域名',
|
|
853
861
|
description: '请填写你所拥有的合法的站点域名'
|
|
854
862
|
},
|
|
863
|
+
setup: {
|
|
864
|
+
tipStart: '请确保',
|
|
865
|
+
tipEnd: '域名已经被正确解析',
|
|
866
|
+
recordType: '记录类型',
|
|
867
|
+
recordValue: '记录值'
|
|
868
|
+
},
|
|
855
869
|
verify: {
|
|
856
870
|
ok: '该站点解析正常',
|
|
857
871
|
notResolved: '改站点解析异常,请检查你域名服务商的 DNS 配置'
|
package/es/subscription.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import dayjs from '@abtnode/util/lib/dayjs';
|
|
2
2
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
3
|
-
import
|
|
3
|
+
import AccessTimeIcon from '@mui/icons-material/AccessTime';
|
|
4
4
|
import Box from '@mui/material/Box';
|
|
5
|
-
import
|
|
5
|
+
import Chip from '@mui/material/Chip';
|
|
6
6
|
import CircularProgress from '@mui/material/CircularProgress';
|
|
7
|
-
import
|
|
7
|
+
import Popover from '@mui/material/Popover';
|
|
8
|
+
import prettyMs from 'pretty-ms-i18n';
|
|
8
9
|
import PropTypes from 'prop-types';
|
|
9
10
|
import { useRef } from 'react';
|
|
10
11
|
import useAsyncRetry from 'react-use/lib/useAsyncRetry';
|
|
@@ -96,12 +97,23 @@ function Subscription({
|
|
|
96
97
|
};
|
|
97
98
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
98
99
|
children: [/*#__PURE__*/_jsx(Chip, {
|
|
99
|
-
label:
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
100
|
+
label: /*#__PURE__*/_jsxs(Box, {
|
|
101
|
+
sx: {
|
|
102
|
+
display: 'flex',
|
|
103
|
+
alignItems: 'center'
|
|
104
|
+
},
|
|
105
|
+
children: [/*#__PURE__*/_jsx(AccessTimeIcon, {
|
|
106
|
+
sx: {
|
|
107
|
+
mr: '4px'
|
|
108
|
+
},
|
|
109
|
+
fontSize: "small"
|
|
110
|
+
}), t(`expiration.tips.${status}`, {
|
|
111
|
+
validity: prettyMs(validityMs, {
|
|
112
|
+
locale: formatPrettyMsLocale(locale),
|
|
113
|
+
compact: true,
|
|
114
|
+
verbose: true
|
|
115
|
+
})
|
|
116
|
+
})]
|
|
105
117
|
}),
|
|
106
118
|
color: status,
|
|
107
119
|
variant: status !== 'success' ? 'contained' : 'outlined',
|
package/es/util/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
/* eslint-disable max-len */
|
|
2
2
|
/* eslint-disable implicit-arrow-linebreak */
|
|
3
3
|
/* eslint-disable import/prefer-default-export */
|
|
4
|
-
import {
|
|
5
|
-
import qs from 'querystring';
|
|
6
|
-
import isUrl from 'is-url';
|
|
7
|
-
import humanizeUrl from 'humanize-url';
|
|
4
|
+
import { BLOCKLET_STORE_API_PREFIX, DEFAULT_DID_DOMAIN, DEFAULT_IP_DOMAIN_SUFFIX, DEFAULT_SLP_DOMAIN, DOMAIN_FOR_DEFAULT_SITE, DOMAIN_FOR_INTERNAL_SITE, DOMAIN_FOR_IP_SITE, DOMAIN_FOR_IP_SITE_REGEXP, IP, ROLES, SLOT_FOR_IP_DNS_SITE, WEB_WALLET_URL, WELLKNOWN_PATH_PREFIX, WELLKNOWN_PING_PREFIX, WELLKNOWN_SERVICE_PATH_PREFIX } from '@abtnode/constant';
|
|
8
5
|
import filesize from 'filesize';
|
|
9
|
-
import
|
|
6
|
+
import humanizeUrl from 'humanize-url';
|
|
7
|
+
import isUrl from 'is-url';
|
|
10
8
|
import get from 'lodash/get';
|
|
11
9
|
import last from 'lodash/last';
|
|
12
10
|
import trimEnd from 'lodash/trimEnd';
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import checkAccessible from '@abtnode/util/lib/url-evaluation/check-accessible-browser';
|
|
11
|
+
import qs from 'querystring';
|
|
12
|
+
import joinUrl from 'url-join';
|
|
16
13
|
import axios from '@abtnode/util/lib/axios';
|
|
14
|
+
import dayjs from '@abtnode/util/lib/dayjs';
|
|
15
|
+
import formatError from '@abtnode/util/lib/format-error';
|
|
17
16
|
import normalizePathPrefix from '@abtnode/util/lib/normalize-path-prefix';
|
|
17
|
+
import { evaluateURLs, isDidDomain, isIpEcho, isSlpDomain } from '@abtnode/util/lib/url-evaluation';
|
|
18
|
+
import checkAccessible from '@abtnode/util/lib/url-evaluation/check-accessible-browser';
|
|
19
|
+
import { BLOCKLET_MODES } from '@blocklet/constant';
|
|
18
20
|
import urlPathFriendly from '@blocklet/meta/lib/url-path-friendly';
|
|
19
|
-
import formatError from '@abtnode/util/lib/format-error';
|
|
20
|
-
import dayjs from '@abtnode/util/lib/dayjs';
|
|
21
21
|
export { formatError };
|
|
22
22
|
export function sleep(t) {
|
|
23
23
|
// eslint-disable-next-line no-promise-executor-return
|
|
@@ -568,7 +568,7 @@ const isDidDomainOrIpEchoDomain = domain => {
|
|
|
568
568
|
if (!domain) {
|
|
569
569
|
return false;
|
|
570
570
|
}
|
|
571
|
-
return domain.endsWith(DEFAULT_DID_DOMAIN) || domain.endsWith(DEFAULT_IP_DOMAIN_SUFFIX);
|
|
571
|
+
return domain.endsWith(DEFAULT_DID_DOMAIN) || domain.endsWith(DEFAULT_IP_DOMAIN_SUFFIX) || domain.endsWith(DEFAULT_SLP_DOMAIN);
|
|
572
572
|
};
|
|
573
573
|
export const sortDomains = domains => {
|
|
574
574
|
return (domains || []).sort((x, y) => {
|
|
@@ -613,4 +613,5 @@ export const getSubscriptionURL = async ({
|
|
|
613
613
|
}
|
|
614
614
|
return joinUrl(baseUrl, `/${nftId}/subscription?locale=${locale}&return-url=${encodeURIComponent(window.location.href)}`);
|
|
615
615
|
};
|
|
616
|
-
export const nanoid = (length = 16) => [...Array(length)].map(() => Math.random().toString(36)[2]).join('');
|
|
616
|
+
export const nanoid = (length = 16) => [...Array(length)].map(() => Math.random().toString(36)[2]).join('');
|
|
617
|
+
export const getSystemDomains = domains => domains.filter(x => x.isProtected);
|
package/lib/actions.js
CHANGED
|
@@ -15,7 +15,7 @@ var _ListItemIcon = _interopRequireDefault(require("@mui/material/ListItemIcon")
|
|
|
15
15
|
var _ListItemText = _interopRequireDefault(require("@mui/material/ListItemText"));
|
|
16
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
17
|
var _templateObject;
|
|
18
|
-
const _excluded = ["actions"],
|
|
18
|
+
const _excluded = ["actions", "size"],
|
|
19
19
|
_excluded2 = ["icon", "text", "onClick", "disabled"];
|
|
20
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
21
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
@@ -28,7 +28,8 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
28
28
|
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; }
|
|
29
29
|
function Actions(_ref) {
|
|
30
30
|
let {
|
|
31
|
-
actions
|
|
31
|
+
actions,
|
|
32
|
+
size
|
|
32
33
|
} = _ref,
|
|
33
34
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
34
35
|
const [anchorEl, setAnchorEl] = (0, _react.useState)(null);
|
|
@@ -56,7 +57,7 @@ function Actions(_ref) {
|
|
|
56
57
|
"aria-haspopup": "true",
|
|
57
58
|
"data-cy": "actions-menu-icon",
|
|
58
59
|
onClick: onOpen,
|
|
59
|
-
size:
|
|
60
|
+
size: size,
|
|
60
61
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_MoreHoriz.default, {})
|
|
61
62
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Menu.default, {
|
|
62
63
|
id: "actions-menu",
|
|
@@ -104,9 +105,11 @@ function Actions(_ref) {
|
|
|
104
105
|
}));
|
|
105
106
|
}
|
|
106
107
|
Actions.propTypes = {
|
|
107
|
-
actions: _propTypes.default.array
|
|
108
|
+
actions: _propTypes.default.array,
|
|
109
|
+
size: _propTypes.default.oneOf(['small', 'medium', 'large'])
|
|
108
110
|
};
|
|
109
111
|
Actions.defaultProps = {
|
|
110
|
-
actions: []
|
|
112
|
+
actions: [],
|
|
113
|
+
size: 'small'
|
|
111
114
|
};
|
|
112
115
|
const Div = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral([""])));
|