@abtnode/ux 1.16.29-next-680cf137 → 1.16.29
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/blocklet-owner-info.js +35 -0
- package/lib/blocklet/component/component-info-dialog.js +7 -2
- package/lib/blocklet/component/index.js +30 -27
- package/lib/blocklet/install-from-url.js +9 -3
- package/lib/blocklet/publish/create-release/blocklets.js +5 -5
- package/lib/blocklet/publish/create-release/branding.js +14 -11
- package/lib/blocklet/publish/create-release/connect-store-button.js +11 -10
- package/lib/blocklet/publish/create-release/header.js +136 -123
- package/lib/blocklet/publish/create-release/index.js +16 -16
- package/lib/blocklet/publish/create-release/project-setting.js +182 -0
- package/lib/blocklet/publish/create-release/resource-select.js +16 -12
- package/lib/blocklet/publish/hooks/use-want-to-connect-store.js +6 -2
- package/lib/blocklet/publish/utils/get-studio-store-list.js +3 -0
- package/lib/blocklet/publish/utils/parse-resource-relate-components.js +31 -0
- package/lib/blocklet/storage/auto-check-update.js +2 -2
- package/lib/contexts/blocklet-auto-check-update.js +54 -0
- package/lib/contexts/blocklet-storage.js +0 -19
- package/lib/locales/ar.js +6 -1
- package/lib/locales/de.js +6 -1
- package/lib/locales/en.js +5 -0
- package/lib/locales/es.js +6 -1
- package/lib/locales/fr.js +6 -1
- package/lib/locales/hi.js +6 -1
- package/lib/locales/i18n.db +0 -0
- package/lib/locales/id.js +6 -1
- package/lib/locales/ja.js +6 -1
- package/lib/locales/ko.js +6 -1
- package/lib/locales/pt.js +6 -1
- package/lib/locales/ru.js +6 -1
- package/lib/locales/th.js +6 -1
- package/lib/locales/vi.js +6 -1
- package/lib/locales/zh-tw.js +6 -1
- package/lib/locales/zh.js +6 -1
- package/lib/util/index.js +0 -14
- package/package.json +20 -20
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Box } from '@mui/material';
|
|
2
|
+
import DID from '@arcblock/ux/lib/DID';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
+
export default function BlockletOwnerInfo({
|
|
6
|
+
owner,
|
|
7
|
+
locale
|
|
8
|
+
}) {
|
|
9
|
+
return /*#__PURE__*/_jsxs(Box, {
|
|
10
|
+
sx: {
|
|
11
|
+
display: 'flex',
|
|
12
|
+
alignItems: 'center',
|
|
13
|
+
gap: 1
|
|
14
|
+
},
|
|
15
|
+
children: [owner.fullName, owner.did ? /*#__PURE__*/_jsx(DID, {
|
|
16
|
+
sx: {
|
|
17
|
+
lineHeight: 'initial',
|
|
18
|
+
'&::before': {
|
|
19
|
+
content: '"("'
|
|
20
|
+
},
|
|
21
|
+
'&::after': {
|
|
22
|
+
content: '")"'
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
did: owner.did,
|
|
26
|
+
compact: true,
|
|
27
|
+
size: 14,
|
|
28
|
+
locale: locale
|
|
29
|
+
}) : null]
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
BlockletOwnerInfo.propTypes = {
|
|
33
|
+
owner: PropTypes.object.isRequired,
|
|
34
|
+
locale: PropTypes.string.isRequired
|
|
35
|
+
};
|
|
@@ -6,13 +6,15 @@ import { Badge, Box } from '@mui/material';
|
|
|
6
6
|
import InfoRow from '@arcblock/ux/lib/InfoRow';
|
|
7
7
|
import Dialog from '@arcblock/ux/lib/Dialog';
|
|
8
8
|
import { getDisplayName, hasStartEngine } from '@blocklet/meta/lib/util';
|
|
9
|
+
import { formatPerson } from '@blocklet/meta/lib/fix';
|
|
9
10
|
import { useDeletingBlockletContext } from '../../contexts/deleting-blocklets';
|
|
10
11
|
import Tag from '../../tag';
|
|
11
|
-
import {
|
|
12
|
+
import { formatToDatetime } from '../../util';
|
|
12
13
|
import DidAddress from '../../did-address';
|
|
13
14
|
import BlockletSource from '../blocklet-source';
|
|
14
15
|
import BlockletStatus from '../status';
|
|
15
16
|
import BlockletVersion from '../version';
|
|
17
|
+
import BlockletOwnerInfo from './blocklet-owner-info';
|
|
16
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
19
|
const isResource = component => !component?.meta?.group;
|
|
18
20
|
const getEngineRows = (engine, t) => {
|
|
@@ -171,7 +173,10 @@ export default function ComponentInfoDialog({
|
|
|
171
173
|
})
|
|
172
174
|
}, {
|
|
173
175
|
name: t('common.author'),
|
|
174
|
-
value:
|
|
176
|
+
value: componentInfo.meta.owner ? /*#__PURE__*/_jsx(BlockletOwnerInfo, {
|
|
177
|
+
owner: componentInfo.meta.owner,
|
|
178
|
+
locale: locale
|
|
179
|
+
}) : formatPerson(componentInfo.meta.author)
|
|
175
180
|
}, {
|
|
176
181
|
name: t('common.engine'),
|
|
177
182
|
value: getEngineRows(componentInfo.engine, t).map(({
|
|
@@ -37,6 +37,7 @@ import ComponentCell, { StyledBadge, StyledComponentRow } from './component-cell
|
|
|
37
37
|
import OptionalComponentCell from './optional-component-cell';
|
|
38
38
|
import AddComponentDialog from './add-component/add-component-dialog';
|
|
39
39
|
import Actions from '../../actions';
|
|
40
|
+
import { BlockletAutoCheckUpdateProvider } from '../../contexts/blocklet-auto-check-update';
|
|
40
41
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
41
42
|
export default function BlockletComponent({
|
|
42
43
|
blocklet,
|
|
@@ -248,33 +249,35 @@ export default function BlockletComponent({
|
|
|
248
249
|
children: [components?.length ? `${t('common.components')} (${components.length})` : `${t('common.components')}`, !needMigration && /*#__PURE__*/_jsx(Permission, {
|
|
249
250
|
permission: inService ? '' : 'mutate_blocklets',
|
|
250
251
|
role: inService ? BlockletAdminRoles : [],
|
|
251
|
-
children: /*#__PURE__*/_jsx(
|
|
252
|
-
children: /*#__PURE__*/_jsx(
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
252
|
+
children: /*#__PURE__*/_jsx(BlockletAutoCheckUpdateProvider, {
|
|
253
|
+
children: /*#__PURE__*/_jsx(AutoCheckUpdate, {
|
|
254
|
+
children: /*#__PURE__*/_jsx(StyledBadge, {
|
|
255
|
+
top: 1.2,
|
|
256
|
+
right: 0.4,
|
|
257
|
+
color: "error",
|
|
258
|
+
badgeContent: "",
|
|
259
|
+
variant: "dot",
|
|
260
|
+
invisible: !showUpdateDot,
|
|
261
|
+
children: /*#__PURE__*/_jsxs(Button, {
|
|
262
|
+
disabled: loading || isInProgress(blocklet.status),
|
|
263
|
+
color: "secondary",
|
|
264
|
+
onClick: () => {
|
|
265
|
+
checkForUpdates();
|
|
266
|
+
},
|
|
267
|
+
"data-cy": "check-for-updates",
|
|
268
|
+
children: [/*#__PURE__*/_jsx(Box, {
|
|
269
|
+
ml: 0.5,
|
|
270
|
+
mr: 0.5,
|
|
271
|
+
display: "flex",
|
|
272
|
+
children: loading ? /*#__PURE__*/_jsx(Spinner, {
|
|
273
|
+
size: 16
|
|
274
|
+
}) : /*#__PURE__*/_jsx(UpdateIcon, {
|
|
275
|
+
style: {
|
|
276
|
+
fontSize: '1em'
|
|
277
|
+
}
|
|
278
|
+
})
|
|
279
|
+
}), t('blocklet.component.checkUpdateTitle')]
|
|
280
|
+
})
|
|
278
281
|
})
|
|
279
282
|
})
|
|
280
283
|
})
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useState, useEffect } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
+
import { formatPerson } from '@blocklet/meta/lib/fix';
|
|
3
4
|
import Dialog from '@arcblock/ux/lib/Dialog';
|
|
4
5
|
import Spinner from '@mui/material/CircularProgress';
|
|
5
6
|
import DialogContentText from '@mui/material/DialogContentText';
|
|
@@ -16,9 +17,10 @@ import Alert from '@mui/material/Alert';
|
|
|
16
17
|
import { getDisplayName } from '@blocklet/meta/lib/util';
|
|
17
18
|
import { useNodeContext } from '../contexts/node';
|
|
18
19
|
import { useSessionContext } from '../contexts/session';
|
|
19
|
-
import { formatError
|
|
20
|
+
import { formatError } from '../util';
|
|
20
21
|
import { getWalletType } from './util';
|
|
21
22
|
import DidAddress from '../did-address';
|
|
23
|
+
import BlockletOwnerInfo from './component/blocklet-owner-info';
|
|
22
24
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
23
25
|
export default function InstallFromUrl({
|
|
24
26
|
defaultUrl,
|
|
@@ -37,7 +39,8 @@ export default function InstallFromUrl({
|
|
|
37
39
|
const [loading, setLoading] = useState(false);
|
|
38
40
|
const [error, setError] = useState('');
|
|
39
41
|
const {
|
|
40
|
-
t
|
|
42
|
+
t,
|
|
43
|
+
locale
|
|
41
44
|
} = useLocaleContext();
|
|
42
45
|
const initMeta = {
|
|
43
46
|
dist: {}
|
|
@@ -134,7 +137,10 @@ export default function InstallFromUrl({
|
|
|
134
137
|
})
|
|
135
138
|
}, {
|
|
136
139
|
name: t('common.author'),
|
|
137
|
-
value:
|
|
140
|
+
value: meta.owner ? /*#__PURE__*/_jsx(BlockletOwnerInfo, {
|
|
141
|
+
owner: meta.owner,
|
|
142
|
+
locale: locale
|
|
143
|
+
}) : formatPerson(meta.author)
|
|
138
144
|
}, {
|
|
139
145
|
name: t('blocklet.dist.downloadLink'),
|
|
140
146
|
value: meta.dist.tarball
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
1
|
import styled from '@emotion/styled';
|
|
4
2
|
import classnames from 'classnames';
|
|
5
3
|
import pick from 'lodash/pick';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import { useMemo } from 'react';
|
|
8
6
|
import Datatable from '@arcblock/ux/lib/Datatable';
|
|
9
7
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
10
|
-
import
|
|
8
|
+
import Box from '@mui/material/Box';
|
|
9
|
+
import Checkbox from '@mui/material/Checkbox';
|
|
11
10
|
import { EmptyIcon } from '@arcblock/icons';
|
|
11
|
+
import { Alert } from '@mui/material';
|
|
12
12
|
import BlockletBundleAvatar from '../../bundle-avatar';
|
|
13
13
|
import StopBox from './stop-box';
|
|
14
14
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { UNOWNED_DID, WELLKNOWN_SERVICE_PATH_PREFIX } from '@abtnode/constant';
|
|
2
|
-
import { Box, InputAdornment, TextField, Typography, Avatar, IconButton } from '@mui/material';
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import styled from '@emotion/styled';
|
|
5
2
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
6
3
|
import Toast from '@arcblock/ux/lib/Toast/index';
|
|
7
|
-
import
|
|
8
|
-
import { Suspense, lazy, useRef } from 'react';
|
|
4
|
+
import styled from '@emotion/styled';
|
|
9
5
|
import DeleteOutlineIcon from '@mui/icons-material/DeleteOutline';
|
|
10
|
-
import
|
|
11
|
-
import
|
|
6
|
+
import { Avatar, Box, IconButton, InputAdornment, TextField, Typography } from '@mui/material';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import { Suspense, lazy, useRef } from 'react';
|
|
9
|
+
import { useNavigate } from 'react-router-dom';
|
|
10
|
+
import { useNodeContext } from '../../../contexts/node';
|
|
11
|
+
import EmptySpinner from '../../../empty-spinner';
|
|
12
12
|
import usePromiseWindowOpen from '../../../hooks/use-promise-window-open';
|
|
13
13
|
import { formatError } from '../../../util';
|
|
14
|
-
import { useNodeContext } from '../../../contexts/node';
|
|
15
14
|
import useWantToConnectStore from '../hooks/use-want-to-connect-store';
|
|
16
|
-
import
|
|
15
|
+
import { createMessageId, waitGetConnectedByStudio } from '../utils/wait-connect';
|
|
16
|
+
import ConnectStoreButton from './connect-store-button';
|
|
17
17
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
18
|
const allowedFileExts = ['.webp', '.jpg', '.jpeg', '.png', '.gif', '.svg'];
|
|
19
19
|
const maxFileSize = 1024 * 1024 * 10; // 10 MB
|
|
@@ -72,8 +72,8 @@ function Branding({
|
|
|
72
72
|
Toast.error(t('blocklet.publish.errorTip.noTitle'));
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
75
|
-
if (!wantToConnectStore) {
|
|
76
|
-
Toast.error('
|
|
75
|
+
if (!wantToConnectStore?.url) {
|
|
76
|
+
Toast.error(t('blocklet.publish.noStoreSelected'));
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
79
|
const messageId = createMessageId();
|
|
@@ -348,6 +348,9 @@ function Branding({
|
|
|
348
348
|
});
|
|
349
349
|
uploaderScreenshotRef.current.close();
|
|
350
350
|
},
|
|
351
|
+
installerProps: {
|
|
352
|
+
disabled: true
|
|
353
|
+
},
|
|
351
354
|
plugins: ['ImageEditor'],
|
|
352
355
|
apiPathProps: {
|
|
353
356
|
uploader: uploadScreenshotPrefix,
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
|
+
import { Icon } from '@iconify/react';
|
|
2
3
|
import AddIcon from '@mui/icons-material/Add';
|
|
3
4
|
import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';
|
|
4
5
|
import { Box, Button, ButtonGroup, CircularProgress, ClickAwayListener, Divider, Grow, IconButton, MenuItem, MenuList, Paper, Popper, Typography } from '@mui/material';
|
|
5
6
|
import PropTypes from 'prop-types';
|
|
6
|
-
import { Icon } from '@iconify/react';
|
|
7
7
|
import { useRef, useState } from 'react';
|
|
8
|
-
import Toast from '@arcblock/ux/lib/Toast';
|
|
9
8
|
import formatError from '@abtnode/util/lib/format-error';
|
|
10
|
-
import
|
|
11
|
-
import AddStore from '../../../store/add';
|
|
12
|
-
import { useNodeContext } from '../../../contexts/node';
|
|
9
|
+
import Toast from '@arcblock/ux/lib/Toast';
|
|
13
10
|
import ConfirmDialog from '../../../confirm';
|
|
14
11
|
import { useBlockletContext } from '../../../contexts/blocklet';
|
|
12
|
+
import { useNodeContext } from '../../../contexts/node';
|
|
13
|
+
import { useSessionContext } from '../../../contexts/session';
|
|
14
|
+
import AddStore from '../../../store/add';
|
|
15
15
|
import ShortenLabel from '../../component/shorten-label';
|
|
16
16
|
import canDeleteStore from '../utils/can-delete-store';
|
|
17
17
|
import getStudioStoreList from '../utils/get-studio-store-list';
|
|
18
18
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
19
19
|
export default function ConnectStoreButton({
|
|
20
20
|
blocklet,
|
|
21
|
-
store,
|
|
21
|
+
store = {},
|
|
22
22
|
onChangeStore,
|
|
23
23
|
onClick,
|
|
24
24
|
disabled,
|
|
@@ -104,7 +104,7 @@ export default function ConnectStoreButton({
|
|
|
104
104
|
sx: {
|
|
105
105
|
mr: 0.5
|
|
106
106
|
}
|
|
107
|
-
}), `${t('common.connect')} ${store
|
|
107
|
+
}), `${t('common.connect')} ${store.name || ''}`]
|
|
108
108
|
}), /*#__PURE__*/_jsx(Button, {
|
|
109
109
|
size: "small",
|
|
110
110
|
"aria-controls": open ? 'split-button-menu' : undefined,
|
|
@@ -139,10 +139,11 @@ export default function ConnectStoreButton({
|
|
|
139
139
|
autoFocusItem: true,
|
|
140
140
|
sx: {
|
|
141
141
|
maxHeight: 300,
|
|
142
|
-
overflowY: 'auto'
|
|
142
|
+
overflowY: 'auto',
|
|
143
|
+
zIndex: 10
|
|
143
144
|
},
|
|
144
|
-
children: [storeList
|
|
145
|
-
selected: option.id === store
|
|
145
|
+
children: [storeList?.map(option => /*#__PURE__*/_jsxs(MenuItem, {
|
|
146
|
+
selected: option.id === store?.id,
|
|
146
147
|
sx: {
|
|
147
148
|
height: 56
|
|
148
149
|
},
|
|
@@ -1,29 +1,31 @@
|
|
|
1
1
|
import { UNOWNED_DID, WELLKNOWN_SERVICE_PATH_PREFIX } from '@abtnode/constant';
|
|
2
|
+
import Dialog from '@arcblock/ux/lib/Dialog';
|
|
2
3
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
3
|
-
import
|
|
4
|
-
import styled from '@emotion/styled';
|
|
5
|
-
import { Link, useNavigate } from 'react-router-dom';
|
|
6
|
-
import PropTypes from 'prop-types';
|
|
7
|
-
import { joinURL } from 'ufo';
|
|
4
|
+
import Toast from '@arcblock/ux/lib/Toast/index';
|
|
8
5
|
import { PROJECT } from '@blocklet/constant';
|
|
9
|
-
import
|
|
6
|
+
import styled from '@emotion/styled';
|
|
7
|
+
import { Icon } from '@iconify/react';
|
|
10
8
|
import CloudUploadRoundedIcon from '@mui/icons-material/CloudUploadRounded';
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import Toast from '@arcblock/ux/lib/Toast/index';
|
|
14
|
-
import pAll from 'p-all';
|
|
15
|
-
import Dialog from '@arcblock/ux/lib/Dialog';
|
|
9
|
+
import { Box, Breadcrumbs, Button, ButtonGroup, IconButton, Dialog as MaterialDialog, Typography, useMediaQuery } from '@mui/material';
|
|
10
|
+
import Spinner from '@mui/material/CircularProgress';
|
|
16
11
|
import pick from 'lodash/pick';
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import
|
|
22
|
-
import {
|
|
12
|
+
import pAll from 'p-all';
|
|
13
|
+
import PropTypes from 'prop-types';
|
|
14
|
+
import { useState } from 'react';
|
|
15
|
+
import { Link, useNavigate } from 'react-router-dom';
|
|
16
|
+
import semver from 'semver';
|
|
17
|
+
import { joinURL } from 'ufo';
|
|
23
18
|
import ClickToCopy from '../../../click-to-copy';
|
|
24
|
-
import { formatError } from '../../../util';
|
|
25
19
|
import { useNodeContext } from '../../../contexts/node';
|
|
20
|
+
import { formatError } from '../../../util';
|
|
26
21
|
import ShortenLabel from '../../component/shorten-label';
|
|
22
|
+
import parseResourceRelateComponents from '../utils/parse-resource-relate-components';
|
|
23
|
+
import uploadImageToProject from '../utils/upload-image-to-project';
|
|
24
|
+
import { validateParams } from '../utils/validate-params';
|
|
25
|
+
import { waitGetConnectedStore } from '../utils/wait-connect';
|
|
26
|
+
import ConnectStoreList from './connect-store-list';
|
|
27
|
+
import ProjectSetting from './project-setting';
|
|
28
|
+
import { uploadResource } from './resource-select';
|
|
27
29
|
import UploadedToast from './uploaded-toast';
|
|
28
30
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
29
31
|
const serverEndpoint = window.env?.serverEndpoint;
|
|
@@ -61,6 +63,7 @@ function Header({
|
|
|
61
63
|
} = useNodeContext();
|
|
62
64
|
const navigate = useNavigate();
|
|
63
65
|
const [showStoreDialog, setShowStoreDialog] = useState(false);
|
|
66
|
+
const [showSetting, setShowSetting] = useState(false);
|
|
64
67
|
const [installResourceTip, setInstallResourceTip] = useState();
|
|
65
68
|
const isMobile = useMediaQuery(theme => theme.breakpoints.down('md'));
|
|
66
69
|
const releaseType = params?.blockletComponents?.length > 0 ? 'pack' : 'resource';
|
|
@@ -90,32 +93,7 @@ function Header({
|
|
|
90
93
|
const _params = {
|
|
91
94
|
...params
|
|
92
95
|
};
|
|
93
|
-
|
|
94
|
-
acc[curr.meta.did] = true;
|
|
95
|
-
return acc;
|
|
96
|
-
}, {});
|
|
97
|
-
Object.keys(resourceRelateComponents).forEach(blockletDid => {
|
|
98
|
-
if (!componentMaps[blockletDid]) {
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
let included = false;
|
|
102
|
-
if (!disabledSelectComponents) {
|
|
103
|
-
_params.blockletComponents.forEach(item => {
|
|
104
|
-
if (item.did === blockletDid) {
|
|
105
|
-
item.included = true;
|
|
106
|
-
item.required = true;
|
|
107
|
-
included = true;
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
if (!included) {
|
|
112
|
-
_params.blockletComponents.push({
|
|
113
|
-
did: blockletDid,
|
|
114
|
-
included: true,
|
|
115
|
-
required: true
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
});
|
|
96
|
+
_params.blockletComponents = parseResourceRelateComponents(_params.blockletComponents, blocklet, resourceRelateComponents, disabledSelectComponents);
|
|
119
97
|
_params.blockletVersion = semver.valid(_params.blockletVersion);
|
|
120
98
|
if (!_params.blockletVersion) {
|
|
121
99
|
Toast.error('Invalid Blocklet Version');
|
|
@@ -222,35 +200,37 @@ function Header({
|
|
|
222
200
|
}
|
|
223
201
|
});
|
|
224
202
|
const newReleased = lastProject.project.lastReleaseId;
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
203
|
+
if (params.autoUpload) {
|
|
204
|
+
await pAll(lastProject.project.connectedStores.map(store => {
|
|
205
|
+
return async () => {
|
|
206
|
+
try {
|
|
207
|
+
// eslint-disable-next-line no-await-in-loop
|
|
208
|
+
const res = await api.publishToStore({
|
|
209
|
+
input: {
|
|
210
|
+
did: blocklet.meta.did,
|
|
211
|
+
storeId: store.storeId,
|
|
212
|
+
storeName: store.storeName,
|
|
213
|
+
projectId,
|
|
214
|
+
releaseId: newReleased,
|
|
215
|
+
type: releaseType
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
Toast.success( /*#__PURE__*/_jsx(UploadedToast, {
|
|
233
219
|
storeName: store.storeName,
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
Toast.error(formatError(err));
|
|
249
|
-
}
|
|
250
|
-
};
|
|
251
|
-
}), {
|
|
252
|
-
concurrency: 4
|
|
253
|
-
});
|
|
220
|
+
storeUrl: store.storeUrl,
|
|
221
|
+
developerDid: store.developerDid,
|
|
222
|
+
published: res.url === 'published'
|
|
223
|
+
}), {
|
|
224
|
+
duration: 10000
|
|
225
|
+
});
|
|
226
|
+
} catch (err) {
|
|
227
|
+
Toast.error(formatError(err));
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
}), {
|
|
231
|
+
concurrency: 4
|
|
232
|
+
});
|
|
233
|
+
}
|
|
254
234
|
onPublish?.();
|
|
255
235
|
navigate(`../${projectId}/view/${newReleased}`, {
|
|
256
236
|
replace: true
|
|
@@ -266,6 +246,9 @@ function Header({
|
|
|
266
246
|
await waitGetConnectedStore(api, param);
|
|
267
247
|
getData();
|
|
268
248
|
};
|
|
249
|
+
const handleShowSetting = () => {
|
|
250
|
+
setShowSetting(true);
|
|
251
|
+
};
|
|
269
252
|
let installButton = null;
|
|
270
253
|
if (isPublished && serverEndpoint) {
|
|
271
254
|
const blockletMetaUrl = joinURL(serverEndpoint, `/api/project/${blocklet.meta.did}/${projectId}/${releaseId}/release/blocklet.json`);
|
|
@@ -273,31 +256,36 @@ function Header({
|
|
|
273
256
|
const url = new URL(serverEndpoint);
|
|
274
257
|
url.pathname = joinURL(url.pathname, '/launch-blocklet/agreement');
|
|
275
258
|
url.searchParams.set('blocklet_meta_url', blockletMetaUrl);
|
|
276
|
-
installButton = /*#__PURE__*/_jsx(
|
|
259
|
+
installButton = isMobile ? /*#__PURE__*/_jsx(IconButton, {
|
|
260
|
+
component: "a",
|
|
261
|
+
disabled: loading,
|
|
277
262
|
href: url.href,
|
|
278
263
|
target: "_blank",
|
|
279
264
|
rel: "noreferrer",
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
icon: "ic:baseline-install-desktop"
|
|
288
|
-
})
|
|
289
|
-
}) : /*#__PURE__*/_jsx(Button, {
|
|
290
|
-
variant: "outlined",
|
|
291
|
-
sx: {
|
|
292
|
-
mr: 1
|
|
293
|
-
},
|
|
294
|
-
onClick: () => setInstallResourceTip(blockletMetaUrl),
|
|
295
|
-
children: t('common.install')
|
|
265
|
+
color: "primary",
|
|
266
|
+
sx: {
|
|
267
|
+
mr: 1
|
|
268
|
+
},
|
|
269
|
+
onClick: () => setInstallResourceTip(blockletMetaUrl),
|
|
270
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
271
|
+
icon: "ic:baseline-install-desktop"
|
|
296
272
|
})
|
|
273
|
+
}) : /*#__PURE__*/_jsx(Button, {
|
|
274
|
+
href: url.href,
|
|
275
|
+
disabled: loading,
|
|
276
|
+
target: "_blank",
|
|
277
|
+
rel: "noreferrer",
|
|
278
|
+
variant: "outlined",
|
|
279
|
+
sx: {
|
|
280
|
+
mr: 1
|
|
281
|
+
},
|
|
282
|
+
onClick: () => setInstallResourceTip(blockletMetaUrl),
|
|
283
|
+
children: t('common.install')
|
|
297
284
|
});
|
|
298
285
|
} else {
|
|
299
286
|
installButton = /*#__PURE__*/_jsxs(_Fragment, {
|
|
300
287
|
children: [isMobile ? /*#__PURE__*/_jsx(IconButton, {
|
|
288
|
+
disabled: loading,
|
|
301
289
|
color: "primary",
|
|
302
290
|
sx: {
|
|
303
291
|
mr: 1
|
|
@@ -307,6 +295,7 @@ function Header({
|
|
|
307
295
|
icon: "ic:baseline-install-desktop"
|
|
308
296
|
})
|
|
309
297
|
}) : /*#__PURE__*/_jsx(Button, {
|
|
298
|
+
disabled: loading,
|
|
310
299
|
variant: "outlined",
|
|
311
300
|
sx: {
|
|
312
301
|
mr: 1
|
|
@@ -382,46 +371,63 @@ function Header({
|
|
|
382
371
|
})]
|
|
383
372
|
}), /*#__PURE__*/_jsx(Box, {
|
|
384
373
|
flex: "1"
|
|
385
|
-
}), !isPublished && /*#__PURE__*/_jsxs(
|
|
386
|
-
variant: "contained",
|
|
374
|
+
}), !isPublished && /*#__PURE__*/_jsxs(ButtonGroup, {
|
|
387
375
|
disabled: loading,
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
},
|
|
391
|
-
onClick: () => onRelease(PROJECT.RELEASE_STATUS.published),
|
|
392
|
-
children: [loading && /*#__PURE__*/_jsx(Spinner, {
|
|
393
|
-
size: 14,
|
|
394
|
-
sx: {
|
|
395
|
-
mr: 0.5
|
|
396
|
-
},
|
|
397
|
-
color: "inherit"
|
|
398
|
-
}), t('blocklet.publish.createRelease')]
|
|
399
|
-
}), isPublished && /*#__PURE__*/_jsxs(_Fragment, {
|
|
400
|
-
children: [installButton, /*#__PURE__*/_jsx("a", {
|
|
401
|
-
href: joinURL(`${WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${blocklet.meta.did}/${projectId}/${releaseId}/download/${(release.files || [])[0]}`),
|
|
402
|
-
children: isMobile ? null : /*#__PURE__*/_jsx(Button, {
|
|
403
|
-
variant: "outlined",
|
|
404
|
-
sx: {
|
|
405
|
-
mr: 1
|
|
406
|
-
},
|
|
407
|
-
children: t('common.download')
|
|
408
|
-
})
|
|
409
|
-
}), /*#__PURE__*/_jsxs(Button, {
|
|
410
|
-
disabled: loading,
|
|
376
|
+
variant: "contained",
|
|
377
|
+
children: [/*#__PURE__*/_jsxs(Button, {
|
|
411
378
|
variant: "contained",
|
|
412
|
-
onClick: () =>
|
|
413
|
-
children: [loading
|
|
379
|
+
onClick: () => onRelease(PROJECT.RELEASE_STATUS.published),
|
|
380
|
+
children: [loading && /*#__PURE__*/_jsx(Spinner, {
|
|
414
381
|
size: 14,
|
|
415
382
|
sx: {
|
|
416
|
-
mr:
|
|
383
|
+
mr: 0.5
|
|
417
384
|
},
|
|
418
385
|
color: "inherit"
|
|
419
|
-
})
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
386
|
+
}), t('blocklet.publish.createRelease')]
|
|
387
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
388
|
+
variant: "contained",
|
|
389
|
+
onClick: handleShowSetting,
|
|
390
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
391
|
+
icon: "mage:settings-fill",
|
|
392
|
+
fontSize: "16px"
|
|
393
|
+
})
|
|
394
|
+
})]
|
|
395
|
+
}), isPublished && /*#__PURE__*/_jsxs(_Fragment, {
|
|
396
|
+
children: [installButton, isMobile ? null : /*#__PURE__*/_jsx(Button, {
|
|
397
|
+
component: "a",
|
|
398
|
+
disabled: loading,
|
|
399
|
+
href: joinURL(`${WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${blocklet.meta.did}/${projectId}/${releaseId}/download/${(release.files || [])[0]}`),
|
|
400
|
+
variant: "outlined",
|
|
401
|
+
sx: {
|
|
402
|
+
mr: 1
|
|
403
|
+
},
|
|
404
|
+
children: t('common.download')
|
|
405
|
+
}), /*#__PURE__*/_jsxs(ButtonGroup, {
|
|
406
|
+
disabled: loading,
|
|
407
|
+
variant: "contained",
|
|
408
|
+
children: [/*#__PURE__*/_jsxs(Button, {
|
|
409
|
+
variant: "contained",
|
|
410
|
+
onClick: () => setShowStoreDialog(true),
|
|
411
|
+
children: [loading ? /*#__PURE__*/_jsx(Spinner, {
|
|
412
|
+
size: 14,
|
|
413
|
+
sx: {
|
|
414
|
+
mr: 1
|
|
415
|
+
},
|
|
416
|
+
color: "inherit"
|
|
417
|
+
}) : /*#__PURE__*/_jsx(CloudUploadRoundedIcon, {
|
|
418
|
+
sx: {
|
|
419
|
+
fontSize: '1.3em',
|
|
420
|
+
mr: 1
|
|
421
|
+
}
|
|
422
|
+
}), isMobile ? t('common.upload') : t('blocklet.publish.connectOrUpload')]
|
|
423
|
+
}), /*#__PURE__*/_jsx(Button, {
|
|
424
|
+
variant: "contained",
|
|
425
|
+
onClick: handleShowSetting,
|
|
426
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
427
|
+
icon: "mage:settings-fill",
|
|
428
|
+
fontSize: "16px"
|
|
429
|
+
})
|
|
430
|
+
})]
|
|
425
431
|
})]
|
|
426
432
|
})]
|
|
427
433
|
})
|
|
@@ -445,6 +451,13 @@ function Header({
|
|
|
445
451
|
connectedStores: params.connectedStores || [],
|
|
446
452
|
publishedStoreIds: release?.publishedStoreIds
|
|
447
453
|
})
|
|
454
|
+
}), /*#__PURE__*/_jsx(ProjectSetting, {
|
|
455
|
+
did: blocklet?.meta?.did,
|
|
456
|
+
params: params,
|
|
457
|
+
projectId: projectId,
|
|
458
|
+
open: showSetting,
|
|
459
|
+
setParams: setParams,
|
|
460
|
+
onClose: () => setShowSetting(false)
|
|
448
461
|
})]
|
|
449
462
|
});
|
|
450
463
|
}
|