@abtnode/ux 1.16.18-beta-aa01bd8e → 1.16.18-beta-bb4ebacc
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/actions.js +17 -6
- package/es/blocklet/add-cert.js +1 -0
- package/es/blocklet/configuration.js +28 -118
- package/es/blocklet/logo-uploader.js +131 -0
- package/es/blocklet/oauth/federated-site-list.js +1 -1
- package/es/blocklet/publish/create-release.js +2 -2
- package/es/hooks/use-passport-id.js +9 -6
- package/es/locales/en.js +25 -5
- package/es/locales/zh.js +21 -1
- package/es/logs/log-terminal.js +2 -1
- package/es/schema-form/index.js +11 -3
- package/es/team/members/connections.js +27 -0
- package/es/team/members/member.js +2 -26
- package/es/team/members/passport-item.js +104 -0
- package/es/team/members/passports.js +23 -78
- package/lib/blocklet/actions.js +17 -6
- package/lib/blocklet/add-cert.js +1 -0
- package/lib/blocklet/configuration.js +30 -90
- package/lib/blocklet/logo-uploader.js +112 -0
- package/lib/blocklet/oauth/federated-site-list.js +1 -1
- package/lib/blocklet/publish/create-release.js +2 -2
- package/lib/hooks/use-passport-id.js +9 -7
- package/lib/locales/en.js +25 -5
- package/lib/locales/zh.js +21 -1
- package/lib/logs/log-terminal.js +2 -1
- package/lib/schema-form/index.js +9 -3
- package/lib/team/members/connections.js +35 -0
- package/lib/team/members/member.js +8 -33
- package/lib/team/members/passport-item.js +95 -0
- package/lib/team/members/passports.js +26 -54
- package/package.json +18 -18
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import InfoRow from '@arcblock/ux/lib/InfoRow';
|
|
4
|
+
import DidAddress from '../../did-address';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
export default function UserConnections({
|
|
7
|
+
user
|
|
8
|
+
}) {
|
|
9
|
+
const connectedAccounts = user.connectedAccounts || [];
|
|
10
|
+
return connectedAccounts.map(account => {
|
|
11
|
+
return /*#__PURE__*/_jsx(InfoRow, {
|
|
12
|
+
style: {
|
|
13
|
+
alignItems: 'flex-start'
|
|
14
|
+
},
|
|
15
|
+
valueComponent: "div",
|
|
16
|
+
nameWidth: 120,
|
|
17
|
+
name: account.provider,
|
|
18
|
+
children: /*#__PURE__*/_jsx(DidAddress, {
|
|
19
|
+
did: account.did
|
|
20
|
+
})
|
|
21
|
+
}, account.did);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
UserConnections.propTypes = {
|
|
25
|
+
user: PropTypes.object.isRequired
|
|
26
|
+
};
|
|
27
|
+
UserConnections.defaultProps = {};
|
|
@@ -26,6 +26,7 @@ import PassportIssuances from './passport-issuances';
|
|
|
26
26
|
import Passports from './passports';
|
|
27
27
|
import ToggleUserApproval from './toggle-user-approval';
|
|
28
28
|
import { parseAvatar } from './util';
|
|
29
|
+
import UserConnections from './connections';
|
|
29
30
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
30
31
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
31
32
|
function LinkUser({
|
|
@@ -47,31 +48,6 @@ function LinkUser({
|
|
|
47
48
|
LinkUser.propTypes = {
|
|
48
49
|
name: PropTypes.string.isRequired
|
|
49
50
|
};
|
|
50
|
-
function TabOAuth({
|
|
51
|
-
user
|
|
52
|
-
}) {
|
|
53
|
-
const connectedAccounts = user.connectedAccounts || [];
|
|
54
|
-
return connectedAccounts.map(account => {
|
|
55
|
-
return /*#__PURE__*/_jsx(InfoRow, {
|
|
56
|
-
style: {
|
|
57
|
-
alignItems: 'flex-start'
|
|
58
|
-
},
|
|
59
|
-
valueComponent: "div",
|
|
60
|
-
nameWidth: 120,
|
|
61
|
-
name: account.provider,
|
|
62
|
-
children: /*#__PURE__*/_jsx(DidAddress, {
|
|
63
|
-
did: account.did
|
|
64
|
-
})
|
|
65
|
-
}, account.did);
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
TabOAuth.propTypes = {
|
|
69
|
-
user: PropTypes.object.isRequired,
|
|
70
|
-
onChangeUser: PropTypes.func
|
|
71
|
-
};
|
|
72
|
-
TabOAuth.defaultProps = {
|
|
73
|
-
onChangeUser: () => {}
|
|
74
|
-
};
|
|
75
51
|
const defaultTab = 'info';
|
|
76
52
|
export default function Member({
|
|
77
53
|
userDid,
|
|
@@ -232,7 +208,7 @@ export default function Member({
|
|
|
232
208
|
oauth: {
|
|
233
209
|
label: t('team.member.connectedAccounts'),
|
|
234
210
|
value: 'oauth',
|
|
235
|
-
component: () => /*#__PURE__*/_jsx(
|
|
211
|
+
component: () => /*#__PURE__*/_jsx(UserConnections, {
|
|
236
212
|
user: pageState.user,
|
|
237
213
|
onChangeUser: handleChangeUser
|
|
238
214
|
})
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/* eslint-disable prettier/prettier */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import styled from '@emotion/styled';
|
|
5
|
+
import upperFirst from 'lodash/upperFirst';
|
|
6
|
+
import Box from '@mui/material/Box';
|
|
7
|
+
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
8
|
+
import RevokeIcon from '@arcblock/icons/lib/RevokeIcon';
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
export default function PassportItem({
|
|
12
|
+
passport,
|
|
13
|
+
user,
|
|
14
|
+
color,
|
|
15
|
+
width,
|
|
16
|
+
icon,
|
|
17
|
+
children,
|
|
18
|
+
createPassportSvg,
|
|
19
|
+
...rest
|
|
20
|
+
}) {
|
|
21
|
+
const {
|
|
22
|
+
t
|
|
23
|
+
} = useLocaleContext();
|
|
24
|
+
return /*#__PURE__*/_jsxs(Root, {
|
|
25
|
+
display: "flex",
|
|
26
|
+
alignItems: "center",
|
|
27
|
+
...rest,
|
|
28
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
29
|
+
// eslint-disable-next-line react/no-danger
|
|
30
|
+
dangerouslySetInnerHTML: {
|
|
31
|
+
__html: createPassportSvg({
|
|
32
|
+
title: passport.title || passport.name,
|
|
33
|
+
issuer: passport.issuer && passport.issuer.name,
|
|
34
|
+
issuerDid: passport.issuer && passport.issuer.id,
|
|
35
|
+
ownerName: user.fullName,
|
|
36
|
+
ownerDid: user.did,
|
|
37
|
+
ownerAvatarUrl: user.avatar,
|
|
38
|
+
revoked: passport.revoked,
|
|
39
|
+
preferredColor: color,
|
|
40
|
+
width
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
44
|
+
className: "body",
|
|
45
|
+
children: [/*#__PURE__*/_jsxs(Box, {
|
|
46
|
+
className: "title",
|
|
47
|
+
display: "flex",
|
|
48
|
+
alignItems: "center",
|
|
49
|
+
children: [upperFirst(passport.title), /*#__PURE__*/_jsxs("div", {
|
|
50
|
+
className: "status-icons",
|
|
51
|
+
children: [icon, passport.revoked && /*#__PURE__*/_jsx(RevokeIcon, {})]
|
|
52
|
+
})]
|
|
53
|
+
}), passport.expirationDate && /*#__PURE__*/_jsx(Box, {
|
|
54
|
+
className: "title",
|
|
55
|
+
display: "flex",
|
|
56
|
+
alignItems: "center",
|
|
57
|
+
children: t('team.passport.validUntil', {
|
|
58
|
+
date: passport.expirationDate
|
|
59
|
+
})
|
|
60
|
+
}), children]
|
|
61
|
+
})]
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
PassportItem.propTypes = {
|
|
65
|
+
passport: PropTypes.any.isRequired,
|
|
66
|
+
user: PropTypes.any.isRequired,
|
|
67
|
+
color: PropTypes.string.isRequired,
|
|
68
|
+
createPassportSvg: PropTypes.func.isRequired,
|
|
69
|
+
icon: PropTypes.any,
|
|
70
|
+
children: PropTypes.any,
|
|
71
|
+
width: PropTypes.number
|
|
72
|
+
};
|
|
73
|
+
PassportItem.defaultProps = {
|
|
74
|
+
icon: null,
|
|
75
|
+
children: null,
|
|
76
|
+
width: 150
|
|
77
|
+
};
|
|
78
|
+
const Root = styled(Box)`
|
|
79
|
+
.body {
|
|
80
|
+
padding: 0;
|
|
81
|
+
margin-left: 24px;
|
|
82
|
+
margin-top: 0;
|
|
83
|
+
}
|
|
84
|
+
.title {
|
|
85
|
+
font-weight: 400;
|
|
86
|
+
font-size: 16px;
|
|
87
|
+
line-height: 19px;
|
|
88
|
+
color: #222222;
|
|
89
|
+
}
|
|
90
|
+
.tip {
|
|
91
|
+
display: flex;
|
|
92
|
+
align-items: center;
|
|
93
|
+
font-size: 14px;
|
|
94
|
+
margin-top: 6px;
|
|
95
|
+
color: #bbb;
|
|
96
|
+
}
|
|
97
|
+
.status-icons {
|
|
98
|
+
svg {
|
|
99
|
+
fill: #bfbfbf;
|
|
100
|
+
height: 1.2em;
|
|
101
|
+
margin-left: 0.4em;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
`;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/* eslint-disable prettier/prettier */
|
|
2
|
-
import { useState } from 'react';
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import styled from '@emotion/styled';
|
|
5
5
|
import get from 'lodash/get';
|
|
6
|
-
import upperFirst from 'lodash/upperFirst';
|
|
7
6
|
import Toast from '@arcblock/ux/lib/Toast';
|
|
8
7
|
import AddIcon from '@mui/icons-material/Add';
|
|
9
8
|
import Box from '@mui/material/Box';
|
|
@@ -26,6 +25,7 @@ import Permission from '../../permission';
|
|
|
26
25
|
import SearchInput from '../search-input';
|
|
27
26
|
import ListHeader from '../styles/list-header';
|
|
28
27
|
import IssuePassport from './issue-passport';
|
|
28
|
+
import PassportItem from './passport-item';
|
|
29
29
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
30
30
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
31
31
|
function ConfirmDescription({
|
|
@@ -210,60 +210,30 @@ export default function Passports({
|
|
|
210
210
|
justifyContent: "space-between",
|
|
211
211
|
alignItems: "center",
|
|
212
212
|
mt: 3,
|
|
213
|
-
children: [/*#__PURE__*/
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
213
|
+
children: [/*#__PURE__*/_jsx(PassportItem, {
|
|
214
|
+
passport: x,
|
|
215
|
+
user: user,
|
|
216
|
+
color: passportColor,
|
|
217
|
+
createPassportSvg: createPassportSvg,
|
|
218
|
+
icon: !!appIdList.length && !appIdList.includes(x.issuer.id) ? /*#__PURE__*/_jsx(ExternalIssuerIcon, {}) : null,
|
|
219
|
+
children: !!appIdList.length && !appIdList.includes(x.issuer.id) && /*#__PURE__*/_jsxs("div", {
|
|
220
|
+
className: "tip",
|
|
221
|
+
children: [x.issuer.id !== teamIssuerDid && !trustedPassports.some(y => y.issuerDid === x.issuer.id) && /*#__PURE__*/_jsx(Tooltip, {
|
|
222
|
+
title: t('team.passport.notTrustedIssuerTip'),
|
|
223
|
+
children: /*#__PURE__*/_jsx(Box, {
|
|
224
|
+
component: ErrorOutlineIcon,
|
|
225
|
+
style: {
|
|
226
|
+
fontSize: '1.3em'
|
|
227
|
+
},
|
|
228
|
+
color: "error.main",
|
|
229
|
+
mr: 0.5
|
|
229
230
|
})
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
children: [/*#__PURE__*/_jsxs(Box, {
|
|
234
|
-
className: "title",
|
|
235
|
-
display: "flex",
|
|
236
|
-
alignItems: "center",
|
|
237
|
-
children: [upperFirst(x.title), /*#__PURE__*/_jsxs("div", {
|
|
238
|
-
className: "status-icons",
|
|
239
|
-
children: [!!appIdList.length && !appIdList.includes(x.issuer.id) && /*#__PURE__*/_jsx(ExternalIssuerIcon, {}), x.revoked && /*#__PURE__*/_jsx(RevokeIcon, {})]
|
|
240
|
-
})]
|
|
241
|
-
}), x.expirationDate && /*#__PURE__*/_jsx(Box, {
|
|
242
|
-
className: "title",
|
|
243
|
-
display: "flex",
|
|
244
|
-
alignItems: "center",
|
|
245
|
-
children: t('team.passport.validUntil', {
|
|
246
|
-
date: x.expirationDate
|
|
231
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
232
|
+
children: t('team.passport.issueBy', {
|
|
233
|
+
name: x.issuer.name
|
|
247
234
|
})
|
|
248
|
-
}), !!appIdList.length && !appIdList.includes(x.issuer.id) && /*#__PURE__*/_jsxs("div", {
|
|
249
|
-
className: "tip",
|
|
250
|
-
children: [x.issuer.id !== teamIssuerDid && !trustedPassports.some(y => y.issuerDid === x.issuer.id) && /*#__PURE__*/_jsx(Tooltip, {
|
|
251
|
-
title: t('team.passport.notTrustedIssuerTip'),
|
|
252
|
-
children: /*#__PURE__*/_jsx(Box, {
|
|
253
|
-
component: ErrorOutlineIcon,
|
|
254
|
-
style: {
|
|
255
|
-
fontSize: '1.3em'
|
|
256
|
-
},
|
|
257
|
-
color: "error.main",
|
|
258
|
-
mr: 0.5
|
|
259
|
-
})
|
|
260
|
-
}), /*#__PURE__*/_jsx("span", {
|
|
261
|
-
children: t('team.passport.issueBy', {
|
|
262
|
-
name: x.issuer.name
|
|
263
|
-
})
|
|
264
|
-
})]
|
|
265
235
|
})]
|
|
266
|
-
})
|
|
236
|
+
})
|
|
267
237
|
}), /*#__PURE__*/_jsx(Box, {
|
|
268
238
|
children: revokeInfo(can, x).revokable ? /*#__PURE__*/_jsxs(Button, {
|
|
269
239
|
variant: "outlined",
|
|
@@ -326,31 +296,6 @@ Passports.defaultProps = {
|
|
|
326
296
|
};
|
|
327
297
|
const Div = styled.div`
|
|
328
298
|
.passport-item {
|
|
329
|
-
.body {
|
|
330
|
-
padding: 0;
|
|
331
|
-
margin-left: 24px;
|
|
332
|
-
margin-top: 0;
|
|
333
|
-
}
|
|
334
|
-
.title {
|
|
335
|
-
font-weight: 400;
|
|
336
|
-
font-size: 16px;
|
|
337
|
-
line-height: 19px;
|
|
338
|
-
color: #222222;
|
|
339
|
-
}
|
|
340
|
-
.tip {
|
|
341
|
-
display: flex;
|
|
342
|
-
align-items: center;
|
|
343
|
-
font-size: 14px;
|
|
344
|
-
margin-top: 6px;
|
|
345
|
-
color: #bbb;
|
|
346
|
-
}
|
|
347
|
-
.status-icons {
|
|
348
|
-
svg {
|
|
349
|
-
fill: #bfbfbf;
|
|
350
|
-
height: 1.2em;
|
|
351
|
-
margin-left: 0.4em;
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
299
|
.MuiButton-outlinedSecondary {
|
|
355
300
|
color: #f16e6e;
|
|
356
301
|
fill: #f16e6e;
|
package/lib/blocklet/actions.js
CHANGED
|
@@ -94,7 +94,6 @@ function BlockletActions(_ref) {
|
|
|
94
94
|
});
|
|
95
95
|
setLoading(true);
|
|
96
96
|
setCurrentAction(action);
|
|
97
|
-
setConfirmSetting(null);
|
|
98
97
|
let isRemoved = false;
|
|
99
98
|
try {
|
|
100
99
|
if (action === 'remove') {
|
|
@@ -151,6 +150,7 @@ function BlockletActions(_ref) {
|
|
|
151
150
|
if (action === 'reload') {
|
|
152
151
|
_Toast.default.success(t('blocklet.reloadSuccess'));
|
|
153
152
|
}
|
|
153
|
+
setConfirmSetting(null);
|
|
154
154
|
onComplete({
|
|
155
155
|
action,
|
|
156
156
|
blocklet
|
|
@@ -162,6 +162,7 @@ function BlockletActions(_ref) {
|
|
|
162
162
|
blocklet,
|
|
163
163
|
error: new Error(errMsg)
|
|
164
164
|
});
|
|
165
|
+
throw new Error(errMsg);
|
|
165
166
|
} finally {
|
|
166
167
|
if (!isRemoved) {
|
|
167
168
|
setLoading(false);
|
|
@@ -276,7 +277,6 @@ function BlockletActions(_ref) {
|
|
|
276
277
|
e.preventDefault();
|
|
277
278
|
// eslint-disable-next-line no-empty
|
|
278
279
|
} catch (_unused3) {}
|
|
279
|
-
setAnchorEl(null);
|
|
280
280
|
if (typeof action.handler === 'function') {
|
|
281
281
|
try {
|
|
282
282
|
setLoading(true);
|
|
@@ -287,7 +287,10 @@ function BlockletActions(_ref) {
|
|
|
287
287
|
console.error("Blocklet ".concat(action.name, " failed: "), err);
|
|
288
288
|
} finally {
|
|
289
289
|
setLoading(false);
|
|
290
|
+
setAnchorEl(null);
|
|
290
291
|
}
|
|
292
|
+
} else {
|
|
293
|
+
setAnchorEl(null);
|
|
291
294
|
}
|
|
292
295
|
};
|
|
293
296
|
const removeAction = !inService && (0, _util.isDeletableBlocklet)(blocklet) ? {
|
|
@@ -413,13 +416,18 @@ function BlockletActions(_ref) {
|
|
|
413
416
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_MenuItem.default, {
|
|
414
417
|
dense: true,
|
|
415
418
|
onClick: e => onAction(action, e),
|
|
416
|
-
disabled: action.disabled,
|
|
419
|
+
disabled: loading || action.disabled,
|
|
417
420
|
"data-cy": "".concat(action.action, "-blocklet"),
|
|
418
421
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemIcon.default, {
|
|
419
422
|
style: {
|
|
420
423
|
minWidth: 24
|
|
421
424
|
},
|
|
422
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
425
|
+
children: currentAction === action.action && loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_CircularProgress.default, {
|
|
426
|
+
size: 16,
|
|
427
|
+
sx: {
|
|
428
|
+
marginRight: 1
|
|
429
|
+
}
|
|
430
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(action.icon, {
|
|
423
431
|
fontSize: "small"
|
|
424
432
|
})
|
|
425
433
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ListItemText.default, {
|
|
@@ -447,8 +455,11 @@ function BlockletActions(_ref) {
|
|
|
447
455
|
"data-cy": "".concat(action.action, "-blocklet"),
|
|
448
456
|
onClick: () => onAction(action),
|
|
449
457
|
disabled: Boolean(action.disabled) || loading,
|
|
450
|
-
children: [currentAction === action.action && loading
|
|
451
|
-
size: 16
|
|
458
|
+
children: [currentAction === action.action && loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_CircularProgress.default, {
|
|
459
|
+
size: 16,
|
|
460
|
+
sx: {
|
|
461
|
+
marginRight: 1
|
|
462
|
+
}
|
|
452
463
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(action.icon, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
453
464
|
className: "blocklet-action-text",
|
|
454
465
|
children: action.name
|
package/lib/blocklet/add-cert.js
CHANGED
|
@@ -19,6 +19,7 @@ var _blocklet = require("../contexts/blocklet");
|
|
|
19
19
|
var _util = require("../util");
|
|
20
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
21
|
const _excluded = ["domain", "domainStatus"];
|
|
22
|
+
/* eslint-disable react/no-unused-prop-types */
|
|
22
23
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
24
|
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; }
|
|
24
25
|
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; }
|
|
@@ -9,15 +9,12 @@ var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
|
9
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
10
|
var _get = _interopRequireDefault(require("lodash/get"));
|
|
11
11
|
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
12
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
-
var _urlJoin = _interopRequireDefault(require("url-join"));
|
|
14
12
|
var _Box = _interopRequireDefault(require("@mui/material/Box"));
|
|
15
13
|
var _Switch = _interopRequireDefault(require("@mui/material/Switch"));
|
|
16
14
|
var _Divider = _interopRequireDefault(require("@mui/material/Divider"));
|
|
17
15
|
var _context = require("@arcblock/ux/lib/Locale/context");
|
|
18
16
|
var _Button = _interopRequireDefault(require("@arcblock/ux/lib/Button"));
|
|
19
17
|
var _Loop = _interopRequireDefault(require("@mui/icons-material/Loop"));
|
|
20
|
-
var _Avatar = _interopRequireDefault(require("@mui/material/Avatar"));
|
|
21
18
|
var _constant = require("@abtnode/constant");
|
|
22
19
|
var _constant2 = require("@blocklet/constant");
|
|
23
20
|
var _util = require("@blocklet/meta/lib/util");
|
|
@@ -32,10 +29,13 @@ var _clearCache = _interopRequireDefault(require("../clear-cache"));
|
|
|
32
29
|
var _appSk = _interopRequireDefault(require("./preferences/app-sk"));
|
|
33
30
|
var _transferOwner = _interopRequireDefault(require("./transfer-owner"));
|
|
34
31
|
var _useAppLogo = _interopRequireDefault(require("../hooks/use-app-logo"));
|
|
32
|
+
var _logoUploader = _interopRequireDefault(require("./logo-uploader"));
|
|
35
33
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
36
34
|
var _templateObject;
|
|
37
35
|
const _excluded = ["blocklet", "onUpdate", "hasPermission"];
|
|
38
36
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
37
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
38
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
39
39
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
40
40
|
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; }
|
|
41
41
|
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; }
|
|
@@ -44,18 +44,10 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typ
|
|
|
44
44
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
45
45
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
46
46
|
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; }
|
|
47
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
48
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
49
47
|
const languages = Object.keys(_constant2.SUPPORTED_LANGUAGES).map(x => ({
|
|
50
48
|
code: x,
|
|
51
49
|
name: _constant2.SUPPORTED_LANGUAGES[x].nativeName
|
|
52
50
|
}));
|
|
53
|
-
|
|
54
|
-
// eslint-disable-next-line import/no-unresolved
|
|
55
|
-
const UploaderComponent = /*#__PURE__*/(0, _react.lazy)(() => Promise.resolve().then(() => _interopRequireWildcard(require('@blocklet/uploader/react'))).then(res => ({
|
|
56
|
-
default: res.Uploader
|
|
57
|
-
})));
|
|
58
|
-
const uploadPrefix = '/blocklet/logo/upload';
|
|
59
51
|
function BlockletEnvironment(_ref) {
|
|
60
52
|
var _blocklet$settings;
|
|
61
53
|
let {
|
|
@@ -82,7 +74,6 @@ function BlockletEnvironment(_ref) {
|
|
|
82
74
|
const whoCanAccess = (0, _util.getWhoCanAccess)(blocklet);
|
|
83
75
|
const publicToStore = blocklet === null || blocklet === void 0 ? void 0 : (_blocklet$settings = blocklet.settings) === null || _blocklet$settings === void 0 ? void 0 : _blocklet$settings.publicToStore;
|
|
84
76
|
const disabled = loading || !hasPermission;
|
|
85
|
-
const uploaderLogoRef = (0, _react.useRef)(null);
|
|
86
77
|
const {
|
|
87
78
|
logoUrl,
|
|
88
79
|
rectLogoUrl,
|
|
@@ -90,20 +81,6 @@ function BlockletEnvironment(_ref) {
|
|
|
90
81
|
} = (0, _useAppLogo.default)({
|
|
91
82
|
blocklet
|
|
92
83
|
});
|
|
93
|
-
const [apiPathProps, setApiPathProps] = (0, _react.useState)();
|
|
94
|
-
const uploadLogoPrefix = (0, _urlJoin.default)(prefix, uploadPrefix, 'square', blocklet.meta.did);
|
|
95
|
-
const uploadLogoRectPrefix = (0, _urlJoin.default)(prefix, uploadPrefix, 'rect', blocklet.meta.did);
|
|
96
|
-
const uploadLogoFaviconPrefix = (0, _urlJoin.default)(prefix, uploadPrefix, 'favicon', blocklet.meta.did);
|
|
97
|
-
const openUploader = uploaderPrefix => {
|
|
98
|
-
if (!hasPermission) {
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
setApiPathProps({
|
|
102
|
-
uploader: uploaderPrefix,
|
|
103
|
-
disableMediaKitPrefix: true
|
|
104
|
-
});
|
|
105
|
-
uploaderLogoRef.current.open();
|
|
106
|
-
};
|
|
107
84
|
const {
|
|
108
85
|
did
|
|
109
86
|
} = blocklet.meta;
|
|
@@ -289,11 +266,6 @@ function BlockletEnvironment(_ref) {
|
|
|
289
266
|
setLoading(false);
|
|
290
267
|
}
|
|
291
268
|
};
|
|
292
|
-
const uploaderStyle = {
|
|
293
|
-
'&::after': {
|
|
294
|
-
content: "\"".concat(t('common.switch'), "\"")
|
|
295
|
-
}
|
|
296
|
-
};
|
|
297
269
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Div, _objectSpread(_objectSpread({}, rest), {}, {
|
|
298
270
|
children: [configurableEnvs.map(item => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
299
271
|
className: "config-form",
|
|
@@ -325,19 +297,15 @@ function BlockletEnvironment(_ref) {
|
|
|
325
297
|
width: 'auto'
|
|
326
298
|
},
|
|
327
299
|
children: t('blocklet.config.logoSquare')
|
|
328
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
variant: "square",
|
|
338
|
-
alt: "Blocklet Logo",
|
|
339
|
-
src: logoUrl
|
|
340
|
-
})
|
|
300
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_logoUploader.default, {
|
|
301
|
+
did: blocklet.meta.did,
|
|
302
|
+
height: 80,
|
|
303
|
+
width: 80,
|
|
304
|
+
type: "square",
|
|
305
|
+
prefix: prefix,
|
|
306
|
+
url: logoUrl,
|
|
307
|
+
enabled: hasPermission,
|
|
308
|
+
headers: getSessionInHeader
|
|
341
309
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
342
310
|
className: "config-label",
|
|
343
311
|
fontSize: 14,
|
|
@@ -347,17 +315,14 @@ function BlockletEnvironment(_ref) {
|
|
|
347
315
|
mb: 1.5,
|
|
348
316
|
className: "config-desc",
|
|
349
317
|
children: t('blocklet.config.logoRectDesc')
|
|
350
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
height: '80px'
|
|
359
|
-
}
|
|
360
|
-
})
|
|
318
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_logoUploader.default, {
|
|
319
|
+
did: blocklet.meta.did,
|
|
320
|
+
height: 80,
|
|
321
|
+
type: "rect",
|
|
322
|
+
prefix: prefix,
|
|
323
|
+
url: rectLogoUrl,
|
|
324
|
+
enabled: hasPermission,
|
|
325
|
+
headers: getSessionInHeader
|
|
361
326
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
362
327
|
className: "config-label",
|
|
363
328
|
fontSize: 14,
|
|
@@ -367,41 +332,16 @@ function BlockletEnvironment(_ref) {
|
|
|
367
332
|
mb: 1.5,
|
|
368
333
|
className: "config-desc",
|
|
369
334
|
children: t('blocklet.config.logoFaviconDesc')
|
|
335
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_logoUploader.default, {
|
|
336
|
+
did: blocklet.meta.did,
|
|
337
|
+
height: 25,
|
|
338
|
+
width: 25,
|
|
339
|
+
type: "favicon",
|
|
340
|
+
prefix: prefix,
|
|
341
|
+
url: faviconUrl,
|
|
342
|
+
enabled: hasPermission,
|
|
343
|
+
headers: getSessionInHeader
|
|
370
344
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
371
|
-
sx: {
|
|
372
|
-
display: 'inline-flex',
|
|
373
|
-
cursor: hasPermission ? 'pointer' : 'default'
|
|
374
|
-
},
|
|
375
|
-
onClick: () => openUploader(uploadLogoFaviconPrefix),
|
|
376
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Avatar.default, {
|
|
377
|
-
variant: "square",
|
|
378
|
-
sx: {
|
|
379
|
-
width: 20,
|
|
380
|
-
height: 20
|
|
381
|
-
},
|
|
382
|
-
alt: "Blocklet Favicon Logo",
|
|
383
|
-
src: faviconUrl
|
|
384
|
-
})
|
|
385
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(UploaderComponent, {
|
|
386
|
-
id: "\u200Buploader-logo",
|
|
387
|
-
ref: uploaderLogoRef,
|
|
388
|
-
popup: true,
|
|
389
|
-
onUploadFinish: () => {
|
|
390
|
-
uploaderLogoRef.current.close();
|
|
391
|
-
},
|
|
392
|
-
plugins: [],
|
|
393
|
-
apiPathProps: apiPathProps,
|
|
394
|
-
coreProps: {
|
|
395
|
-
restrictions: {
|
|
396
|
-
allowedFileTypes: ['image/*', '.jpg', '.jpeg', '.png', '.gif', '.svg'],
|
|
397
|
-
maxFileSize: 1024 * 1024 * 10,
|
|
398
|
-
maxNumberOfFiles: 1
|
|
399
|
-
}
|
|
400
|
-
},
|
|
401
|
-
tusProps: {
|
|
402
|
-
headers: getSessionInHeader
|
|
403
|
-
}
|
|
404
|
-
}, "uploader-logo"), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Box.default, {
|
|
405
345
|
className: "config-form",
|
|
406
346
|
children: whoCanAccess === 'all' && blocklet.source === 'registry' && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Box.default, {
|
|
407
347
|
className: "config-item",
|
|
@@ -599,4 +539,4 @@ BlockletEnvironment.defaultProps = {
|
|
|
599
539
|
onUpdate: () => {},
|
|
600
540
|
hasPermission: false
|
|
601
541
|
};
|
|
602
|
-
const Div = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding-top: 24px;\n .config-form {\n flex-grow: 1;\n overflow-y: auto;\n ", " {\n width: 100%;\n flex-shrink: 0;\n padding: 0 24px;\n transform: translate(0, 0);\n }\n }\n\n .config-item {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin: 16px 0;\n }\n\n .config-label {\n font-weight: bold;\n }\n\n .config-desc {\n font-weight: normal;\n font-size: 12px;\n color: #666;\n }\n\n .form-item {\n margin-top: 0;\n }\n
|
|
542
|
+
const Div = _styled.default.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding-top: 24px;\n .config-form {\n flex-grow: 1;\n overflow-y: auto;\n ", " {\n width: 100%;\n flex-shrink: 0;\n padding: 0 24px;\n transform: translate(0, 0);\n }\n }\n\n .config-item {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin: 16px 0;\n }\n\n .config-label {\n font-weight: bold;\n }\n\n .config-desc {\n font-weight: normal;\n font-size: 12px;\n color: #666;\n }\n\n .form-item {\n margin-top: 0;\n }\n"])), props => props.theme.breakpoints.down('md'));
|