@abtnode/ux 1.16.17-beta-09df289d → 1.16.17-beta-4f13d99d

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.
@@ -4,13 +4,13 @@ import MenuItem from '@mui/material/MenuItem';
4
4
  import TextField from '@mui/material/TextField';
5
5
  import Typography from '@mui/material/Typography';
6
6
  import Breadcrumbs from '@mui/material/Breadcrumbs';
7
+ import InputAdornment from '@mui/material/InputAdornment';
7
8
  import styled from '@emotion/styled';
8
9
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
9
10
  import Box from '@mui/material/Box';
10
11
  import Button from '@arcblock/ux/lib/Button';
11
12
  import DidConnect from '@arcblock/did-connect/lib/Connect';
12
13
  import Toast from '@arcblock/ux/lib/Toast';
13
- import DidAddress from '../../did-address';
14
14
  import { useNodeContext } from '../../contexts/node';
15
15
  import { useBlockletContext } from '../../contexts/blocklet';
16
16
  import { useSessionContext } from '../../contexts/session';
@@ -66,6 +66,14 @@ export default function CreateProject({
66
66
  setOpenConnect(false);
67
67
  };
68
68
  const onCreate = () => {
69
+ if (!blockletDid) {
70
+ Toast.error(t('blocklet.publish.errorTip.noDid'));
71
+ return;
72
+ }
73
+ if (!blockletTitle) {
74
+ Toast.error(t('blocklet.publish.errorTip.noTitle'));
75
+ return;
76
+ }
69
77
  setLoading(true);
70
78
  api.createProject({
71
79
  input: {
@@ -100,26 +108,29 @@ export default function CreateProject({
100
108
  style: {
101
109
  maxWidth: 500
102
110
  },
103
- children: [/*#__PURE__*/_jsxs(Box, {
111
+ children: [/*#__PURE__*/_jsx(TextField, {
112
+ required: true,
104
113
  sx: {
105
- mb: 3
114
+ mb: 4
106
115
  },
107
- display: "flex",
108
- alignItems: "center",
109
- children: [/*#__PURE__*/_jsxs(Typography, {
110
- variant: "h6",
111
- sx: {
112
- mr: 3
113
- },
114
- children: ["Blocklet DID:", ' ']
115
- }), blockletDid ? /*#__PURE__*/_jsx(DidAddress, {
116
- size: 14,
117
- responsive: true,
118
- did: blockletDid
119
- }) : /*#__PURE__*/_jsx(Button, {
120
- onClick: () => setOpenConnect(true),
121
- children: t('blocklet.publish.createBlockletDid')
122
- })]
116
+ label: "Blocklet DID",
117
+ fullWidth: true,
118
+ readonly: true,
119
+ autoComplete: "off",
120
+ variant: "outlined",
121
+ onClick: () => !blockletDid && setOpenConnect(true),
122
+ InputProps: {
123
+ 'data-cy': 'export-blocklet-did',
124
+ endAdornment: /*#__PURE__*/_jsx(InputAdornment, {
125
+ position: "end",
126
+ children: /*#__PURE__*/_jsx(Button, {
127
+ onClick: () => setOpenConnect(true),
128
+ children: t(blockletDid ? 'common.update' : 'common.create')
129
+ })
130
+ })
131
+ },
132
+ helperText: "",
133
+ value: blockletDid || ''
123
134
  }), openConnect && /*#__PURE__*/_jsx(DidConnect, {
124
135
  open: true,
125
136
  popup: true,
@@ -142,10 +153,11 @@ export default function CreateProject({
142
153
  success: t('blocklet.publish.connect.success')
143
154
  }
144
155
  }), /*#__PURE__*/_jsx(TextField, {
156
+ required: true,
145
157
  label: `Blocklet ${t('common.title')}`,
146
158
  autoComplete: "off",
147
159
  variant: "outlined",
148
- inputProps: {
160
+ InputProps: {
149
161
  'data-cy': 'export-blocklet-title'
150
162
  },
151
163
  fullWidth: true,
@@ -173,7 +185,7 @@ export default function CreateProject({
173
185
  })]
174
186
  }), /*#__PURE__*/_jsx(Button, {
175
187
  variant: "contained",
176
- disabled: loading || !blockletDid || !blockletTitle,
188
+ disabled: loading,
177
189
  onClick: onCreate,
178
190
  children: t('common.create')
179
191
  })]
@@ -12,6 +12,7 @@ import Breadcrumbs from '@mui/material/Breadcrumbs';
12
12
  import Box from '@mui/material/Box';
13
13
  import IconButton from '@mui/material/IconButton';
14
14
  import DeleteOutlineIcon from '@mui/icons-material/DeleteOutline';
15
+ import InputAdornment from '@mui/material/InputAdornment';
15
16
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
16
17
  import Button from '@arcblock/ux/lib/Button';
17
18
  import Toast from '@arcblock/ux/lib/Toast';
@@ -23,15 +24,53 @@ import BlockletBundleAvatar from '../bundle-avatar';
23
24
  import { useNodeContext } from '../../contexts/node';
24
25
  import { useBlockletContext } from '../../contexts/blocklet';
25
26
  import EmptySpinner from '../../empty-spinner';
27
+ import { formatError } from '../../util';
26
28
  import Resource from './resource';
27
-
28
- // eslint-disable-next-line import/no-unresolved
29
29
  import { jsx as _jsx } from "react/jsx-runtime";
30
30
  import { jsxs as _jsxs } from "react/jsx-runtime";
31
31
  import { Fragment as _Fragment } from "react/jsx-runtime";
32
+ const allowedFileTypes = ['image/*', '.jpg', '.jpeg', '.png', '.gif', '.svg'];
33
+ const maxFileSize = 1024 * 1024 * 10; // 10 MB
34
+
35
+ // eslint-disable-next-line import/no-unresolved
32
36
  const UploaderComponent = /*#__PURE__*/lazy(() => import('@blocklet/uploader/react').then(res => ({
33
37
  default: res.Uploader
34
38
  })));
39
+ const validateParams = (params, status, t) => {
40
+ const errors = [];
41
+ if (!params.blockletTitle) {
42
+ errors.push({
43
+ param: 'blockletTitle',
44
+ message: t('blocklet.publish.errorTip.noTitle')
45
+ });
46
+ }
47
+ if (!params.blockletVersion) {
48
+ errors.push({
49
+ param: 'blockletVersion',
50
+ message: t('blocklet.publish.errorTip.noVersion')
51
+ });
52
+ } else if (!semver.valid(params.blockletVersion)) {
53
+ errors.push({
54
+ param: 'blockletVersion',
55
+ message: 'Invalid Blocklet Version'
56
+ });
57
+ }
58
+ if (status === PROJECT.RELEASE_STATUS.published) {
59
+ if (!params.blockletDescription) {
60
+ errors.push({
61
+ param: 'blockletDescription',
62
+ message: t('blocklet.publish.errorTip.noDescription')
63
+ });
64
+ }
65
+ if (!params.note) {
66
+ errors.push({
67
+ param: 'note',
68
+ message: t('blocklet.publish.errorTip.noNote')
69
+ });
70
+ }
71
+ }
72
+ return errors.length ? errors : null;
73
+ };
35
74
  const addComponentTabs = ({
36
75
  tabs,
37
76
  blocklet,
@@ -59,7 +98,11 @@ const addComponentTabs = ({
59
98
  value: key
60
99
  });
61
100
  };
62
- const pickParams = release => pick(release, ['blockletVersion', 'blockletTitle', 'blockletDescription', 'blockletLogo', 'blockletIntroduction', 'blockletScreenshots', 'note']);
101
+ const pickParams = release => {
102
+ const params = pick(release, ['blockletVersion', 'blockletTitle', 'blockletDescription', 'blockletLogo', 'blockletIntroduction', 'blockletScreenshots', 'note']);
103
+ params.blockletScreenshots ||= [];
104
+ return params;
105
+ };
63
106
  export default function CreateRelease({
64
107
  ...rest
65
108
  }) {
@@ -75,6 +118,7 @@ export default function CreateRelease({
75
118
  blocklet
76
119
  } = useBlockletContext();
77
120
  const [params, setParams] = useSetState(null);
121
+ const [paramsErrTip, setParamsErrTip] = useState({});
78
122
  const [loading, setLoading] = useState(false);
79
123
  const [release, setRelease] = useState(null);
80
124
  const {
@@ -114,7 +158,7 @@ export default function CreateRelease({
114
158
  setParams(pickParams(data));
115
159
  }).catch(err => {
116
160
  setLoading(false);
117
- Toast.error(err.message);
161
+ Toast.error(formatError(err));
118
162
  });
119
163
  };
120
164
  const getRelease = () => {
@@ -130,7 +174,7 @@ export default function CreateRelease({
130
174
  setRelease(res?.release);
131
175
  }).catch(err => {
132
176
  setLoading(false);
133
- Toast.error(err.message);
177
+ Toast.error(formatError(err));
134
178
  });
135
179
  };
136
180
  const getData = () => {
@@ -150,30 +194,24 @@ export default function CreateRelease({
150
194
  }, []); // eslint-disable-line react-hooks/exhaustive-deps
151
195
 
152
196
  const onRelease = status => {
153
- if (!params.blockletTitle) {
154
- Toast.error(t('blocklet.publish.errorTip.noTitle'));
155
- return;
156
- }
157
- if (!params.blockletVersion) {
158
- Toast.error(t('blocklet.publish.errorTip.noVersion'));
197
+ const errors = validateParams(params, status, t);
198
+ if (errors) {
199
+ Toast.error(errors.map(x => x.message).join('; '));
200
+ setParamsErrTip(errors.reduce((acc, x) => ({
201
+ ...acc,
202
+ [x.param]: x.message
203
+ }), {}));
159
204
  return;
160
205
  }
161
- if (status === PROJECT.RELEASE_STATUS.published) {
162
- if (!params.blockletDescription) {
163
- Toast.error(t('blocklet.publish.errorTip.noDescription'));
164
- return;
165
- }
166
- if (!params.note) {
167
- Toast.error(t('blocklet.publish.errorTip.noNote'));
168
- return;
169
- }
170
- }
171
206
  const _params = {
172
207
  ...params
173
208
  };
174
209
  _params.blockletVersion = semver.valid(_params.blockletVersion);
175
210
  if (!_params.blockletVersion) {
176
211
  Toast.error('Invalid Blocklet Version');
212
+ setParamsErrTip({
213
+ blockletVersion: 'Invalid Blocklet Version'
214
+ });
177
215
  return;
178
216
  }
179
217
  _params.blockletTitle = (_params.blockletTitle || '').trim();
@@ -203,7 +241,7 @@ export default function CreateRelease({
203
241
  });
204
242
  }
205
243
  }).catch(err => {
206
- Toast.error(err.message);
244
+ Toast.error(formatError(err));
207
245
  });
208
246
  };
209
247
  if (!params && loading) {
@@ -295,7 +333,7 @@ export default function CreateRelease({
295
333
  children: [/*#__PURE__*/_jsx(TextField, {
296
334
  label: `Blocklet ${t('common.title')}`,
297
335
  placeholder: `Blocklet ${t('common.title')}`,
298
- inputProps: {
336
+ InputProps: {
299
337
  'data-cy': 'blocklet-title',
300
338
  readOnly
301
339
  },
@@ -304,14 +342,19 @@ export default function CreateRelease({
304
342
  fullWidth: true,
305
343
  value: params.blockletTitle || '',
306
344
  onChange: e => {
345
+ setParamsErrTip({
346
+ blockletTitle: ''
347
+ });
307
348
  setParams({
308
349
  blockletTitle: e.target.value
309
350
  });
310
- }
351
+ },
352
+ error: !!paramsErrTip.blockletTitle,
353
+ helperText: paramsErrTip.blockletTitle || ''
311
354
  }), /*#__PURE__*/_jsx(TextField, {
312
355
  label: `Blocklet ${t('common.description')}`,
313
356
  placeholder: `Blocklet ${t('common.description')}`,
314
- inputProps: {
357
+ InputProps: {
315
358
  'data-cy': 'blocklet-description',
316
359
  readOnly
317
360
  },
@@ -320,31 +363,45 @@ export default function CreateRelease({
320
363
  fullWidth: true,
321
364
  value: params.blockletDescription || '',
322
365
  onChange: e => {
366
+ setParamsErrTip({
367
+ blockletDescription: ''
368
+ });
323
369
  setParams({
324
370
  blockletDescription: e.target.value
325
371
  });
326
372
  },
373
+ error: !!paramsErrTip.blockletDescription,
374
+ helperText: paramsErrTip.blockletDescription || '',
327
375
  sx: {
328
376
  mt: 3
329
377
  }
330
378
  }), /*#__PURE__*/_jsx(TextField, {
331
379
  label: `Blocklet ${t('common.introduction')}`,
332
380
  placeholder: `Blocklet ${t('common.introduction')}`,
333
- inputProps: {
381
+ InputProps: {
334
382
  'data-cy': 'export-blocklet-introduction',
335
- readOnly
383
+ readOnly,
384
+ endAdornment: /*#__PURE__*/_jsxs(InputAdornment, {
385
+ position: "end",
386
+ children: [params?.blockletIntroduction?.length || 0, " / ", PROJECT.MAX_INTRO_LENGTH]
387
+ })
336
388
  },
337
389
  autoComplete: "off",
338
390
  variant: "outlined",
339
391
  fullWidth: true,
340
392
  multiline: true,
341
- rows: 4,
393
+ minRows: 4,
342
394
  value: params.blockletIntroduction || '',
343
395
  onChange: e => {
396
+ setParamsErrTip({
397
+ blockletIntroduction: ''
398
+ });
344
399
  setParams({
345
- blockletIntroduction: e.target.value
400
+ blockletIntroduction: e.target.value.slice(0, PROJECT.MAX_INTRO_LENGTH)
346
401
  });
347
402
  },
403
+ error: !!paramsErrTip.blockletIntroduction,
404
+ helperText: paramsErrTip.blockletIntroduction || '',
348
405
  sx: {
349
406
  mt: 3
350
407
  }
@@ -365,7 +422,7 @@ export default function CreateRelease({
365
422
  children: [/*#__PURE__*/_jsx(TextField, {
366
423
  label: `Blocklet ${t('common.version')}`,
367
424
  placeholder: `Blocklet ${t('common.version')}`,
368
- inputProps: {
425
+ InputProps: {
369
426
  'data-cy': 'blocklet-version',
370
427
  readOnly
371
428
  },
@@ -374,27 +431,41 @@ export default function CreateRelease({
374
431
  fullWidth: true,
375
432
  value: params.blockletVersion,
376
433
  onChange: e => {
434
+ setParamsErrTip({
435
+ blockletVersion: ''
436
+ });
377
437
  setParams({
378
438
  blockletVersion: e.target.value
379
439
  });
380
- }
440
+ },
441
+ error: !!paramsErrTip.blockletVersion,
442
+ helperText: paramsErrTip.blockletVersion || ''
381
443
  }), /*#__PURE__*/_jsx(TextField, {
382
444
  label: t('blocklet.publish.releaseNote'),
383
445
  autoComplete: "off",
384
446
  variant: "outlined",
385
- inputProps: {
447
+ InputProps: {
386
448
  'data-cy': 'release-note',
387
- readOnly
449
+ readOnly,
450
+ endAdornment: /*#__PURE__*/_jsxs(InputAdornment, {
451
+ position: "end",
452
+ children: [params?.note?.length || 0, " / ", PROJECT.MAX_NOTE_LENGTH]
453
+ })
388
454
  },
389
455
  fullWidth: true,
390
456
  multiline: true,
391
- rows: 4,
457
+ minRows: 4,
392
458
  value: params.note,
393
459
  onChange: e => {
460
+ setParamsErrTip({
461
+ note: ''
462
+ });
394
463
  setParams({
395
- note: e.target.value
464
+ note: e.target.value.slice(0, PROJECT.MAX_NOTE_LENGTH)
396
465
  });
397
466
  },
467
+ error: !!paramsErrTip.note,
468
+ helperText: paramsErrTip.note || '',
398
469
  sx: {
399
470
  mt: 3
400
471
  }
@@ -494,11 +565,19 @@ export default function CreateRelease({
494
565
  setParams({
495
566
  blockletLogo: result.data.filename
496
567
  });
568
+ uploaderLogoRef.current.close();
497
569
  },
498
- plugins: ['ImageEditor', 'Url', 'Webcam'],
570
+ plugins: [],
499
571
  apiPathProps: {
500
572
  uploader: uploadLogoPrefix,
501
573
  disableMediaKitPrefix: true
574
+ },
575
+ coreProps: {
576
+ restrictions: {
577
+ allowedFileTypes,
578
+ maxFileSize,
579
+ maxNumberOfFiles: 1
580
+ }
502
581
  }
503
582
  }, "uploader-screenshot"), /*#__PURE__*/_jsx(UploaderComponent, {
504
583
  id: "\u200Buploader-screenshot",
@@ -510,11 +589,19 @@ export default function CreateRelease({
510
589
  setParams({
511
590
  blockletScreenshots
512
591
  });
592
+ uploaderScreenshotRef.current.close();
513
593
  },
514
- plugins: ['ImageEditor', 'Url', 'Webcam'],
594
+ plugins: [],
515
595
  apiPathProps: {
516
596
  uploader: uploadScreenshotPrefix,
517
597
  disableMediaKitPrefix: true
598
+ },
599
+ coreProps: {
600
+ restrictions: {
601
+ allowedFileTypes,
602
+ maxFileSize,
603
+ maxNumberOfFiles: 5 - screenshotUrls.length
604
+ }
518
605
  }
519
606
  }, "uploader-screenshot")]
520
607
  }), /*#__PURE__*/_jsxs(Box, {
@@ -640,4 +727,11 @@ const Main = styled.div`
640
727
  color: inherit;
641
728
  }
642
729
  }
730
+ .MuiInputBase-multiline .MuiInputAdornment-positionEnd {
731
+ align-self: flex-end;
732
+ .MuiTypography-root {
733
+ font-size: 0.8rem;
734
+ }
735
+ font-size: 0.8rem;
736
+ }
643
737
  `;
@@ -9,6 +9,8 @@ import DeleteIcon from '@mui/icons-material/Delete';
9
9
  import Datatable from '@arcblock/ux/lib/Datatable';
10
10
  import Button from '@arcblock/ux/lib/Button';
11
11
  import Toast from '@arcblock/ux/lib/Toast';
12
+ import Tag from '@arcblock/ux/lib/Tag';
13
+ import RelativeTime from '@arcblock/ux/lib/RelativeTime';
12
14
  import { useBlockletContext } from '../../contexts/blocklet';
13
15
  import { useNodeContext } from '../../contexts/node';
14
16
  import EmptySpinner from '../../empty-spinner';
@@ -104,7 +106,7 @@ export default function ProjectList() {
104
106
  });
105
107
  }
106
108
  const columns = [{
107
- label: t('common.name'),
109
+ label: 'Blocklet',
108
110
  name: 'blockletTitle',
109
111
  options: {
110
112
  customBodyRenderLite: rawIndex => {
@@ -116,7 +118,7 @@ export default function ProjectList() {
116
118
  }
117
119
  }
118
120
  }, {
119
- label: t('common.address'),
121
+ label: 'DID',
120
122
  name: 'blockletDid',
121
123
  options: {
122
124
  customBodyRender: e => {
@@ -127,6 +129,28 @@ export default function ProjectList() {
127
129
  });
128
130
  }
129
131
  }
132
+ }, {
133
+ label: 'Version',
134
+ name: 'blockletVersion',
135
+ options: {
136
+ customBodyRender: value => {
137
+ return value ? /*#__PURE__*/_jsx(Tag, {
138
+ type: "success",
139
+ children: value
140
+ }) : '';
141
+ }
142
+ }
143
+ }, {
144
+ label: t('common.updatedAt'),
145
+ name: 'updatedAt',
146
+ options: {
147
+ customBodyRender: value => {
148
+ return /*#__PURE__*/_jsx(RelativeTime, {
149
+ value: Number(value),
150
+ locale: locale
151
+ });
152
+ }
153
+ }
130
154
  }, {
131
155
  label: t('common.actions'),
132
156
  name: 'actions',
@@ -16,6 +16,8 @@ import { WELLKNOWN_SERVICE_PATH_PREFIX } from '@abtnode/constant';
16
16
  import Button from '@arcblock/ux/lib/Button';
17
17
  import Toast from '@arcblock/ux/lib/Toast';
18
18
  import Tag from '@arcblock/ux/lib/Tag';
19
+ import RelativeTime from '@arcblock/ux/lib/RelativeTime';
20
+ import { PROJECT } from '@blocklet/constant';
19
21
  import { useBlockletContext } from '../../contexts/blocklet';
20
22
  import { useNodeContext } from '../../contexts/node';
21
23
  import EmptySpinner from '../../empty-spinner';
@@ -187,6 +189,21 @@ export default function ReleaseList() {
187
189
  });
188
190
  }
189
191
  }
192
+ }, {
193
+ label: t('common.lastPublishedAt'),
194
+ name: 'updatedAt',
195
+ options: {
196
+ customBodyRenderLite: rawIndex => {
197
+ const release = releases[rawIndex];
198
+ if (release.status !== PROJECT.RELEASE_STATUS.published) {
199
+ return '';
200
+ }
201
+ return /*#__PURE__*/_jsx(RelativeTime, {
202
+ value: Number(release.updatedAt),
203
+ locale: locale
204
+ });
205
+ }
206
+ }
190
207
  }, {
191
208
  label: t('common.actions'),
192
209
  name: 'actions',
@@ -195,11 +212,15 @@ export default function ReleaseList() {
195
212
  const release = releases[rawIndex];
196
213
  return /*#__PURE__*/_jsxs(Box, {
197
214
  display: "flex",
215
+ alignItems: "center",
198
216
  children: [/*#__PURE__*/_jsx(IconButton, {
199
217
  color: "primary",
200
218
  "aria-label": "download",
201
219
  disabled: release.status !== 'published',
202
220
  children: release.status === 'published' ? /*#__PURE__*/_jsx("a", {
221
+ style: {
222
+ display: 'flex'
223
+ },
203
224
  href: joinUrl(`${WELLKNOWN_SERVICE_PATH_PREFIX}/api/project/${blocklet.meta.did}/${project.id}/${release.id}/download/${(release.files || [])[0]}`),
204
225
  children: /*#__PURE__*/_jsx(DownloadIcon, {
205
226
  sx: {
@@ -2,6 +2,7 @@
2
2
  import { ROUTING_RULE_TYPES, DEFAULT_IP_DOMAIN_SUFFIX, DOMAIN_FOR_IP_SITE_REGEXP, DOMAIN_FOR_DEFAULT_SITE, DOMAIN_FOR_IP_SITE } from '@abtnode/constant';
3
3
  import isPathPrefixEqual from '@abtnode/util/lib/is-path-prefix-equal';
4
4
  import { BLOCKLET_DYNAMIC_PATH_PREFIX } from '@blocklet/constant';
5
+ import hasStartEngine from '@blocklet/meta/lib/has-start-engine';
5
6
  const validateRuleByServiceType = (params, localeContext) => {
6
7
  if (params.type === ROUTING_RULE_TYPES.REDIRECT) {
7
8
  if (!params.url) {
@@ -74,7 +75,7 @@ export const validatePathPrefix = ({
74
75
  }) => {
75
76
  // validate children
76
77
  if (curBlocklet) {
77
- let exist = (curBlocklet.children || []).find(x => isPathPrefixEqual(x.mountPoint, params.pathPrefix));
78
+ let exist = (curBlocklet.children || []).find(x => hasStartEngine(x.meta) && isPathPrefixEqual(x.mountPoint, params.pathPrefix));
78
79
  if (curBlocklet.meta.group !== 'gateway' && params.pathPrefix === '/') {
79
80
  exist = '/';
80
81
  }
@@ -14,7 +14,7 @@ import { axios } from '../../util/api';
14
14
  import { formatError, getWebWalletUrl } from '../../util';
15
15
  import { useNodeContext } from '../../contexts/node';
16
16
  import useBlockletInfoForConnectDIDSpaces from '../../hooks/use-blocklet-info-for-connect-did-spaces';
17
- import { getDIDSpaceDidFromEndpoint, isValidSpaceGatewayUrl } from '../../util/spaces';
17
+ import { extraDIDSpacesCoreUrl, getDIDSpaceDidFromEndpoint, isValidSpaceGatewayUrl } from '../../util/spaces';
18
18
  import { useBlockletStorageContext } from '../../contexts/blocklet-storage';
19
19
  /**
20
20
  * @description
@@ -121,6 +121,7 @@ function ConnectTo({
121
121
  ...preValue,
122
122
  open: false
123
123
  }));
124
+ setUrl(null);
124
125
  setAuthorizeFromNftConnect(preValue => ({
125
126
  ...preValue,
126
127
  open: false
@@ -190,7 +191,9 @@ function ConnectTo({
190
191
  const handleUseSpaceGatewayConnect = async () => {
191
192
  try {
192
193
  setLoading(true);
193
- const fullUrl = url.startsWith('http') ? url : `https://${url}`;
194
+ const tempUrl = url.startsWith('http') ? url : `https://${url}`;
195
+ const fullUrl = extraDIDSpacesCoreUrl(tempUrl);
196
+ const spaceDid = new URL(tempUrl).searchParams.get('spaceDid');
194
197
  if (!(await isValidSpaceGatewayUrl(fullUrl))) {
195
198
  throw new Error(t('storage.spaces.gateway.add.invalidUrl'));
196
199
  }
@@ -209,7 +212,8 @@ function ConnectTo({
209
212
  scopes: blockletInfo.scopes,
210
213
  appUrl: blockletInfo.appUrl,
211
214
  referrer: blockletInfo.referrer,
212
- nodeDid: info.did
215
+ nodeDid: info.did,
216
+ spaceDid
213
217
  }
214
218
  }));
215
219
  setOpen(false);
@@ -192,7 +192,8 @@ function SpaceItem({
192
192
  scopes,
193
193
  appUrl,
194
194
  referrer,
195
- nodeDid
195
+ nodeDid,
196
+ spaceDid: spaceGateway.did
196
197
  }
197
198
  }));
198
199
  };
package/es/locales/en.js CHANGED
@@ -632,6 +632,7 @@ module.exports = {
632
632
  saveDraft: 'Save Draft',
633
633
  releaseNote: 'Release Note',
634
634
  errorTip: {
635
+ noDid: 'Blocklet DID is required',
635
636
  noTitle: 'Blocklet Title is required',
636
637
  noVersion: 'Blocklet Version is required',
637
638
  noDescription: 'Blocklet Description is required',
@@ -1313,7 +1314,8 @@ module.exports = {
1313
1314
  launchFailed: 'Failed to launch the app, please try again',
1314
1315
  installedButStopped: 'The app is installed successfully, but cannot be started. You can start it manually after resolving blocking issues',
1315
1316
  installedButError: 'The app is successfully installed, but failed to start',
1316
- restoreFailed: 'Failed to restore app, please try again'
1317
+ restoreFailed: 'Failed to restore app, please try again',
1318
+ resourceBlocklet: 'Resource Blocklet cannot be installed as an application, you can mount this blocklet into existing applications.'
1317
1319
  },
1318
1320
  steps: {
1319
1321
  introduction: 'Introduction',
package/es/locales/zh.js CHANGED
@@ -639,6 +639,7 @@ module.exports = {
639
639
  saveDraft: '保存草稿',
640
640
  releaseNote: '发布说明',
641
641
  errorTip: {
642
+ noDid: '请填写 Blocklet DID',
642
643
  noTitle: '请填写 Blocklet 名称',
643
644
  noVersion: '请填写 Blocklet 版本号',
644
645
  noDescription: '请填写 Blocklet 描述',
@@ -1318,7 +1319,8 @@ module.exports = {
1318
1319
  launchFailed: '启动应用失败,请重试',
1319
1320
  installedButStopped: '应用安装成功,但是无法启动,解决启动问题之后后可手动启动',
1320
1321
  installedButError: '应用已经安装,但是运行出错了',
1321
- restoreFailed: '还原应用失败,请重试'
1322
+ restoreFailed: '还原应用失败,请重试',
1323
+ resourceBlocklet: '资源 Blocklet 无法作为应用被安装,你可以将该 Blocklet 挂载到现有的应用中。'
1322
1324
  },
1323
1325
  steps: {
1324
1326
  introduction: '简介',
@@ -2,6 +2,7 @@ import { useState } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
4
4
  import Toast from '@arcblock/ux/lib/Toast';
5
+ import { hasActiveOwnerPassport } from '@abtnode/util/lib/passport';
5
6
  import Confirm from '../../confirm';
6
7
  import { useNodeContext } from '../../contexts/node';
7
8
  import { useTeamContext } from '../../contexts/team';
@@ -82,7 +83,9 @@ export default function ToggleUserApproval({
82
83
  color: user.approved ? 'error' : 'primary'
83
84
  };
84
85
  let can;
85
- if (!inService) {
86
+ if (hasActiveOwnerPassport(user)) {
87
+ can = false;
88
+ } else if (!inService) {
86
89
  can = nodeInfo.nodeOwner && !isNodeOwner(nodeInfo, user.did) && !isSelf(session.user, user.did);
87
90
  } else {
88
91
  can = !isSelf(session.user, user.did);