@abtnode/ux 1.16.18-beta-7aa6be5a → 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.
Files changed (47) hide show
  1. package/es/blocklet/actions.js +17 -6
  2. package/es/blocklet/add-cert.js +1 -0
  3. package/es/blocklet/component/add-component-core.js +1317 -0
  4. package/es/blocklet/component/add.js +14 -1246
  5. package/es/blocklet/component/select-store.js +21 -7
  6. package/es/blocklet/component/store-blocklet-list.js +20 -6
  7. package/es/blocklet/configuration.js +28 -118
  8. package/es/blocklet/logo-uploader.js +131 -0
  9. package/es/blocklet/oauth/federated-site-list.js +1 -1
  10. package/es/blocklet/publish/create-project.js +6 -2
  11. package/es/blocklet/publish/create-release.js +5 -4
  12. package/es/blocklet/publish/index.js +26 -2
  13. package/es/blocklet/publish/project-list.js +6 -2
  14. package/es/hooks/use-navigation.js +1 -1
  15. package/es/hooks/use-passport-id.js +9 -6
  16. package/es/locales/en.js +26 -5
  17. package/es/locales/zh.js +22 -1
  18. package/es/logs/log-terminal.js +2 -1
  19. package/es/schema-form/index.js +11 -3
  20. package/es/team/members/connections.js +27 -0
  21. package/es/team/members/member.js +2 -26
  22. package/es/team/members/passport-item.js +104 -0
  23. package/es/team/members/passports.js +23 -78
  24. package/lib/blocklet/actions.js +17 -6
  25. package/lib/blocklet/add-cert.js +1 -0
  26. package/lib/blocklet/component/add-component-core.js +1131 -0
  27. package/lib/blocklet/component/add.js +18 -1058
  28. package/lib/blocklet/component/select-store.js +25 -7
  29. package/lib/blocklet/component/store-blocklet-list.js +22 -8
  30. package/lib/blocklet/configuration.js +30 -90
  31. package/lib/blocklet/logo-uploader.js +112 -0
  32. package/lib/blocklet/oauth/federated-site-list.js +1 -1
  33. package/lib/blocklet/publish/create-project.js +5 -1
  34. package/lib/blocklet/publish/create-release.js +5 -4
  35. package/lib/blocklet/publish/index.js +27 -1
  36. package/lib/blocklet/publish/project-list.js +5 -1
  37. package/lib/hooks/use-navigation.js +1 -1
  38. package/lib/hooks/use-passport-id.js +9 -7
  39. package/lib/locales/en.js +26 -5
  40. package/lib/locales/zh.js +22 -1
  41. package/lib/logs/log-terminal.js +2 -1
  42. package/lib/schema-form/index.js +9 -3
  43. package/lib/team/members/connections.js +35 -0
  44. package/lib/team/members/member.js +8 -33
  45. package/lib/team/members/passport-item.js +95 -0
  46. package/lib/team/members/passports.js +26 -54
  47. package/package.json +20 -20
@@ -9,7 +9,7 @@ import Button from '@arcblock/ux/lib/Button';
9
9
  import ArrowDropDownIcon from '@mui/icons-material/ArrowDropDown';
10
10
  import Typography from '@mui/material/Typography';
11
11
  import useLocalStorage from 'react-use/lib/useLocalStorage';
12
- import { STORAGE_KEY_STORE_BLOCKLET, STORAGE_KEY_STORE_SERVER } from '../../util/constants';
12
+ import uniqBy from 'lodash/uniqBy';
13
13
  import { useNodeContext } from '../../contexts/node';
14
14
  import { useBlockletContext } from '../../contexts/blocklet';
15
15
  import AddStore from '../../store/add';
@@ -22,7 +22,9 @@ export default function SelectStore({
22
22
  onChange,
23
23
  loading,
24
24
  children,
25
- extra
25
+ extra,
26
+ stores: customStores,
27
+ storageKey
26
28
  }) {
27
29
  const {
28
30
  t
@@ -36,16 +38,21 @@ export default function SelectStore({
36
38
  } = useBlockletContext();
37
39
  const [open, setOpen] = useState(false);
38
40
  const storeSelectRef = useRef(null);
39
- const storageKey = inService ? STORAGE_KEY_STORE_BLOCKLET : STORAGE_KEY_STORE_SERVER;
40
- const [storeUrl, setStoreUrl] = useLocalStorage(storageKey);
41
+ const [storeUrlMem, setStoreUrlMem] = useState();
42
+ const [storeUrlLs, setStoreUrlLs] = useLocalStorage(storageKey || 'tmp');
43
+ const [storeUrl, setStoreUrl] = storageKey ? [storeUrlLs, setStoreUrlLs] : [storeUrlMem, setStoreUrlMem];
41
44
  const {
42
- storeList,
45
+ storeList: appStoreList,
43
46
  teamDid
44
47
  } = getStoreList({
45
48
  fromBlocklet: inService,
46
49
  blocklet,
47
50
  nodeInfo
48
51
  });
52
+ const storeList = uniqBy([...customStores.map(x => ({
53
+ ...x,
54
+ protected: true
55
+ })), ...appStoreList], 'url');
49
56
  const currentRegistry = storeUrl && storeList.find(x => storeUrl === x.url) || storeList[0];
50
57
  const isServerlessMode = nodeInfo.mode === NODE_MODES.SERVERLESS;
51
58
  return /*#__PURE__*/_jsxs(_Fragment, {
@@ -134,12 +141,19 @@ SelectStore.propTypes = {
134
141
  onChange: PropTypes.func,
135
142
  loading: PropTypes.bool,
136
143
  children: PropTypes.any.isRequired,
137
- extra: PropTypes.node
144
+ extra: PropTypes.node,
145
+ storageKey: PropTypes.string,
146
+ stores: PropTypes.arrayOf(PropTypes.shape({
147
+ name: PropTypes.string.isRequired,
148
+ url: PropTypes.string.isRequired
149
+ }))
138
150
  };
139
151
  SelectStore.defaultProps = {
140
152
  onChange: () => {},
141
153
  loading: false,
142
- extra: ''
154
+ extra: '',
155
+ stores: [],
156
+ storageKey: ''
143
157
  };
144
158
  const SelectStoreTitle = styled.div`
145
159
  display: flex;
@@ -134,25 +134,36 @@ export default function BlockletList({
134
134
  handleBlockletRender,
135
135
  extraFilter,
136
136
  serverVersion,
137
+ resourceType,
137
138
  ...rest
138
139
  }) {
139
140
  const {
140
141
  locale
141
142
  } = useLocaleContext();
143
+ const [initialized, setInitialized] = useState(false);
142
144
  const [filters, setFilters] = useState({});
143
145
  const handleChange = changeData => {
144
146
  setFilters(changeData);
145
147
  };
146
148
  const endpoint = storeUrl;
147
149
  useEffect(() => {
148
- setFilters({});
149
- }, [endpoint]);
150
+ setFilters({
151
+ resourceType
152
+ });
153
+ }, [endpoint, resourceType]);
154
+ useEffect(() => {
155
+ setInitialized(true);
156
+ setFilters({
157
+ resourceType
158
+ });
159
+ // eslint-disable-next-line react-hooks/exhaustive-deps
160
+ }, []);
150
161
  return /*#__PURE__*/_jsx(ErrorBoundary, {
151
162
  FallbackComponent: ErrorFallback,
152
163
  resetKeys: [endpoint],
153
164
  children: /*#__PURE__*/_jsx("div", {
154
165
  ...rest,
155
- children: /*#__PURE__*/_jsx(InnerList, {
166
+ children: initialized && /*#__PURE__*/_jsx(InnerList, {
156
167
  blockletRender: blockletRenderProps => {
157
168
  const defaultProps = {
158
169
  ...blockletRenderProps,
@@ -173,7 +184,8 @@ export default function BlockletList({
173
184
  onSearchSelect: handleSearchSelect,
174
185
  filters: filters,
175
186
  extraFilter: extraFilter,
176
- serverVersion: serverVersion
187
+ serverVersion: serverVersion,
188
+ fetchCategoryDelay: 500
177
189
  })
178
190
  })
179
191
  });
@@ -184,14 +196,16 @@ BlockletList.propTypes = {
184
196
  handleSearchSelect: PropTypes.func,
185
197
  handleBlockletRender: PropTypes.func,
186
198
  extraFilter: PropTypes.func,
187
- serverVersion: PropTypes.string
199
+ serverVersion: PropTypes.string,
200
+ resourceType: PropTypes.string
188
201
  };
189
202
  BlockletList.defaultProps = {
190
203
  handleButtonClick: null,
191
204
  handleSearchSelect: null,
192
205
  handleBlockletRender: null,
193
206
  extraFilter: undefined,
194
- serverVersion: ''
207
+ serverVersion: '',
208
+ resourceType: ''
195
209
  };
196
210
  const StyledBlocklet = styled(Blocklet)`
197
211
  .ms-highlight {
@@ -1,17 +1,14 @@
1
- import React, { useState, useContext, lazy, useRef } from 'react';
1
+ import React, { useState, useContext } from 'react';
2
2
  import styled from '@emotion/styled';
3
3
  import PropTypes from 'prop-types';
4
4
  import get from 'lodash/get';
5
5
  import isEqual from 'lodash/isEqual';
6
- import classnames from 'classnames';
7
- import joinUrl from 'url-join';
8
6
  import Box from '@mui/material/Box';
9
7
  import Switch from '@mui/material/Switch';
10
8
  import Divider from '@mui/material/Divider';
11
9
  import { LocaleContext } from '@arcblock/ux/lib/Locale/context';
12
10
  import Button from '@arcblock/ux/lib/Button';
13
11
  import LoopIcon from '@mui/icons-material/Loop';
14
- import Avatar from '@mui/material/Avatar';
15
12
  import { EVENTS } from '@abtnode/constant';
16
13
  import { BLOCKLET_CONFIGURABLE_KEY, SUPPORTED_LANGUAGES } from '@blocklet/constant';
17
14
  import { getWhoCanAccess } from '@blocklet/meta/lib/util';
@@ -26,18 +23,13 @@ import ClearCache from '../clear-cache';
26
23
  import AppSk from './preferences/app-sk';
27
24
  import TransferOwner from './transfer-owner';
28
25
  import useAppLogo from '../hooks/use-app-logo';
26
+ import Uploader from './logo-uploader';
29
27
  import { jsx as _jsx } from "react/jsx-runtime";
30
28
  import { jsxs as _jsxs } from "react/jsx-runtime";
31
29
  const languages = Object.keys(SUPPORTED_LANGUAGES).map(x => ({
32
30
  code: x,
33
31
  name: SUPPORTED_LANGUAGES[x].nativeName
34
32
  }));
35
-
36
- // eslint-disable-next-line import/no-unresolved
37
- const UploaderComponent = /*#__PURE__*/lazy(() => import('@blocklet/uploader/react').then(res => ({
38
- default: res.Uploader
39
- })));
40
- const uploadPrefix = '/blocklet/logo/upload';
41
33
  function BlockletEnvironment({
42
34
  blocklet,
43
35
  onUpdate,
@@ -62,7 +54,6 @@ function BlockletEnvironment({
62
54
  const whoCanAccess = getWhoCanAccess(blocklet);
63
55
  const publicToStore = blocklet?.settings?.publicToStore;
64
56
  const disabled = loading || !hasPermission;
65
- const uploaderLogoRef = useRef(null);
66
57
  const {
67
58
  logoUrl,
68
59
  rectLogoUrl,
@@ -70,20 +61,6 @@ function BlockletEnvironment({
70
61
  } = useAppLogo({
71
62
  blocklet
72
63
  });
73
- const [apiPathProps, setApiPathProps] = useState();
74
- const uploadLogoPrefix = joinUrl(prefix, uploadPrefix, 'square', blocklet.meta.did);
75
- const uploadLogoRectPrefix = joinUrl(prefix, uploadPrefix, 'rect', blocklet.meta.did);
76
- const uploadLogoFaviconPrefix = joinUrl(prefix, uploadPrefix, 'favicon', blocklet.meta.did);
77
- const openUploader = uploaderPrefix => {
78
- if (!hasPermission) {
79
- return;
80
- }
81
- setApiPathProps({
82
- uploader: uploaderPrefix,
83
- disableMediaKitPrefix: true
84
- });
85
- uploaderLogoRef.current.open();
86
- };
87
64
  const {
88
65
  did
89
66
  } = blocklet.meta;
@@ -269,11 +246,6 @@ function BlockletEnvironment({
269
246
  setLoading(false);
270
247
  }
271
248
  };
272
- const uploaderStyle = {
273
- '&::after': {
274
- content: `"${t('common.switch')}"`
275
- }
276
- };
277
249
  return /*#__PURE__*/_jsxs(Div, {
278
250
  ...rest,
279
251
  children: [configurableEnvs.map(item => /*#__PURE__*/_jsxs(Box, {
@@ -306,19 +278,15 @@ function BlockletEnvironment({
306
278
  width: 'auto'
307
279
  },
308
280
  children: t('blocklet.config.logoSquare')
309
- }), /*#__PURE__*/_jsx(Box, {
310
- className: classnames('uploader-wrapper', hasPermission && 'enabled'),
311
- sx: uploaderStyle,
312
- onClick: () => openUploader(uploadLogoPrefix),
313
- children: /*#__PURE__*/_jsx(Avatar, {
314
- sx: {
315
- height: 80,
316
- width: 80
317
- },
318
- variant: "square",
319
- alt: "Blocklet Logo",
320
- src: logoUrl
321
- })
281
+ }), /*#__PURE__*/_jsx(Uploader, {
282
+ did: blocklet.meta.did,
283
+ height: 80,
284
+ width: 80,
285
+ type: "square",
286
+ prefix: prefix,
287
+ url: logoUrl,
288
+ enabled: hasPermission,
289
+ headers: getSessionInHeader
322
290
  }), /*#__PURE__*/_jsx(Box, {
323
291
  className: "config-label",
324
292
  fontSize: 14,
@@ -328,17 +296,14 @@ function BlockletEnvironment({
328
296
  mb: 1.5,
329
297
  className: "config-desc",
330
298
  children: t('blocklet.config.logoRectDesc')
331
- }), /*#__PURE__*/_jsx(Box, {
332
- className: classnames('uploader-wrapper', hasPermission && 'enabled'),
333
- sx: uploaderStyle,
334
- onClick: () => openUploader(uploadLogoRectPrefix),
335
- children: /*#__PURE__*/_jsx("img", {
336
- alt: "Blocklet Rect Logo",
337
- src: rectLogoUrl,
338
- style: {
339
- height: '80px'
340
- }
341
- })
299
+ }), /*#__PURE__*/_jsx(Uploader, {
300
+ did: blocklet.meta.did,
301
+ height: 80,
302
+ type: "rect",
303
+ prefix: prefix,
304
+ url: rectLogoUrl,
305
+ enabled: hasPermission,
306
+ headers: getSessionInHeader
342
307
  }), /*#__PURE__*/_jsx(Box, {
343
308
  className: "config-label",
344
309
  fontSize: 14,
@@ -348,41 +313,16 @@ function BlockletEnvironment({
348
313
  mb: 1.5,
349
314
  className: "config-desc",
350
315
  children: t('blocklet.config.logoFaviconDesc')
316
+ }), /*#__PURE__*/_jsx(Uploader, {
317
+ did: blocklet.meta.did,
318
+ height: 25,
319
+ width: 25,
320
+ type: "favicon",
321
+ prefix: prefix,
322
+ url: faviconUrl,
323
+ enabled: hasPermission,
324
+ headers: getSessionInHeader
351
325
  }), /*#__PURE__*/_jsx(Box, {
352
- sx: {
353
- display: 'inline-flex',
354
- cursor: hasPermission ? 'pointer' : 'default'
355
- },
356
- onClick: () => openUploader(uploadLogoFaviconPrefix),
357
- children: /*#__PURE__*/_jsx(Avatar, {
358
- variant: "square",
359
- sx: {
360
- width: 20,
361
- height: 20
362
- },
363
- alt: "Blocklet Favicon Logo",
364
- src: faviconUrl
365
- })
366
- }), /*#__PURE__*/_jsx(UploaderComponent, {
367
- id: "\u200Buploader-logo",
368
- ref: uploaderLogoRef,
369
- popup: true,
370
- onUploadFinish: () => {
371
- uploaderLogoRef.current.close();
372
- },
373
- plugins: [],
374
- apiPathProps: apiPathProps,
375
- coreProps: {
376
- restrictions: {
377
- allowedFileTypes: ['image/*', '.jpg', '.jpeg', '.png', '.gif', '.svg'],
378
- maxFileSize: 1024 * 1024 * 10,
379
- maxNumberOfFiles: 1
380
- }
381
- },
382
- tusProps: {
383
- headers: getSessionInHeader
384
- }
385
- }, "uploader-logo"), /*#__PURE__*/_jsx(Box, {
386
326
  className: "config-form",
387
327
  children: whoCanAccess === 'all' && blocklet.source === 'registry' && /*#__PURE__*/_jsxs(Box, {
388
328
  className: "config-item",
@@ -617,34 +557,4 @@ const Div = styled.div`
617
557
  .form-item {
618
558
  margin-top: 0;
619
559
  }
620
-
621
- .uploader-wrapper {
622
- display: inline-flex;
623
- position: relative;
624
- font-size: 0px;
625
- &.enabled {
626
- cursor: pointer;
627
- }
628
- &::after {
629
- display: none;
630
- }
631
- &.enabled::after {
632
- display: block;
633
- opacity: 0;
634
- position: absolute;
635
- bottom: 0;
636
- background: rgba(0, 0, 0, 0.2);
637
- left: 0;
638
- right: 0;
639
- height: 2.2em;
640
- color: white;
641
- text-align: center;
642
- font-size: 12px;
643
- line-height: 2em;
644
- transition: opacity 0.3s ease;
645
- }
646
- &:hover::after {
647
- opacity: 1;
648
- }
649
- }
650
560
  `;
@@ -0,0 +1,131 @@
1
+ import React, { lazy, useRef } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import joinUrl from 'url-join';
4
+ import styled from '@emotion/styled';
5
+ import noop from 'lodash/noop';
6
+ import Box from '@mui/material/Box';
7
+ import classnames from 'classnames';
8
+ import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
9
+
10
+ // eslint-disable-next-line import/no-unresolved
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ import { jsxs as _jsxs } from "react/jsx-runtime";
13
+ const Uploader = /*#__PURE__*/lazy(() => import('@blocklet/uploader/react').then(res => ({
14
+ default: res.Uploader
15
+ })));
16
+ const uploadPrefix = '/blocklet/logo/upload';
17
+ export default function LogoUploader({
18
+ url,
19
+ height,
20
+ width,
21
+ enabled,
22
+ type,
23
+ did,
24
+ prefix,
25
+ headers,
26
+ onUploaded
27
+ }) {
28
+ const {
29
+ t
30
+ } = useLocaleContext();
31
+ const uploaderRef = useRef(null);
32
+ const onOpen = () => {
33
+ uploaderRef.current?.open();
34
+ };
35
+ const onFinish = () => {
36
+ onUploaded();
37
+ uploaderRef.current?.close();
38
+ };
39
+ const uploaderStyle = {
40
+ cursor: enabled ? 'pointer' : 'default',
41
+ '&::after': {
42
+ content: `"${t('common.switch')}"`
43
+ }
44
+ };
45
+ return /*#__PURE__*/_jsxs(Div, {
46
+ id: `uploader-${did}-${type}`,
47
+ children: [/*#__PURE__*/_jsx(Uploader, {
48
+ ref: uploaderRef,
49
+ popup: true,
50
+ onUploadFinish: onFinish,
51
+ plugins: ['ImageEditor'],
52
+ apiPathProps: {
53
+ uploader: joinUrl(prefix, uploadPrefix, type, did),
54
+ disableMediaKitPrefix: true
55
+ },
56
+ coreProps: {
57
+ restrictions: {
58
+ allowedFileTypes: ['image/*', '.jpg', '.jpeg', '.png', '.gif', '.svg'],
59
+ maxFileSize: 1024 * 1024 * 10,
60
+ maxNumberOfFiles: 1
61
+ }
62
+ },
63
+ tusProps: {
64
+ headers
65
+ }
66
+ }), /*#__PURE__*/_jsx(Box, {
67
+ className: classnames('uploader-wrapper', enabled && 'enabled'),
68
+ sx: uploaderStyle,
69
+ onClick: onOpen,
70
+ children: /*#__PURE__*/_jsx("img", {
71
+ alt: "Logo",
72
+ src: url,
73
+ style: {
74
+ height,
75
+ width
76
+ }
77
+ })
78
+ })]
79
+ }, `uploader-${did}-${type}`);
80
+ }
81
+
82
+ // infer props for Uploader
83
+ LogoUploader.propTypes = {
84
+ url: PropTypes.string.isRequired,
85
+ type: PropTypes.oneOf(['square', 'rect', 'favicon']).isRequired,
86
+ did: PropTypes.string.isRequired,
87
+ prefix: PropTypes.string.isRequired,
88
+ headers: PropTypes.func,
89
+ onUploaded: PropTypes.func,
90
+ height: PropTypes.number,
91
+ width: PropTypes.any,
92
+ enabled: PropTypes.bool
93
+ };
94
+ LogoUploader.defaultProps = {
95
+ height: 80,
96
+ width: 'auto',
97
+ enabled: true,
98
+ headers: () => ({}),
99
+ onUploaded: noop
100
+ };
101
+ const Div = styled.div`
102
+ .uploader-wrapper {
103
+ display: inline-flex;
104
+ position: relative;
105
+ font-size: 0px;
106
+ &.enabled {
107
+ cursor: pointer;
108
+ }
109
+ &::after {
110
+ display: none;
111
+ }
112
+ &.enabled::after {
113
+ display: block;
114
+ opacity: 0;
115
+ position: absolute;
116
+ bottom: 0;
117
+ background: rgba(0, 0, 0, 0.2);
118
+ left: 0;
119
+ right: 0;
120
+ height: 2.2em;
121
+ color: white;
122
+ text-align: center;
123
+ font-size: 12px;
124
+ line-height: 2em;
125
+ transition: opacity 0.3s ease;
126
+ }
127
+ &:hover::after {
128
+ opacity: 1;
129
+ }
130
+ }
131
+ `;
@@ -206,7 +206,7 @@ function FederatedSiteList({
206
206
  });
207
207
  }
208
208
  return list;
209
- }, [federatedConfig.appId, federatedSites, isMaster]);
209
+ }, [federatedConfig.appId, federatedSites, isMaster, t]);
210
210
  const tableOptions = useCreation(() => {
211
211
  return {
212
212
  sort: true,
@@ -1,5 +1,5 @@
1
1
  import { useState } from 'react';
2
- import { Link, useNavigate } from 'react-router-dom';
2
+ import { Link, useNavigate, useParams } from 'react-router-dom';
3
3
  import MenuItem from '@mui/material/MenuItem';
4
4
  import TextField from '@mui/material/TextField';
5
5
  import Typography from '@mui/material/Typography';
@@ -52,6 +52,9 @@ export default function CreateProject({
52
52
  } = useNodeContext();
53
53
  const [blockletDid, setBlockletDid] = useState();
54
54
  const [openConnect, setOpenConnect] = useState(false);
55
+ const {
56
+ componentDid
57
+ } = useParams();
55
58
  const handleCreateBlockletDidError = err => {
56
59
  Toast.error(err.message);
57
60
  setOpenConnect(false);
@@ -80,7 +83,8 @@ export default function CreateProject({
80
83
  did: blocklet.meta.did,
81
84
  blockletTitle: blockletTitle || '',
82
85
  blockletDid,
83
- type
86
+ type,
87
+ componentDid
84
88
  }
85
89
  }).then(() => {
86
90
  setLoading(false);
@@ -108,7 +108,8 @@ export default function CreateRelease({
108
108
  const navigate = useNavigate();
109
109
  const {
110
110
  projectId,
111
- releaseId: inputReleaseId
111
+ releaseId: inputReleaseId,
112
+ componentDid
112
113
  } = useParams();
113
114
  const {
114
115
  t
@@ -128,7 +129,7 @@ export default function CreateRelease({
128
129
  const releaseId = inputReleaseId === 'create' ? '' : inputReleaseId;
129
130
  const mode = inputReleaseId === 'create' ? 'create' : 'edit';
130
131
  const tabs = [];
131
- const resourceComponents = (blocklet?.children || []).filter(x => x.meta.capabilities.resourceExportApi);
132
+ const resourceComponents = (blocklet?.children || []).filter(x => x.meta.capabilities.resourceExportApi).filter(x => !componentDid || x.meta.did === componentDid);
132
133
  resourceComponents.forEach(item => {
133
134
  addComponentTabs({
134
135
  tabs,
@@ -570,7 +571,7 @@ export default function CreateRelease({
570
571
  });
571
572
  uploaderLogoRef.current.close();
572
573
  },
573
- plugins: [],
574
+ plugins: ['ImageEditor'],
574
575
  apiPathProps: {
575
576
  uploader: uploadLogoPrefix,
576
577
  disableMediaKitPrefix: true
@@ -594,7 +595,7 @@ export default function CreateRelease({
594
595
  });
595
596
  uploaderScreenshotRef.current.close();
596
597
  },
597
- plugins: [],
598
+ plugins: ['ImageEditor'],
598
599
  apiPathProps: {
599
600
  uploader: uploadScreenshotPrefix,
600
601
  disableMediaKitPrefix: true
@@ -1,7 +1,8 @@
1
- import React from 'react';
2
- import { Routes, Route } from 'react-router-dom';
1
+ import React, { useEffect } from 'react';
2
+ import { Routes, Route, useLocation, useParams } from 'react-router-dom';
3
3
  import styled from '@emotion/styled';
4
4
  import Box from '@mui/material/Box';
5
+ import { useBlockletContext } from '../../contexts/blocklet';
5
6
  import ProjectList from './project-list';
6
7
  import CreateProject from './create-project';
7
8
  import ReleasesList from './release-list';
@@ -9,6 +10,29 @@ import CreateRelease from './create-release';
9
10
  import { jsx as _jsx } from "react/jsx-runtime";
10
11
  import { jsxs as _jsxs } from "react/jsx-runtime";
11
12
  export default function BlockletPublish() {
13
+ const {
14
+ blocklet
15
+ } = useBlockletContext();
16
+ const location = useLocation();
17
+
18
+ // post message to parent window when route changed
19
+ const {
20
+ componentDid
21
+ } = useParams();
22
+ useEffect(() => {
23
+ if (componentDid && window.parent) {
24
+ const path = `${location.pathname}${location.search}`;
25
+ window.parent.postMessage({
26
+ event: 'popstate',
27
+ page: 'publish',
28
+ componentDid,
29
+ path
30
+ }, '*');
31
+ }
32
+ }, [componentDid, location]);
33
+ if (!blocklet) {
34
+ return null;
35
+ }
12
36
  return /*#__PURE__*/_jsx(Main, {
13
37
  children: /*#__PURE__*/_jsxs(Routes, {
14
38
  children: [/*#__PURE__*/_jsx(Route, {
@@ -1,6 +1,6 @@
1
1
  /* eslint-disable react/no-unstable-nested-components */
2
2
  import React, { useState, useEffect } from 'react';
3
- import { Link } from 'react-router-dom';
3
+ import { Link, useParams } from 'react-router-dom';
4
4
  import styled from '@emotion/styled';
5
5
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
6
6
  import Box from '@mui/material/Box';
@@ -31,11 +31,15 @@ export default function ProjectList() {
31
31
  blocklet
32
32
  } = useBlockletContext();
33
33
  const [deleteConfirm, setDeleteConfirm] = useState(null);
34
+ const {
35
+ componentDid = ''
36
+ } = useParams();
34
37
  const [projects, setProjects] = useState(null);
35
38
  const getProjects = () => {
36
39
  api.getProjects({
37
40
  input: {
38
- did: blocklet.meta.did
41
+ did: blocklet.meta.did,
42
+ componentDid
39
43
  }
40
44
  }).then(res => {
41
45
  const list = res?.projects || [];
@@ -28,7 +28,7 @@ const injectNavigationData = {
28
28
  from: 'tmpl'
29
29
  }],
30
30
  dashboard: [{
31
- id: '/access',
31
+ id: '/team',
32
32
  title: {
33
33
  en: 'Access',
34
34
  zh: '访问控制'
@@ -1,11 +1,14 @@
1
- import useLocalStorage from 'react-use/lib/useLocalStorage';
2
1
  export default function usePassportId() {
3
- const [passportId, setPassportId, clearPassportId] = useLocalStorage('passportId', '');
2
+ const clearPassportId = () => {
3
+ localStorage.removeItem('passportId');
4
+ };
5
+ const setPassportId = value => {
6
+ localStorage.setItem('passportId', value);
7
+ };
4
8
  const getPassportId = () => {
5
- setTimeout(() => {
6
- clearPassportId();
7
- }, 0);
8
- return passportId || '';
9
+ const passportId = localStorage.getItem('passportId') || '';
10
+ clearPassportId();
11
+ return passportId;
9
12
  };
10
13
  return {
11
14
  getPassportId,